22#ifndef USB_USBUS_MSC_H
23#define USB_USBUS_MSC_H
37#if defined(MODULE_PERIPH_USBDEV_HS_UTMI) || defined(MODULE_PERIPH_USBDEV_HS_ULPI)
38#define USBUS_MSC_EP_DATA_SIZE 512
40#define USBUS_MSC_EP_DATA_SIZE 64
46#define USBUS_MSC_EP_IN_REQUIRED_NUMOF 1
51#define USBUS_MSC_EP_OUT_REQUIRED_NUMOF 1
SCSI protocol definitions for USBUS.
USBUS Command Block Wrapper information.
USBUS descriptor generator.
USBUS MSC device interface context.
uint32_t buffer_size
Size of the internal buffer used for data transfer.
usbus_t * usbus
Pointer to the USBUS context.
uint8_t * in_buf
Pointer to internal in endpoint buffer.
usbus_endpoint_t * ep_out
Data endpoint out.
cbw_info_t cmd
Command Block Wrapper information.
uint16_t block_offset
Internal offset for endpoint size chunk transfer.
event_t rx_event
Transmit ready event.
uint32_t block
First block to transfer data from/to.
usbus_handler_t handler_ctrl
Control interface handler.
usbus_msc_lun_t * lun_dev
Array holding exported logical unit descriptor.
uint8_t * buffer
Pointer to the current data transfer buffer.
usbus_interface_t iface
MSC interface.
usbus_descr_gen_t msc_descr
MSC descriptor generator.
usbus_msc_state_t state
Internal state machine for msc.
uint16_t block_nb
Number of block to transfer for READ and WRITE operations.
usbus_endpoint_t * ep_in
Data endpoint in.
uint8_t * out_buf
Pointer to internal out endpoint buffer.
USBUS MSC Logical Unit descriptor.
uint32_t block_size
Reported USB block size.
mtd_dev_t * mtd
Pointer to the current mtd device used.
uint32_t block_nb
Reported USB block number.
struct usbus_msc_device usbus_msc_device_t
USBUS MSC device interface context.
int usbus_msc_remove_lun(usbus_t *usbus, mtd_dev_t *dev)
Unregister a MTD device as a MSC LUN.
int usbus_msc_init(usbus_t *usbus, usbus_msc_device_t *handler)
MSC initialization function.
usbus_msc_state_t
USBUS MSC internal state machine enum.
@ GEN_CSW
Generate CSW response to host w/ the current transfer status.
@ DATA_TRANSFER_OUT
Ongoing transfer on USB MSC OUT endpoint.
@ WAIT_FOR_TRANSFER
Wait for a single packet transfer before sending CSW.
@ WAITING
Initial state, wait for USB setup.
@ DATA_TRANSFER_IN
Ongoing transfer on USB MSC IN endpoint.
int usbus_msc_add_lun(usbus_t *usbus, mtd_dev_t *dev)
Register a MTD device as a MSC LUN (Logical Unit Number)
struct usbus_msc_lun usbus_msc_lun_t
USBUS MSC Logical Unit descriptor.