Rd() - Device Driver

static  void  FSDev_####_Rd (FS_DEV      *p_dev,
                             void        *p_dest,
                             FS_SEC_NBR   start,
                             FS_SEC_QTY   cnt,
                             FS_ERR      *p_err);

File

Called from

Code enabled by

fs_dev_####.c

FSDev_RdLocked()

N/A

The device driver Rd() function should read from a device and store data in a buffer. If an error is returned, the file system suite assumes that no data is read; if not all data can be read, an error must be returned.

Arguments

p_dev

Pointer to device to read from.

p_dest

Pointer to destination buffer.

start

Start sector of read.

cnt

Number of sectors to read

p_err

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

FS_ERR_NONE

Sector(s) read.

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. The device driver Rd() function is called while the caller holds the device lock.