Structures and functions required by UDC.
Functions | |
bool | udi_msc_enable (void) |
Variables | |
UDC_DESC_STORAGE udi_api_t | udi_api_msc |
Global structure which contains standard UDI interface for UDC. More... | |
UDC_DESC_STORAGE udi_api_t | udi_api_msc |
Global structure which contains standard UDI API for UDC. More... | |
Routines manage SCSI Commands | |
void | udi_msc_disable (void) |
bool | udi_msc_setup (void) |
uint8_t | udi_msc_getsetting (void) |
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... | |
|
static |
References udd_ep_set_halt(), udd_ep_wait_stall_clear(), and UDI_MSC_EP_OUT.
Referenced by udi_msc_cbw_received().
|
static |
References CPU_TO_BE32, le32_to_cpu, SBC_READ10, SBC_READ_CAPACITY10, SBC_START_STOP_UNIT, SBC_VERIFY10, SBC_WRITE10, SPC_INQUIRY, SPC_MODE_SENSE10, SPC_MODE_SENSE6, SPC_PREVENT_ALLOW_MEDIUM_REMOVAL, SPC_REQUEST_SENSE, SPC_TEST_UNIT_READY, UDD_EP_TRANSFER_OK, udi_msc_cbw_invalid(), udi_msc_csw_invalid(), udi_msc_csw_process(), udi_msc_sbc_read_capacity(), udi_msc_sbc_start_stop(), udi_msc_sbc_trans(), udi_msc_sense_command_invalid(), udi_msc_sense_fail_cdb_invalid(), udi_msc_sense_pass(), udi_msc_spc_inquiry(), udi_msc_spc_mode_sense(), udi_msc_spc_prevent_allow_medium_removal(), udi_msc_spc_requestsense(), udi_msc_spc_testunitready(), UNUSED, USB_CBW_LUN_MASK, and USB_CBW_SIGNATURE.
Referenced by udi_msc_cbw_wait().
|
static |
References udi_msc_csw_process(), udi_msc_sense_fail_cdb_invalid(), and USB_CBW_DIRECTION_IN.
Referenced by udi_msc_sbc_read_capacity(), udi_msc_sbc_trans(), udi_msc_spc_inquiry(), udi_msc_spc_mode_sense(), and udi_msc_spc_requestsense().
|
static |
References udd_ep_run(), udd_ep_wait_stall_clear(), udi_msc_cbw_received(), and UDI_MSC_EP_OUT.
Referenced by udi_msc_csw_sent(), and udi_msc_setup().
|
static |
References SCSI_SENSE_ADDL_LEN, SCSI_SENSE_CURRENT, and SCSI_SENSE_VALID.
Referenced by udi_msc_sense_fail(), and udi_msc_sense_pass().
|
static |
References udd_ep_set_halt(), udd_ep_wait_stall_clear(), and UDI_MSC_EP_IN.
Referenced by udi_msc_cbw_received().
|
static |
References cpu_to_le32, udd_ep_set_halt(), udi_msc_csw_send(), UDI_MSC_EP_IN, UDI_MSC_EP_OUT, and USB_CBW_DIRECTION_IN.
Referenced by udi_msc_cbw_received(), udi_msc_cbw_validate(), udi_msc_data_send(), udi_msc_data_sent(), udi_msc_process_trans(), udi_msc_sbc_read_capacity(), udi_msc_sbc_start_stop(), udi_msc_sbc_trans(), udi_msc_spc_inquiry(), udi_msc_spc_prevent_allow_medium_removal(), and udi_msc_spc_testunitready().
void udi_msc_csw_send | ( | void | ) |
References udd_ep_run(), udd_ep_wait_stall_clear(), udi_msc_csw_sent(), and UDI_MSC_EP_IN.
Referenced by udi_msc_csw_process().
|
static |
References udi_msc_cbw_wait(), and UNUSED.
Referenced by udi_msc_csw_send().
|
static |
References udd_ep_run(), udi_msc_csw_process(), udi_msc_data_sent(), UDI_MSC_EP_IN, and udi_msc_sense_fail_hardware().
Referenced by udi_msc_sbc_read_capacity(), udi_msc_spc_inquiry(), udi_msc_spc_mode_sense(), and udi_msc_spc_requestsense().
|
static |
References UDD_EP_TRANSFER_OK, udi_msc_csw_process(), udi_msc_sense_pass(), and UNUSED.
Referenced by udi_msc_data_send().
void udi_msc_disable | ( | void | ) |
References UDI_MSC_DISABLE_EXT.
bool udi_msc_enable | ( | void | ) |
uint8_t udi_msc_getsetting | ( | void | ) |
bool udi_msc_process_trans | ( | void | ) |
Process the background read/write commands.
Routine called by the main loop
References CTRL_BUSY, CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, memory_2_usb(), udi_msc_csw_process(), udi_msc_sense_fail_busy_or_change(), udi_msc_sense_fail_hardware(), udi_msc_sense_fail_not_present(), udi_msc_sense_pass(), and usb_2_memory().
Referenced by main_memories_trans_task().
|
static |
References sbc_read_capacity10_data::block_len, cpu_to_be32, CPU_TO_BE32, CTRL_BUSY, CTRL_GOOD, CTRL_NO_PRESENT, sbc_read_capacity10_data::max_lba, mem_read_capacity(), UDC_BSS(), UDI_MSC_BLOCK_SIZE, udi_msc_cbw_validate(), udi_msc_csw_process(), udi_msc_data_send(), udi_msc_sense_fail_busy_or_change(), udi_msc_sense_fail_hardware(), udi_msc_sense_fail_not_present(), and USB_CBW_DIRECTION_IN.
Referenced by udi_msc_cbw_received().
|
static |
References mem_unload(), udi_msc_csw_process(), and udi_msc_sense_pass().
Referenced by udi_msc_cbw_received().
|
static |
References LSB, mem_wr_protect(), MSB, MSB0, MSB1, MSB2, MSB3, UDI_MSC_BLOCK_SIZE, udi_msc_cbw_validate(), udi_msc_csw_process(), UDI_MSC_NOTIFY_TRANS_EXT, udi_msc_sense_fail_protected(), USB_CBW_DIRECTION_IN, and USB_CBW_DIRECTION_OUT.
Referenced by udi_msc_cbw_received().
|
static |
References SCSI_ASC_INVALID_COMMAND_OPERATION_CODE, SCSI_SK_ILLEGAL_REQUEST, and udi_msc_sense_fail().
Referenced by udi_msc_cbw_received().
|
static |
|
static |
References SCSI_ASC_NOT_READY_TO_READY_CHANGE, SCSI_SK_UNIT_ATTENTION, and udi_msc_sense_fail().
Referenced by udi_msc_process_trans(), udi_msc_sbc_read_capacity(), and udi_msc_spc_testunitready_global().
|
static |
References SCSI_ASC_INVALID_FIELD_IN_CDB, SCSI_SK_ILLEGAL_REQUEST, and udi_msc_sense_fail().
Referenced by udi_msc_cbw_received(), udi_msc_cbw_validate(), udi_msc_spc_inquiry(), and udi_msc_spc_prevent_allow_medium_removal().
|
static |
References SCSI_ASC_NO_ADDITIONAL_SENSE_INFO, SCSI_SK_HARDWARE_ERROR, and udi_msc_sense_fail().
Referenced by udi_msc_data_send(), udi_msc_process_trans(), udi_msc_sbc_read_capacity(), and udi_msc_spc_testunitready_global().
|
static |
References SCSI_ASC_MEDIUM_NOT_PRESENT, SCSI_SK_NOT_READY, and udi_msc_sense_fail().
Referenced by udi_msc_process_trans(), udi_msc_sbc_read_capacity(), and udi_msc_spc_testunitready_global().
|
static |
References SCSI_ASC_WRITE_PROTECTED, SCSI_SK_DATA_PROTECT, and udi_msc_sense_fail().
Referenced by udi_msc_sbc_trans().
|
static |
bool udi_msc_setup | ( | void | ) |
References usb_setup_req_t::bRequest, udd_ctrl_request_t::payload, udd_ctrl_request_t::payload_size, udd_ctrl_request_t::req, udd_ep_abort(), udd_g_ctrlreq, Udd_setup_is_in, Udd_setup_is_out, Udd_setup_type, udi_msc_cbw_wait(), UDI_MSC_EP_IN, UDI_MSC_EP_OUT, USB_REQ_MSC_BULK_RESET, USB_REQ_MSC_GET_MAX_LUN, USB_REQ_TYPE_CLASS, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
|
static |
References scsi_inquiry_data::flags1, mem_name(), mem_removal(), scsi_inquiry_data::pq_pdt, scsi_inquiry_data::product_id, SCSI_INQ_ADDL_LEN, SCSI_INQ_DT_DIR_ACCESS, SCSI_INQ_PQ_CONNECTED, SCSI_INQ_REQ_CMDT, SCSI_INQ_REQ_EVPD, SCSI_INQ_RMB, SCSI_INQ_RSP_SPC2, SCSI_INQ_VER_SPC, UDC_DATA, udi_msc_cbw_validate(), udi_msc_csw_process(), udi_msc_data_send(), UDI_MSC_GLOBAL_PRODUCT_VERSION, UDI_MSC_GLOBAL_VENDOR_ID, udi_msc_sense_fail_cdb_invalid(), and USB_CBW_DIRECTION_IN.
Referenced by udi_msc_cbw_received().
|
static |
References cpu_to_be16, mem_wr_protect(), spc_control_page_info_execpt::mrie, spc_control_page_info_execpt::page_code, spc_control_page_info_execpt::page_length, SCSI_MS_MODE_ALL, SCSI_MS_MODE_INFEXP, SCSI_MS_SBC_WP, SPC_MP_INFEXP_MRIE_NO_SENSE, SPC_MP_INFEXP_PAGE_LENGTH, UDC_BSS(), udi_msc_cbw_validate(), udi_msc_data_send(), and USB_CBW_DIRECTION_IN.
Referenced by udi_msc_cbw_received().
|
static |
References udi_msc_csw_process(), udi_msc_sense_fail_cdb_invalid(), and udi_msc_sense_pass().
Referenced by udi_msc_cbw_received().
|
static |
References udi_msc_cbw_validate(), udi_msc_data_send(), and USB_CBW_DIRECTION_IN.
Referenced by udi_msc_cbw_received().
|
static |
References udi_msc_csw_process(), udi_msc_sense_pass(), and udi_msc_spc_testunitready_global().
Referenced by udi_msc_cbw_received().
|
static |
|
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.
b_read | Memory to USB, if true |
block | Buffer on Internal RAM to send or fill |
block_size | Buffer size to send or fill |
callback | Function to call at the end of transfer. If NULL then the routine exit when transfer is finish. |
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().
UDC_DESC_STORAGE udi_api_t udi_api_msc |
Global structure which contains standard UDI interface for UDC.
Global structure which contains standard UDI interface for UDC.
UDC_DESC_STORAGE udi_api_t udi_api_msc |
Global structure which contains standard UDI API for UDC.
Global structure which contains standard UDI interface for UDC.