Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Implementation of UDI MSC

Class internal implementation.

Macros

#define UDI_MSC_BLOCK_SIZE   512L
 Static block size for all memories. More...
 

Variables to manage SCSI requests

 UDC_BSS (4)
 Structure to receive a CBW packet. More...
 

Routines manage SCSI Commands

Number of lun

static void udi_msc_cbw_invalid (void)
 
static void udi_msc_csw_invalid (void)
 
static void udi_msc_cbw_wait (void)
 
static void udi_msc_cbw_received (udd_ep_status_t status, iram_size_t nb_received, udd_ep_id_t ep)
 
static bool udi_msc_cbw_validate (uint32_t alloc_len, uint8_t dir_flag)
 
static void udi_msc_data_send (uint8_t *buffer, uint8_t buf_size)
 
static void udi_msc_data_sent (udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep)
 
static void udi_msc_csw_process (void)
 
void udi_msc_csw_send (void)
 
static void udi_msc_csw_sent (udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep)
 
static void udi_msc_clear_sense (void)
 
static void udi_msc_sense_fail (uint8_t sense_key, uint16_t add_sense, uint32_t lba)
 
static void udi_msc_sense_pass (void)
 
static void udi_msc_sense_fail_not_present (void)
 
static void udi_msc_sense_fail_busy_or_change (void)
 
static void udi_msc_sense_fail_hardware (void)
 
static void udi_msc_sense_fail_protected (void)
 
static void udi_msc_sense_fail_cdb_invalid (void)
 
static void udi_msc_sense_command_invalid (void)
 
static void udi_msc_spc_requestsense (void)
 
static void udi_msc_spc_inquiry (void)
 
static bool udi_msc_spc_testunitready_global (void)
 
static void udi_msc_spc_testunitready (void)
 
static void udi_msc_spc_mode_sense (bool b_sense10)
 
static void udi_msc_spc_prevent_allow_medium_removal (void)
 
static void udi_msc_sbc_start_stop (void)
 
static void udi_msc_sbc_read_capacity (void)
 
static void udi_msc_sbc_trans (bool b_read)
 
bool udi_msc_process_trans (void)
 Process the background read/write commands. More...
 
static void udi_msc_trans_ack (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
 
bool udi_msc_trans_block (bool b_read, uint8_t *block, iram_size_t block_size, void(*callback)(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep))
 Transfers data to/from USB MSC endpoints. More...
 

#define UDI_MSC_BLOCK_SIZE   512L

Static block size for all memories.

Referenced by udi_msc_sbc_read_capacity(), and udi_msc_sbc_trans().

UDC_BSS ( )

Structure to receive a CBW packet.

Structure to send a CSW packet

References CPU_TO_BE32, usb_msc_csw::dCSWSignature, and USB_CSW_SIGNATURE.

static void udi_msc_cbw_invalid ( void  )
static
static bool udi_msc_cbw_validate ( uint32_t  alloc_len,
uint8_t  dir_flag 
)
static
static void udi_msc_cbw_wait ( void  )
static
static void udi_msc_clear_sense ( void  )
static
static void udi_msc_csw_invalid ( void  )
static
void udi_msc_csw_send ( void  )
static void udi_msc_csw_sent ( udd_ep_status_t  status,
iram_size_t  nb_sent,
udd_ep_id_t  ep 
)
static

References udi_msc_cbw_wait(), and UNUSED.

Referenced by udi_msc_csw_send().

static void udi_msc_data_send ( uint8_t *  buffer,
uint8_t  buf_size 
)
static
static void udi_msc_data_sent ( udd_ep_status_t  status,
iram_size_t  nb_sent,
udd_ep_id_t  ep 
)
static
bool udi_msc_process_trans ( void  )
static void udi_msc_sbc_start_stop ( void  )
static
static void udi_msc_sense_command_invalid ( void  )
static
static void udi_msc_sense_fail_busy_or_change ( void  )
static
static void udi_msc_sense_fail_not_present ( void  )
static
static void udi_msc_sense_fail_protected ( void  )
static
static void udi_msc_spc_prevent_allow_medium_removal ( void  )
static
static void udi_msc_spc_requestsense ( void  )
static
static void udi_msc_spc_testunitready ( void  )
static
static void udi_msc_trans_ack ( udd_ep_status_t  status,
iram_size_t  n,
udd_ep_id_t  ep 
)
static

References UDD_EP_TRANSFER_OK, and UNUSED.

Referenced by udi_msc_trans_block().

bool udi_msc_trans_block ( bool  b_read,
uint8_t *  block,
iram_size_t  block_size,
void(*)(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)  callback 
)

Transfers data to/from USB MSC endpoints.

Parameters
b_readMemory to USB, if true
blockBuffer on Internal RAM to send or fill
block_sizeBuffer size to send or fill
callbackFunction to call at the end of transfer. If NULL then the routine exit when transfer is finish.
Returns
1 if function was successfully done, otherwise 0.

References udd_ep_run(), UDI_MSC_EP_IN, UDI_MSC_EP_OUT, and udi_msc_trans_ack().

Referenced by virtual_usb_trans().