USBLibAPIGuide
1.00.00.01
|
Data Structures | |
struct | tMSCDMedia |
Media Access functions. More... | |
struct | tMSCInstance |
struct | tUSBDMSCDevice |
Enumerations | |
enum | tUSBDMSCMediaStatus { eUSBDMSCMediaPresent, eUSBDMSCMediaNotPresent, eUSBDMSCMediaStopped, eUSBDMSCMediaUnknown } |
Functions | |
uint32_t | USBDSCSICommand (tUSBDMSCDevice *psMSCDevice, tMSCCBW *psSCSICBW) |
void | USBDMSCMediaChange (void *pvMSCDevice, tUSBDMSCMediaStatus iMediaStatus) |
void * | USBDMSCInit (uint32_t ui32Index, tUSBDMSCDevice *psMSCDevice) |
void * | USBDMSCCompositeInit (uint32_t ui32Index, tUSBDMSCDevice *psMSCDevice, tCompositeEntry *psCompEntry) |
void | USBDMSCTerm (void *pvMSCDevice) |
Variables | |
const uint8_t | g_pui8MSCInterface [MSCINTERFACE_SIZE] |
const tConfigSection | g_sMSCConfigSection |
const tConfigSection | g_sMSCInterfaceSection |
const tConfigSection * | g_psMSCSections [] |
const tConfigHeader | g_sMSCConfigHeader |
const tConfigHeader *const | g_ppsMSCConfigDescriptors [] |
const tCustomHandlers | g_sMSCHandlers |
#define USBD_FLAG_DMA_IN 0x00000001 |
#define USBD_FLAG_DMA_OUT 0x00000002 |
#define USBD_FLAG_ALLOW_REMOVAL 0x00000004 |
#define USB_RX_ERROR_FLAGS |
#define USB_MSC_SUBCLASS_SCSI 0x6 |
#define USB_MSC_PROTO_BULKONLY 0x50 |
#define DATA_IN_ENDPOINT USB_EP_1 |
#define DATA_OUT_ENDPOINT USB_EP_1 |
#define DATA_IN_EP_MAX_SIZE 64 |
#define DATA_OUT_EP_MAX_SIZE 64 |
#define COMMAND_BUFFER_SIZE 64 |
#define STATE_SCSI_IDLE 0x00 |
#define STATE_SCSI_SEND_BLOCKS 0x01 |
#define STATE_SCSI_RECEIVE_BLOCKS 0x02 |
#define STATE_SCSI_SEND_STATUS 0x03 |
#define STATE_SCSI_SENT_STATUS 0x04 |
#define NUM_MSC_SECTIONS |
#define DEVICE_BLOCK_SIZE 512 |
#define MSCINTERFACE_SIZE (23) |
#define COMPOSITE_DMSC_SIZE (MSCINTERFACE_SIZE) |
The size of the memory that should be allocated to create a configuration descriptor for a single instance of the USB Audio Device. This does not include the configuration descriptor which is automatically ignored by the composite device class.
#define USBD_MSC_EVENT_IDLE (USBD_MSC_EVENT_BASE + 0) |
This event indicates that the host has completed other operations and is no longer accessing the device.
#define USBD_MSC_EVENT_READING (USBD_MSC_EVENT_BASE + 1) |
This event indicates that the host is reading the storage media.
#define USBD_MSC_EVENT_WRITING (USBD_MSC_EVENT_BASE + 2) |
This event indicates that the host is writing to the storage media.
enum tUSBDMSCMediaStatus |
uint32_t USBDSCSICommand | ( | tUSBDMSCDevice * | psMSCDevice, |
tMSCCBW * | psSCSICBW | ||
) |
References SCSI_INQUIRY_CMD, and tUSBDMSCDevice::sPrivateData.
void USBDMSCMediaChange | ( | void * | pvMSCDevice, |
tUSBDMSCMediaStatus | iMediaStatus | ||
) |
This function is used by an application if it can detect insertion or removal of the media.
pvMSCDevice | is the mass storage device instance that had a media change. |
iMediaStatus | is the updated status for the media. |
This function should be called by an application when it detects a change in the status of the media in use by the USB mass storage class. The iMediaStatus parameter will indicate the new status of the media and can also indicate that the application has no knowledge of the media state.
There are currently the three following values for the iMediaStatus parameter:
It will be left up to the application to call this function whenever it detects a change or simply call it once with eUSBDMSCMediaUnknown and allow the mass storage class to infer the state from the remaining device APIs.
References tMSCInstance::iMediaStatus, and tUSBDMSCDevice::sPrivateData.
void * USBDMSCInit | ( | uint32_t | ui32Index, |
tUSBDMSCDevice * | psMSCDevice | ||
) |
This function should be called once for the mass storage class device to initialized basic operation and prepare for enumeration.
ui32Index | is the index of the USB controller to initialize for mass storage class device operation. |
psMSCDevice | points to a structure containing parameters customizing the operation of the mass storage device. |
In order for an application to initialize the USB device mass storage class, it must first call this function with the a valid mass storage device class structure in the psMSCDevice parameter. This allows this function to initialize the USB controller and device code to be prepared to enumerate and function as a USB mass storage device.
This function returns a void pointer that must be passed in to all other APIs used by the mass storage class.
See the documentation on the tUSBDMSCDevice structure for more information on how to properly fill the structure members.
References tUSBDMSCDevice::ppui8StringDescriptors, and USBDMSCCompositeInit().
void * USBDMSCCompositeInit | ( | uint32_t | ui32Index, |
tUSBDMSCDevice * | psMSCDevice, | ||
tCompositeEntry * | psCompEntry | ||
) |
This function should be called once for the mass storage class device to initialized basic operation and prepare for enumeration.
ui32Index | is the index of the USB controller to initialize for mass storage class device operation. |
psMSCDevice | points to a structure containing parameters customizing the operation of the mass storage device. |
psCompEntry | is the composite device entry to initialize when creating a composite device. |
In order for an application to initialize the USB device mass storage class, it must first call this function with the a valid mass storage device class structure in the psMSCDevice parameter. This allows this function to initialize the USB controller and device code to be prepared to enumerate and function as a USB mass storage device. If this mass storage device is part of a composite device, then the psCompEntry should point to the composite device entry to initialize. This is part of the array that is passed to the USBDCompositeInit() function.
This function returns a void pointer that must be passed in to all other APIs used by the mass storage class.
See the documentation on the tUSBDMSCDevice structure for more information on how to properly fill the structure members.
References tMSCInstance::bConnected, eUSBDMSCMediaUnknown, g_sMSCHandlers, tMSCInstance::iMediaStatus, tUSBDMSCDevice::ppui8StringDescriptors, tDeviceInfo::psCallbacks, tCompositeEntry::psDevInfo, tDeviceInfo::pui8DeviceDescriptor, tCompositeEntry::pvInstance, tMSCInstance::sDevInfo, tUSBDMSCDevice::sPrivateData, and tMSCInstance::ui32USBBase.
Referenced by USBDMSCInit().
void USBDMSCTerm | ( | void * | pvMSCDevice | ) |
Shuts down the mass storage device.
pvMSCDevice | is the pointer to the device instance structure as returned by USBDMSCInit() or USBDMSCCompositeInit(). |
This function terminates mass storage operation for the instance supplied and removes the device from the USB bus. Following this call, the pvMSCDevice instance may not me used in any other call to the mass storage device other than USBDMSCInit() or USBDMSCCompositeInit().
References tMSCDMedia::pfnClose, tMSCInstance::pvMedia, tUSBDMSCDevice::sMediaFunctions, tUSBDMSCDevice::sPrivateData, and USBDCDTerm().
const uint8_t g_pui8MSCInterface[MSCINTERFACE_SIZE] |
const tConfigSection g_sMSCConfigSection |
const tConfigSection g_sMSCInterfaceSection |
const tConfigSection* g_psMSCSections[] |
const tConfigHeader g_sMSCConfigHeader |
const tConfigHeader* const g_ppsMSCConfigDescriptors[] |
const tCustomHandlers g_sMSCHandlers |
Referenced by USBDMSCCompositeInit().