#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... | |
Variables | |
static U32 | dCBWTag |
volatile bool | ms_multiple_drive |
U8 | 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.
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.
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, NULL, 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_setup_received, Usb_ack_in_ready_send, usb_format_mcu_to_usb_data, 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().
volatile bool ms_multiple_drive |
Referenced by usb_mass_storage_cbw(), usb_user_endpoint_init(), and usb_user_read_request().
U8 usb_LUN |
Referenced by usb_mass_storage_cbw().