#include "conf_usb.h"
#include "board.h"
#include "usb_drv.h"
#include "usb_descriptors.h"
#include "usb_standard_request.h"
#include "ctrl_access.h"
#include "scsi_decoder.h"
#include "device_mass_storage_task.h"
Functions | |
void | device_mass_storage_task (void) |
Entry point of the device mass-storage task management. More... | |
void | device_mass_storage_task_init (void) |
This function initializes the hardware/software resources required for device mass-storage task. More... | |
static void | usb_mass_storage_cbw (void) |
USB Command Block Wrapper (CBW) management. More... | |
static void | usb_mass_storage_csw (void) |
USB Command Status Wrapper (CSW) management. More... | |
void | usb_sof_action (void) |
usb_sof_action More... | |
Variables | |
static uint32_t | dCBWTag |
uint8_t | ms_endpoint |
volatile bool | ms_multiple_drive |
static uint16_t | sof_cnt |
uint8_t | usb_LUN |
void device_mass_storage_task | ( | void | ) |
Entry point of the device mass-storage task management.
This function links the device mass-storage SCSI commands to the USB bus.
References EP_MS_OUT, Is_device_enumerated, Is_usb_out_received, LED0, LED1, LED_Display_Field(), LED_MONO0_GREEN, LED_MONO1_GREEN, LED_MONO2_GREEN, LED_MONO3_GREEN, sof_cnt, usb_mass_storage_cbw(), and usb_mass_storage_csw().
Referenced by device_mass_storage_task_init(), and main().
void device_mass_storage_task_init | ( | void | ) |
This function initializes the hardware/software resources required for device mass-storage task.
References device_mass_storage_task(), EP_MS_IN, EP_MS_OUT, g_scsi_ep_ms_in, g_scsi_ep_ms_out, Is_usb_device, sof_cnt, and Usb_enable_sof_interrupt.
Referenced by main().
|
static |
USB Command Block Wrapper (CBW) management.
This function decodes the CBW command and stores the SCSI command.
Check if dCBWSignature is correct
Store CBW Tag to be repeated in CSW
if (bmCBWFlags.bit7 == 1) {direction = IN;}
Dummy CBWCBLength read
Store scsi_command
References dCBWTag, EP_MS_IN, EP_MS_OUT, g_scsi_command, g_scsi_data_remaining, get_cur_lun(), ms_endpoint, ms_multiple_drive, scsi_decode_command(), Usb_ack_out_received_free, Usb_enable_stall_handshake, usb_format_usb_to_mcu_data, usb_LUN, Usb_read_endpoint_data, usb_read_ep_rxpacket(), and Usb_reset_endpoint_fifo_access.
Referenced by device_mass_storage_task().
|
static |
USB Command Status Wrapper (CSW) management.
This function sends the status in relation with the last CBW.
Write CSW Signature
Write stored CBW Tag
Write data residual value
Write command status
References dCBWTag, EP_MS_IN, EP_MS_OUT, g_scsi_data_remaining, g_scsi_status, Is_usb_endpoint_stall_requested, Is_usb_in_ready, Is_usb_out_received, Is_usb_setup_received, Usb_ack_in_ready_send, Usb_ack_out_received_free, usb_format_mcu_to_usb_data, Usb_nb_busy_bank, usb_process_request(), Usb_reset_endpoint_fifo_access, and Usb_write_endpoint_data.
Referenced by device_mass_storage_task().
|
static |
Referenced by usb_mass_storage_cbw(), and usb_mass_storage_csw().
uint8_t ms_endpoint |
Referenced by sbc_read_10(), sbc_write_10(), and usb_mass_storage_cbw().
volatile bool ms_multiple_drive |
Referenced by usb_mass_storage_cbw(), usb_user_endpoint_init(), and usb_user_read_request().
|
static |
Referenced by device_mass_storage_task(), device_mass_storage_task_init(), and usb_sof_action().
uint8_t usb_LUN |
Referenced by sbc_header_mode_sense(), sbc_read_10(), sbc_read_capacity(), sbc_test_unit_ready(), sbc_write_10(), and usb_mass_storage_cbw().