IO_Ctrl() - Device Driver

static  void  FSDev_####_IO_Ctrl (FS_DEV          *p_dev,
                                  FS_IO_CTRL_CMD   cmd,
                                  Void            *p_buf,
                                  FS_ERR          *p_err);

File

Called from

Code enabled by

fs_dev_####.c

various

N/A

The device driver IO_Ctrl() function performs an I/O control operation.

Arguments

p_dev

Pointer to device to query.

p_buf

Buffer which holds data to be used for operations

OR

Buffer in which data will be stored as a result of operation.

p_err

Pointer to variable that will receive the return error code from this function

FS_ERR_NONE

Control operation performed successfully.

FS_ERR_DEV_INVALID_IO_CTRL

I/O control operation unknown to driver.

FS_ERR_DEV_INVALID_UNIT_NBR

Device unit number is invalid.

FS_ERR_DEV_IO

Device I/O error.

FS_ERR_DEV_NOT_OPEN

Device is not open.

FS_ERR_DEV_NOT_PRESENT

Device is not present.

FS_ERR_DEV_TIMEOUT

Device timeout.

Returned Value

None.

Notes/Warnings

  1. Tracking whether a device is open is not necessary, because this should ONLY be called when a device is open.
  2. Defined I/O control operations are

    FS_DEV_IO_CTRL_REFRESHRefresh device.
    FS_DEV_IO_CTRL_LOW_FMTLow-level format device.
    FS_DEV_IO_CTRL_LOW_MOUNTLow-level mount device.
    FS_DEV_IO_CTRL_LOW_UNMOUNTLow-level unmount device.
    FS_DEV_IO_CTRL_LOW_COMPACTLow-level compact device.
    FS_DEV_IO_CTRL_LOW_DEFRAHLow-level defragment device.
    FS_DEV_IO_CTRL_SEC_RELEASERelease data in sector
    FS_DEV_IO_CTRL_PHY_RDRead physical device
    FS_DEV_IO_CTRL_PHY_WRWrite physical device
    FS_DEV_IO_CTRL_PHY_RD_PAGERead physical device page
    FS_DEV_IO_CTRL_PHY_WR_PAGEWrite physical device page
    FS_DEV_IO_CTRL_PHY_ERASE_BLKErase physical device block
    FS_DEV_IO_CTRL_PHY_ERASE_CHIPErase physical device

The device driver IO_Ctrl() function is called while the caller holds the device lock.