![]() |
LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
|
The USB Mass Storage data RAM module module implements the functions which handles the storage & retrieval of data in RAM.
The Mass Storage Device dual core example demonstrates the Mass Storage Device example using LPCUSBlib library. The LPC43XX will be enumerated as as Mass Storage Device when connected to the Host PC. The example can be configured to run on M4/M0 core.
Macros | |
| #define | VIRTUAL_MEMORY_BYTES DATA_RAM_VIRTUAL_SIZE |
| #define | VIRTUAL_MEMORY_BLOCK_SIZE 512 |
| #define | VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) |
| #define | LEDMASK_USB_NOTREADY LEDS_LED1 |
| #define | LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) |
| #define | LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) |
| #define | LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) |
| #define | LEDMASK_USB_BUSY LEDS_LED2 |
| #define | TOTAL_LUNS 1 |
| #define | LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) |
| #define | DISK_READ_ONLY false |
Functions | |
| void | DataRam_WriteBlocks (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks) |
| DataRAM write blocks function. | |
| void | DataRam_ReadBlocks (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks) |
| DataRAM read blocks function. | |
| void | DataRam_Initialize (void) |
| DataRAM Initilisation function. | |
| uint32_t | MassStorage_GetAddressInImage (uint32_t startblock, uint16_t requestblocks, uint16_t *availableblocks) |
| DataRAM read blocks function. | |
| void | EVENT_USB_Device_Connect (void) |
| USB Device connect event callback. | |
| void | EVENT_USB_Device_Disconnect (void) |
| USB Device disconnect event callback. | |
| void | EVENT_USB_Device_ConfigurationChanged (void) |
| USB Device configuration change event callback. | |
| void | EVENT_USB_Device_ControlRequest (void) |
| USB Device control request receive event callback. | |
| bool | CALLBACK_MS_Device_SCSICommandReceived (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo) |
| Mass Storage class driver callback function. | |
| #define DISK_READ_ONLY false |
Indicates if the disk is write protected or not.
Definition at line 98 of file usbmsdev.h.
| #define LEDMASK_USB_BUSY LEDS_LED2 |
LED mask for the library LED driver, to indicate that the USB interface is busy.
Definition at line 89 of file usbmsdev.h.
LED mask for the library LED driver, to indicate that the USB interface is enumerating.
Definition at line 80 of file usbmsdev.h.
LED mask for the library LED driver, to indicate that an error has occurred in the USB interface.
Definition at line 86 of file usbmsdev.h.
| #define LEDMASK_USB_NOTREADY LEDS_LED1 |
LED mask for the library LED driver, to indicate that the USB interface is not ready.
Definition at line 77 of file usbmsdev.h.
LED mask for the library LED driver, to indicate that the USB interface is ready.
Definition at line 83 of file usbmsdev.h.
| #define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) |
Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device.
Definition at line 95 of file usbmsdev.h.
| #define TOTAL_LUNS 1 |
Total number of logical drives within the device - must be non-zero.
Definition at line 92 of file usbmsdev.h.
| #define VIRTUAL_MEMORY_BLOCK_SIZE 512 |
| #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) |
| #define VIRTUAL_MEMORY_BYTES DATA_RAM_VIRTUAL_SIZE |
| bool CALLBACK_MS_Device_SCSICommandReceived | ( | USB_ClassInfo_MS_Device_t *const | MSInterfaceInfo | ) |
Mass Storage class driver callback function.
| MSInterfaceInfo | : Pointer to the Mass Storage class interface configuration structure |
Mass Storage class driver callback function.
Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
Mass Storage class driver callback function.
| MSInterfaceInfo | : Pointer to a structure containing a Mass Storage Class configuration and state. |
true if the SCSI command was successfully processed, false otherwise.Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
Mass Storage class driver callback for the user processing of a received SCSI command. This callback will fire each time the host sends a SCSI command which requires processing by the user application. Inside this callback the user is responsible for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure inside the Mass Storage class state structure passed as a parameter to the callback function.
Definition at line 332 of file usbmsdev.c.
| void DataRam_Initialize | ( | void | ) |
| void DataRam_ReadBlocks | ( | USB_ClassInfo_MS_Device_t *const | MSInterfaceInfo, |
| const uint32_t | BlockAddress, | ||
| uint16_t | TotalBlocks | ||
| ) |
DataRAM read blocks function.
| MSInterfaceInfo | : Pointer to a structure containing a Mass Storage Class configuration and state |
| BlockAddress | : Data block starting address for the read sequence |
| TotalBlocks | : Number of blocks of data to read |
DataRAM read blocks function.
| MSInterfaceInfo | : Pointer to a structure containing a Mass Storage Class configuration and state |
| BlockAddress | : Data block starting address for the read sequence |
| TotalBlocks | : Number of blocks of data to read |
| void DataRam_WriteBlocks | ( | USB_ClassInfo_MS_Device_t *const | MSInterfaceInfo, |
| const uint32_t | BlockAddress, | ||
| uint16_t | TotalBlocks | ||
| ) |
DataRAM write blocks function.
| MSInterfaceInfo | : Pointer to a structure containing a Mass Storage Class configuration and state |
| BlockAddress | : Data block starting address for the write sequence |
| TotalBlocks | : Number of blocks of data to write |
DataRAM write blocks function.
| MSInterfaceInfo | : Pointer to a structure containing a Mass Storage Class configuration and state |
| BlockAddress | : Data block starting address for the write sequence |
| TotalBlocks | : Number of blocks of data to write |
| void EVENT_USB_Device_ConfigurationChanged | ( | void | ) |
USB Device configuration change event callback.
Event handler for the library USB Configuration Changed event.
Event for USB configuration number changed. This event fires when a the USB host changes the selected configuration number while in device mode. This event should be hooked in device applications to create the endpoints and configure the device for the selected configuration.
This event is time-critical; exceeding OS-specific delays within this event handler (typically of around one second) will prevent the device from enumerating correctly.
This event fires after the value of USB_Device_ConfigurationNumber has been changed.
USB_HOST_ONLY token is supplied to the compiler (see USB Interface Management documentation).Event handler for the library USB Configuration Changed event.
USB Device configuration change event callback.
Definition at line 317 of file usbmsdev.c.
| void EVENT_USB_Device_Connect | ( | void | ) |
USB Device connect event callback.
Event handler for the library USB Connection event.
Event for USB device connection. This event fires when the microcontroller is in USB Device mode and the device is connected to a USB host, beginning the enumeration process measured by a rising level on the microcontroller's VBUS sense pin.
This event is time-critical; exceeding OS-specific delays within this event handler (typically of around two seconds) will prevent the device from enumerating correctly.
NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection and disconnection events may be manually fired, and the USB_DeviceState global changed manually. NO_LIMITED_CONTROLLER_CONNECT is not defined.Event handler for the library USB Connection event.
USB Device connect event callback.
Definition at line 309 of file usbmsdev.c.
| void EVENT_USB_Device_ControlRequest | ( | void | ) |
USB Device control request receive event callback.
Event handler for the library USB Control Request reception event.
Event for control requests. This event fires when a the USB host issues a control request to the mandatory device control endpoint (of address 0). This may either be a standard request that the library may have a handler code for internally, or a class specific request issued to the device which must be handled appropriately. If a request is not processed in the user application via this event, it will be passed to the library for processing internally if a suitable handler exists.
This event is time-critical; each packet within the request transaction must be acknowledged or sent within 50ms or the host will abort the transfer.
The library internally handles all standard control requests with the exceptions of SYNC FRAME, SET DESCRIPTOR and SET INTERFACE. These and all other non-standard control requests will be left for the user to process via this event if desired. If not handled in the user application or by the library internally, unknown requests are automatically STALLed.
USB_HOST_ONLY token is supplied to the compiler (see USB Interface Management documentation). Event handler for the library USB Control Request reception event.
USB Device control request receive event callback.
Definition at line 325 of file usbmsdev.c.
| void EVENT_USB_Device_Disconnect | ( | void | ) |
USB Device disconnect event callback.
Event handler for the library USB Disconnection event.
Event for USB device disconnection. This event fires when the microcontroller is in USB Device mode and the device is disconnected from a host, measured by a falling level on the microcontroller's VBUS sense pin.
NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection and disconnection events may be manually fired, and the USB_DeviceState global changed manually. NO_LIMITED_CONTROLLER_CONNECT is not defined.Event handler for the library USB Disconnection event.
USB Device disconnect event callback.
Definition at line 313 of file usbmsdev.c.
| uint32_t MassStorage_GetAddressInImage | ( | uint32_t | startblock, |
| uint16_t | requestblocks, | ||
| uint16_t * | availableblocks | ||
| ) |
DataRAM read blocks function.
| startblock | : Starting block number |
| requestblocks | : Number of requested blocks |
| availableblocks | : Pointer to number of available |