Data Fields
tMSCDMedia Struct Reference

This structure contains the media access functions to be used by the MSC class driver. More...

#include <usbdmsc.h>

Data Fields

void *(* Open )(uint32_t ulDrive)
 
void(* Close )(void *pvDrive)
 
uint32_t(* BlockRead )(void *pvDrive, uint8_t *pucData, uint32_t ulSector, uint32_t ulNumBlocks)
 
uint32_t(* BlockWrite )(void *pvDrive, uint8_t *pucData, uint32_t ulSector, uint32_t ulNumBlocks)
 
uint32_t(* NumBlocks )(void *pvDrive)
 

Detailed Description

This structure contains the media access functions to be used by the MSC class driver.

Field Documentation

uint32_t(* tMSCDMedia::BlockRead) (void *pvDrive, uint8_t *pucData, uint32_t ulSector, uint32_t ulNumBlocks)

This function will read a block from a device opened by the USBDMSCStorageOpen() call.

Parameters
pvDriveis the pointer that was returned from a call to USBDMSCStorageOpen().
pucDatais the buffer that data will be written into.
ulSectoris the block address to read.
ulNumBlocksis the number of blocks to read.

This function is use to read blocks from a physical device and return them in the /e pucData buffer. The data area pointed to by /e pucData should be at least /e ulNumBlocks * Block Size bytes to prevent overwriting data.

Return values
Returnsthe number of bytes that were read from the device.
uint32_t(* tMSCDMedia::BlockWrite) (void *pvDrive, uint8_t *pucData, uint32_t ulSector, uint32_t ulNumBlocks)

This function will write a block to a device opened by the USBDMSCStorageOpen() call.

Parameters
pvDriveis the pointer that was returned from a call to USBDMSCStorageOpen().
pucDatais the buffer that data will be used for writing.
ulNumBlocksis the number of blocks to write.

This function is use to write blocks to a physical device from the buffer pointed to by the /e pucData buffer. If the number of blocks is greater than one then the block address will increment and write to the next block until /e ulNumBlocks * Block Size bytes have been written.

Return values
Returnsthe number of bytes that were written to the device.
void(* tMSCDMedia::Close) (void *pvDrive)

This function close the drive number in use by the mass storage class device.

Parameters
pvDriveis the pointer that was returned from a call to USBDMSCStorageOpen().

This function is used to close the physical drive number associated with the parameter /e pvDrive. This function will return 0 if the drive was closed successfully and any other value will indicate a failure.

Return values
Returns0 if the drive was successfully closed or non-zero for a failure.
uint32_t(* tMSCDMedia::NumBlocks) (void *pvDrive)

This function will return the number of blocks present on a device.

Parameters
pvDriveis the pointer that was returned from a call to USBDMSCStorageOpen().

This function is used to return the total number of blocks on a physical device based on the /e pvDrive parameter.

/retval Returns the number of blocks that are present in a device.

void*(* tMSCDMedia::Open) (uint32_t ulDrive)

This function is used to initialize and open the physical drive number associated with the parameter ulDrive. The function will return zero if the drive could not be opened for some reason. In the case of removable device like an SD card this function should return zero if the SD card is not present. The function returns a pointer to data that should be passed to other APIs or it will return 0 if no drive was found.


The documentation for this struct was generated from the following file:

Copyright 2016, Texas Instruments Incorporated