This function reads len sectors of data
from the disk at the sector number given by
block_num. The actual quantity of data
transferred depends on the disk's sector size, which can be
obtained using the
CYG_IO_GET_CONFIG_DISK_INFO key.
If the read completes immediately, or the low level driver is
configured to do all IO synchronously, this function will return
ENOERR, and if it fails will return a
negative error code, for example -EIO. If the
function returns -EWOULDBLOCK then it has only
started the transfer and will indicate its completion by calling
the transfer_done callback.
This function writes len sectors of data
to the disk at the block given by
block_num. The actual quantity of data
transferred depends on the disk's sector size, which can be
obtained using the
CYG_IO_GET_CONFIG_DISK_INFO key.
If the write completes immediately, or the low level driver is
configured to do all IO synchronously, this function will return
ENOERR, and if it fails will return a
negative error code, for example -EIO. If the
function returns -EWOULDBLOCK then it has only
started the transfer and will indicate its completion by calling
the transfer_done callback.
This function is used to get configuration data from the
device. The key argument defines the
configuration data to be fetched. The
xbuf and *len
arguments describe a buffer into which the data will be
put. The function should return true if the
key type is supported and the buffer of sufficient length to
contain the data. The value of *len
should be updated to actual length of the data returned. The
function should return false if the driver
cannot support the key value or the buffer is of insufficient
length.
The following keys may be used to get information from a disk
device.
CYG_IO_GET_CONFIG_DISK_INFO
This key causes a cyg_disk_info_t
structure, as defined in diskio.h to
be returned.
CYG_IO_GET_CONFIG_DISK_EVENT
This key returns a copy of the
cyg_disk_event_t previously set
by CYG_IO_SET_CONFIG_DISK_EVENT.
This function is used to change the configuration of the
device. The key argument defines the
kind of configuration data to be set. The
xbuf and *len
arguments describe a buffer in which the data is supplied.
The function should return true if the key
type is supported and the buffer of the correct length and the
data appears valid. The function should return
false if the driver cannot support the key
value or the buffer is the wrong length, or the data is
invalid in some other way.
The following keys can be sent to a driver:
CYG_IO_SET_CONFIG_DISK_MOUNT
This is invoked from the filesystem after locating the
device driver to record that the device has been
mounted. The generic device layer records the mount
against both the partition and physical disk and passes
the call on down to the driver. The
xbuf and
*len arguments are unused.
CYG_IO_SET_CONFIG_DISK_UMOUNT
This is invoked from the filesystem to record that the
device has been unmounted. The generic device layer
records the unmount against both the partition and
physical disk and passes the call on down to the
driver. If the chan->info->mounts
counter is zero, the driver should call the
disk_disconnected() callback to
prepare the generic layer for a potential media
change. The xbuf and
*len arguments are unused.
CYG_IO_SET_CONFIG_DISK_EVENT
This may be invoked by the application to set a disk event
callback function. The generic disk layer is mostly
responsible for handling this by recording the event
function in the disk channel structure. The call is
additionally passed down to the hardware driver so that it
may prepare the hardware, if necessary. The
xbuf should point to a
cyg_disk_event_t structure.