USBLib API Guide
1.00.00.01
|
Media Access functions. More...
#include <usbdmsc.h>
Data Fields | |
void *(* | pfnOpen )(uint32_t ui32Drive) |
void(* | pfnClose )(void *pvDrive) |
uint32_t(* | pfnBlockRead )(void *pvDrive, uint8_t *pui8Data, uint32_t ui32Sector, uint32_t ui32NumBlocks) |
uint32_t(* | pfnBlockWrite )(void *pvDrive, uint8_t *pui8Data, uint32_t ui32Sector, uint32_t ui32NumBlocks) |
uint32_t(* | pfnNumBlocks )(void *pvDrive) |
uint32_t(* | pfnBlockSize )(void *pvDrive) |
Media Access functions.
void*(* tMSCDMedia::pfnOpen) (uint32_t ui32Drive) |
This function is used to initialize and open the physical drive number associated with the parameter ui32Drive. The function returns zero if the drive could not be opened for some reason. In the case of removable device like an SD card this function must return zero if the SD card is not present. The function returns a pointer to data that should be passed to other APIs or returns 0 if no drive was found.
void(* tMSCDMedia::pfnClose) (void *pvDrive) |
This function closes the drive number in use by the mass storage class device. The pvDrive is the pointer that was returned from a call to pfnOpen. This function is used to close the physical drive number associated with the parameter pvDrive. This function returns 0 if the drive was closed successfully and any other value indicates a failure.
Referenced by USBDMSCTerm().
uint32_t(* tMSCDMedia::pfnBlockRead) (void *pvDrive, uint8_t *pui8Data, uint32_t ui32Sector, uint32_t ui32NumBlocks) |
This function reads a block of data from a device opened by the pfnOpen call. The pvDrive parameter is the pointer that was returned from the original call to pfnOpen. The pui8Data parameter is the buffer that data will be written into. The data area pointed to by pui8Data must be at least ui32NumBlocks * Block Size bytes to prevent overwriting data. The ui32Sector is the block address to read and ui32NumBlocks is the number of blocks to read. This function returns the number of bytes that were read from the and placed into the pui8Data buffer..
uint32_t(* tMSCDMedia::pfnBlockWrite) (void *pvDrive, uint8_t *pui8Data, uint32_t ui32Sector, uint32_t ui32NumBlocks) |
This function is use to write blocks to a physical device from the buffer pointed to by the pui8Data buffer. The pvDrive parameter is the pointer that was returned from the original call to pfnOpen. The pui8Data is the pointer to the data to write to the storage device and ui32NumBlocks is the number of blocks to write. The ui32Sector parameter is the sector number used to write the block. If the number of blocks is greater than one then the block address increments and writes to the next block until ui32NumBlocks * Block Size bytes are written. This function returns the number of bytes that were written to the device.
uint32_t(* tMSCDMedia::pfnNumBlocks) (void *pvDrive) |
This function returns the total number of blocks on a physical device based on the pvDrive parameter. The pvDrive parameter is the pointer that was returned from the original call to pfnOpen.
uint32_t(* tMSCDMedia::pfnBlockSize) (void *pvDrive) |
This function returns the block size for a physical device based on the pvDrive parameter. The pvDrive parameter is the pointer that was returned from the original call to pfnOpen.