![]() |
LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
|
Data Structures | |
struct | USB_Descriptor_Configuration_t |
USB Device descriptor structure for Mass Storage Device Type define for the device configuration descriptor structure. This must be defined in the application code, as the configuration descriptor contains several sub-descriptors which vary between devices, and which describe the device's usage to the host. More... | |
Macros | |
#define | MASS_STORAGE_IN_EPNUM 3 |
#define | MASS_STORAGE_OUT_EPNUM 2 |
#define | MASS_STORAGE_IO_EPSIZE 64 |
#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 | SCSI_SET_SENSE(Key, Acode, Aqual) |
Set sense macro. | |
#define | DATA_READ true |
#define | DATA_WRITE false |
#define | DEVICE_TYPE_BLOCK 0x00 |
#define | DEVICE_TYPE_CDROM 0x05 |
#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 | |
uint16_t | CALLBACK_USB_GetDescriptor (const uint16_t wValue, const uint8_t wIndex, const void **const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) |
USB Get descriptor callback function. | |
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. | |
bool | SCSI_DecodeSCSICommand (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo) |
SCSI Command processing function. | |
void | SetupHardware (void) |
Hardware setup event callback 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. | |
The Mass storage device descriptors module implements the descriptors required by the USB mass storage device configuration. This module is used by the Mass Storage device example module.
The USB Mass Storage data RAM module module implements the functions which handles the storage & retrieval of data in RAM.
The USB Mass Storage device SCSI command processing module handles the SCSI commands
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.
#define DATA_READ true |
Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium.
#define DATA_WRITE false |
Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium.
#define DEVICE_TYPE_BLOCK 0x00 |
#define DEVICE_TYPE_CDROM 0x05 |
#define DISK_READ_ONLY false |
Indicates if the disk is write protected or not.
Definition at line 77 of file MassStorage.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 68 of file MassStorage.h.
LED mask for the library LED driver, to indicate that the USB interface is enumerating.
Definition at line 59 of file MassStorage.h.
LED mask for the library LED driver, to indicate that an error has occurred in the USB interface.
Definition at line 65 of file MassStorage.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 56 of file MassStorage.h.
LED mask for the library LED driver, to indicate that the USB interface is ready.
Definition at line 62 of file MassStorage.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 74 of file MassStorage.h.
#define MASS_STORAGE_IN_EPNUM 3 |
Endpoint number of the Mass Storage device-to-host data IN endpoint.
Definition at line 54 of file Descriptors.h.
#define MASS_STORAGE_IO_EPSIZE 64 |
Definition at line 63 of file Descriptors.h.
#define MASS_STORAGE_OUT_EPNUM 2 |
Endpoint number of the Mass Storage host-to-device data OUT endpoint.
Definition at line 57 of file Descriptors.h.
#define SCSI_SET_SENSE | ( | Key, | |
Acode, | |||
Aqual | |||
) |
Set sense macro.
Key | : New SCSI sense key to set the sense code to |
Acode | : New SCSI additional sense key to set the additional sense code to |
Aqual | : New SCSI additional sense key qualifier to set the additional sense qualifier code to |
#define TOTAL_LUNS 1 |
Total number of logical drives within the device - must be non-zero.
Definition at line 71 of file MassStorage.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 the reception of SCSI commands from the host, which must be processed.
Definition at line 106 of file MassStorage.c.
uint16_t CALLBACK_USB_GetDescriptor | ( | const uint16_t | wValue, |
const uint8_t | wIndex, | ||
const void **const | DescriptorAddress | ||
) |
USB Get descriptor callback function.
wValue | : Descriptor type |
wIndex | : Index of the descriptor |
DescriptorAddress | : Address of the requested descriptor |
This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" documentation) by the application code so that the address and size of a requested descriptor can be given to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the USB host.
Definition at line 206 of file Descriptors.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 |
Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board Dataflash IC(s), into the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash and writes them in OS sized blocks to the endpoint.
[in] | MSInterfaceInfo | Pointer to a structure containing a Mass Storage Class configuration and state |
[in] | BlockAddress | Data block starting address for the read sequence |
[in] | 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 |
Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board Dataflash IC(s), from the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes them to the Dataflash in Dataflash page sized blocks.
[in] | MSInterfaceInfo | Pointer to a structure containing a Mass Storage Class configuration and state |
[in] | BlockAddress | Data block starting address for the write sequence |
[in] | 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.
Definition at line 92 of file MassStorage.c.
void EVENT_USB_Device_Connect | ( | void | ) |
USB Device connect event callback.
Event handler for the library USB Connection event.
Definition at line 84 of file MassStorage.c.
void EVENT_USB_Device_ControlRequest | ( | void | ) |
USB Device control request receive event callback.
Event handler for the library USB Control Request reception event.
Definition at line 100 of file MassStorage.c.
void EVENT_USB_Device_Disconnect | ( | void | ) |
USB Device disconnect event callback.
Event handler for the library USB Disconnection event.
Definition at line 88 of file MassStorage.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 |
bool SCSI_DecodeSCSICommand | ( | USB_ClassInfo_MS_Device_t *const | MSInterfaceInfo | ) |
SCSI Command processing function.
MSInterfaceInfo | : Pointer to the Mass Storage class interface structure that the command is associated with. |
Under development, not working yet. Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns a command failure due to a ILLEGAL REQUEST.
void SetupHardware | ( | void | ) |
Hardware setup event callback function.
Configures the board hardware and chip peripherals for the demo's functionality.
Under development, not working yet.
Definition at line 97 of file AudioInput.c.