1 #ifndef __USB_MSC_BULK_H__SHSP6ONHDJ__
2 #define __USB_MSC_BULK_H__SHSP6ONHDJ__
6 #include <msc/msc-defs.h>
8 #define USB_MSC_BUFFERS 16
11 struct usb_msc_bulk_cbw
13 uint32_t dCBWSignature;
15 uint32_t dCBWDataTransferLength;
22 struct usb_msc_bulk_csw
24 uint32_t dCSWSignature;
26 uint32_t dCSWDataResidue;
30 struct usb_msc_command_state
32 const uint8_t *command;
33 unsigned int command_length;
36 unsigned int cmd_data_transfered;
38 unsigned int cmd_data_submitted;
40 void (*data_cb)(
struct usb_msc_command_state *state);
47 USB_MSC_HANDLER_OK = 0,
48 USB_MSC_HANDLER_DELAYED,
49 USB_MSC_HANDLER_FAILED
50 } usb_msc_handler_status;
52 usb_msc_handler_status
53 usb_msc_handle_command(
struct usb_msc_command_state *state);
56 usb_msc_command_handler_init();
59 #define USB_MSC_DATA_DO_CALLBACK 0x20
62 #define USB_MSC_DATA_SEND 0x40
65 #define USB_MSC_DATA_RECEIVE 0x40
68 #define USB_MSC_DATA_LAST 0x80
74 usb_msc_send_data(
const uint8_t *data,
unsigned int len,
unsigned int flags);
79 usb_msc_send_data_buf_flags(
const uint8_t *data,
unsigned int len,
80 unsigned int flags, uint16_t buf_flags);
82 #define USB_MSC_SEND_ABORT() \
83 usb_msc_send_data_buf_flags(NULL, 0, USB_MSC_DATA_LAST, 0)
88 usb_msc_receive_data(uint8_t *data,
unsigned int len,
unsigned int flags);
93 usb_msc_receive_data_buf_flags(uint8_t *data,
unsigned int len,
94 unsigned int flags, uint16_t buf_flags);
95 #define USB_MSC_RECEIVE_ABORT() \
96 usb_msc_receive_data_buf_flags(NULL, 0, USB_MSC_DATA_LAST, 0)
98 #define USB_MSC_DONE() \
99 usb_msc_send_data_buf_flags(NULL, 0, USB_MSC_DATA_LAST, 0)