USBD ROM Stack
2.0
ROM based USB device stack
|
Mass Storage class function driver initialization parameter data structure. More...
Data Fields | |
uint32_t | mem_base |
uint32_t | mem_size |
uint8_t * | InquiryStr |
uint32_t | BlockCount |
uint32_t | BlockSize |
uint32_t | MemorySize |
uint8_t * | intf_desc |
void(* | MSC_Write )(uint32_t offset, uint8_t **src, uint32_t length, uint32_t high_offset) |
void(* | MSC_Read )(uint32_t offset, uint8_t **dst, uint32_t length, uint32_t high_offset) |
ErrorCode_t(* | MSC_Verify )(uint32_t offset, uint8_t buf[], uint32_t length, uint32_t high_offset) |
void(* | MSC_GetWriteBuf )(uint32_t offset, uint8_t **buff_adr, uint32_t length, uint32_t high_offset) |
ErrorCode_t(* | MSC_Ep0_Hdlr )(USBD_HANDLE_T hUsb, void *data, uint32_t event) |
uint64_t | MemorySize64 |
Mass Storage class function driver initialization parameter data structure.
This data structure is used to pass initialization parameters to the Mass Storage class function driver's init function.
uint32_t USBD_MSC_INIT_PARAM_T::mem_base |
Base memory location from where the stack can allocate data and buffers.
uint32_t USBD_MSC_INIT_PARAM_T::mem_size |
The size of memory buffer which stack can use.
uint8_t* USBD_MSC_INIT_PARAM_T::InquiryStr |
Pointer to the 28 character string. This string is sent in response to the SCSI Inquiry command.
uint32_t USBD_MSC_INIT_PARAM_T::BlockCount |
Number of blocks present in the mass storage device
uint32_t USBD_MSC_INIT_PARAM_T::BlockSize |
Block size in number of bytes
uint32_t USBD_MSC_INIT_PARAM_T::MemorySize |
Memory size in number of bytes
uint8_t* USBD_MSC_INIT_PARAM_T::intf_desc |
Pointer to the interface descriptor within the descriptor array (high_speed_desc) passed to Init() through USB_CORE_DESCS_T structure. The stack assumes both HS and FS use same BULK endpoints.
void(* USBD_MSC_INIT_PARAM_T::MSC_Write) (uint32_t offset, uint8_t **src, uint32_t length, uint32_t high_offset) |
MSC Write callback function.
This function is provided by the application software. This function gets called when host sends a write command.
[in] | Lower | 32 bit offset of Destination start address. |
[in,out] | src | Pointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers. See Zero-Copy Data Transfer model for more details on zero-copy concept. |
[in] | length | Number of bytes to be written. |
[in] | Higher | 32 bit offset of start address. |
void(* USBD_MSC_INIT_PARAM_T::MSC_Read) (uint32_t offset, uint8_t **dst, uint32_t length, uint32_t high_offset) |
MSC Read callback function.
This function is provided by the application software. This function gets called when host sends a read command.
[in] | Lower | 32 bit offset of Source start address. |
[in,out] | dst | Pointer to a pointer to the source of data. The MSC function drivers implemented in stack are written with zero-copy model. Meaning the stack doesn't make an extra copy of buffer before writing/reading data from USB hardware FIFO. Hence the parameter is pointer to a pointer containing address buffer (uint8_t** dst). So that the user application can update the buffer pointer instead of copying data to address pointed by the parameter. /note The updated buffer address should be accessible by USB DMA master. If user doesn't want to use zero-copy model, then the user should copy data to the address pointed by the passed buffer pointer parameter and shouldn't change the address value. See Zero-Copy Data Transfer model for more details on zero-copy concept. |
[in] | length | Number of bytes to be read. |
[in] | Higher | 32 bit offset of start address. |
ErrorCode_t(* USBD_MSC_INIT_PARAM_T::MSC_Verify) (uint32_t offset, uint8_t buf[], uint32_t length, uint32_t high_offset) |
MSC Verify callback function.
This function is provided by the application software. This function gets called when host sends a verify command. The callback function should compare the buffer with the destination memory at the requested offset and
[in] | Lower | 32 bit offset of Destination start address. |
[in] | buf | Buffer containing the data sent by the host. |
[in] | length | Number of bytes to verify. |
[in] | Higher | 32 bit offset of start address. |
LPC_OK | If data in the buffer matches the data at destination |
ERR_FAILED | At least one byte is different. |
void(* USBD_MSC_INIT_PARAM_T::MSC_GetWriteBuf) (uint32_t offset, uint8_t **buff_adr, uint32_t length, uint32_t high_offset) |
Optional callback function to optimize MSC_Write buffer transfer.
This function is provided by the application software. This function gets called when host sends SCSI_WRITE10/SCSI_WRITE12 command. The callback function should update the buff_adr pointer so that the stack transfers the data directly to the target buffer. /note The updated buffer address should be accessible by USB DMA master. If user doesn't want to use zero-copy model, then the user should not update the buffer pointer. See Zero-Copy Data Transfer model for more details on zero-copy concept.
[in] | Lower | 32 bit offset of Destination start address. |
[in,out] | buf | Buffer containing the data sent by the host. |
[in] | length | Number of bytes to write. |
[in] | Higher | 32 bit offset of start address. |
ErrorCode_t(* USBD_MSC_INIT_PARAM_T::MSC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void *data, uint32_t event) |
Optional user override-able function to replace the default MSC class handler.
The application software could override the default EP0 class handler with their own by providing the handler function address as this data member of the parameter structure. Application which like the default handler should set this data member to zero before calling the USBD_MSC_API::Init().
[in] | hUsb | Handle to the USB device stack. |
[in] | data | Pointer to the data which will be passed when callback function is called by the stack. |
[in] | event | Type of endpoint event. See USBD_EVENT_T for more details. |
LPC_OK | On success. |
ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
ERR_USBD_xxx | For other error conditions. |