Jump to main content

##

# 1.2.7.4.88 SYS_FS_MEDIA_FUNCTIONS Struct

## C

    typedef struct
    {
        /* To obtains status of media */
        bool (*mediaStatusGet)(DRV_HANDLE handle);
        /* Function to get media geometry */
        SYS_FS_MEDIA_GEOMETRY * (*mediaGeometryGet)(const DRV_HANDLE handle);
        /* Function for sector read */
        void (*sectorRead)(DRV_HANDLE clientHandle,SYS_FS_MEDIA_BLOCK_COMMAND_HANDLE * commandHandle,
        void * buffer, uint32_t blockStart, uint32_t nBlock);
        /* Function for sector write */
        void (*sectorWrite)(const DRV_HANDLE handle,SYS_FS_MEDIA_BLOCK_COMMAND_HANDLE * commandHandle,
        void * sourceBuffer, uint32_t blockStart,uint32_t nBlock);
        /* Function register the event handler with media */
        void (*eventHandlerset)(DRV_HANDLE handle, const void * eventHandler, const uintptr_t context);
        /* Function to obtain the command status */
        SYS_FS_MEDIA_COMMAND_STATUS (*commandStatusGet)(DRV_HANDLE handle,
        SYS_FS_MEDIA_BLOCK_COMMAND_HANDLE commandHandle);
        /* Function to read certain bytes from the media */
        void (*Read) (DRV_HANDLE clientHandle,SYS_FS_MEDIA_BLOCK_COMMAND_HANDLE * commandHandle,
        void * buffer, uint32_t blockStart, uint32_t nBlock);
        /* Function to obtain the address of the media (to be used for NVM only) */
        uintptr_t (*addressGet) ( const DRV_HANDLE hClient);
        void (*erase) ( const DRV_HANDLE handle,SYS_FS_MEDIA_BLOCK_COMMAND_HANDLE * commandHandle,
        uint32_t blockStart,uint32_t nBlock);
        /* Function to open the media driver */
        DRV_HANDLE (*open)(SYS_MODULE_INDEX index, DRV_IO_INTENT intent);
        /* Function to close the media */
        void (*close)(DRV_HANDLE client);
        /* Task function of the media */
        void (*tasks)(SYS_MODULE_OBJ obj);

    } SYS_FS_MEDIA_FUNCTIONS;

## Summary

Structure of function pointers for media driver

## Description

This structure contains the definition for functions of media driver, which is registered with the media manager. In future, if any new driver needs to be registered with the media manager (say, to act as a media for file system), the new driver should have implemented all these functions.

## Remarks

None.