Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the source code of this file.
Data Structures | |
struct | PACK_STRUCT_STRUCT |
Response to a READ_CAPACITY_10 SCSI command. More... | |
struct | PACK_STRUCT_STRUCT |
Response to a READ_CAPACITY_10 SCSI command. More... | |
Typedefs | |
typedef uint32_t | DWORD |
typedef uint16_t | WORD |
Functions | |
static | THD_WORKING_AREA (mass_storage_thread_wa, 1024) |
static void | mass_storage_thread (void *arg) |
Mass storage thread that processes commands. More... | |
void | debug_snd_evt_i (eventmask_t evt) |
void | debug_snd_evt_inl (eventmask_t evt) |
void | debug_snd_evt_nl (eventmask_t evt) |
static uint8_t | IN_DMA_SECTION_CLEAR (rw_buf[2][512]) |
Read-write buffers (TODO: need a way of specifying the size of this) More... | |
static DWORD | swap_uint32 (const DWORD val) |
Byte-swap a 32 bits unsigned integer. More... | |
static WORD | swap_uint16 (const WORD val) |
Byte-swap a 16 bits unsigned integer. More... | |
static void | msd_handle_end_point_notification (USBDriver *usbp, usbep_t ep) |
Called when data can be read or written on the endpoint – wakes the thread up. More... | |
void | msdConfigureHookI (USBMassStorageDriver *msdp) |
USB device configured handler. More... | |
bool | msdRequestsHook (USBDriver *usbp) |
Default requests hook. More... | |
static void | msd_wait_for_isr (USBMassStorageDriver *msdp) |
Wait until the end-point interrupt handler has been called. More... | |
static void | msd_start_transmit (USBMassStorageDriver *msdp, const uint8_t *buffer, size_t size) |
Starts sending data. More... | |
static void | msd_start_receive (USBMassStorageDriver *msdp, uint8_t *buffer, size_t size) |
Starts receiving data. More... | |
static void | msd_scsi_set_sense (USBMassStorageDriver *msdp, uint8_t key, uint8_t acode, uint8_t aqual) |
Changes the SCSI sense information. More... | |
bool | msd_scsi_process_inquiry (USBMassStorageDriver *msdp) |
Processes an INQUIRY SCSI command. More... | |
bool | msd_scsi_process_request_sense (USBMassStorageDriver *msdp) |
Processes a REQUEST_SENSE SCSI command. More... | |
bool | msd_scsi_process_read_capacity_10 (USBMassStorageDriver *msdp) |
Processes a READ_CAPACITY_10 SCSI command. More... | |
bool | msd_scsi_process_send_diagnostic (USBMassStorageDriver *msdp) |
Processes a SEND_DIAGNOSTIC SCSI command. More... | |
bool | msd_scsi_process_start_read_write_10 (USBMassStorageDriver *msdp) |
Processes a READ_WRITE_10 SCSI command. More... | |
bool | msd_scsi_process_start_stop_unit (USBMassStorageDriver *msdp) |
Processes a START_STOP_UNIT SCSI command. More... | |
bool | msd_scsi_process_mode_sense_6 (USBMassStorageDriver *msdp) |
Processes a MODE_SENSE_6 SCSI command. More... | |
bool | msd_scsi_process_read_format_capacities (USBMassStorageDriver *msdp) |
Processes a READ_FORMAT_CAPACITIES SCSI command. More... | |
bool | msd_scsi_process_test_unit_ready (USBMassStorageDriver *msdp) |
Processes a TEST_UNIT_READY SCSI command. More... | |
bool | msd_wait_for_command_block (USBMassStorageDriver *msdp) |
Waits for a new command block. More... | |
bool | msd_read_command_block (USBMassStorageDriver *msdp) |
Reads a newly received command block. More... | |
void | msdInit (USBMassStorageDriver *msdp) |
Initializse a USB mass storage driver. More... | |
void | msdStart (USBMassStorageDriver *msdp, const USBMassStorageConfig *config) |
Starts a USB mass storage driver. More... | |
void | msdStop (USBMassStorageDriver *msdp) |
Stops a USB mass storage driver. More... | |
static void | usbEvent (USBDriver *usbp, usbevent_t event) |
static const USBDescriptor * | getDescriptor (USBDriver *usbp, uint8_t type, uint8_t index, uint16_t lang) |
void | deinit_msd_driver (void) |
void | init_msd_driver (void *dbgThreadPtr, USBMassStorageConfig *msdConfig) |
void | msd_register_evt_connected (event_listener_t *elp, eventmask_t mask) |
register connected event source in local event mask More... | |
void | msd_register_evt_ejected (event_listener_t *elp, eventmask_t mask) |
register ejected event source in local event mask More... | |
Variables | |
static USBMassStorageDriver | UMSD |
thread_t * | dbg_printer = NULL |
static USBInEndpointState | ep1_in_state |
IN end-point 1 state. More... | |
static USBOutEndpointState | ep1_out_state |
OUT end-point 1 state. More... | |
static const USBEndpointConfig | ep_data_config |
End-point 1 initialization structure. More... | |
static const uint8_t | deviceDescriptorData [] |
static const USBDescriptor | deviceDescriptor |
static const uint8_t | configurationDescriptorData [] |
static const USBDescriptor | configurationDescriptor |
static const uint8_t | languageDescriptorData [] |
static const USBDescriptor | languageDescriptor |
static const uint8_t | vendorDescriptorData [] |
static const USBDescriptor | vendorDescriptor |
static const uint8_t | productDescriptorData [] |
static const USBDescriptor | productDescriptor |
static const uint8_t | serialNumberDescriptorData [] |
static const USBDescriptor | serialNumberDescriptor |
static const USBConfig | usbConfig |
struct PACK_STRUCT_STRUCT |
Response to a READ_CAPACITY_10 SCSI command.
structure holding the data to reply to an INQUIRY SCSI command
Structure holding sense data (status/error information)
Command Status Wrapper structure.
Command Block Wrapper structure.
Response to a READ_FORMAT_CAPACITIES SCSI command.
Data Fields | ||
---|---|---|
uint8_t | additional_length | |
uint32_t | block_count | |
uint32_t | block_size | |
uint8_t | bqueetc | |
uint8_t | byte[18] | |
uint8_t | capacity_list_length | |
uint8_t | cmdque | |
uint32_t | data_len | |
uint32_t | data_residue | |
uint32_t | desc_and_block_length | |
uint8_t | flags | |
uint32_t | last_block_addr | |
uint8_t | lun | |
uint8_t | peripheral | |
uint8_t | product_id[16] | |
uint8_t | product_rev[4] | |
uint8_t | removable | |
uint8_t | reserved[3] | |
uint8_t | response_data_format | |
uint8_t | sccstp | |
uint8_t | scsi_cmd_data[16] | |
uint8_t | scsi_cmd_len | |
uint32_t | signature | |
uint8_t | status | |
uint32_t | tag | |
uint8_t | vendor_id[8] | |
uint8_t | version |
struct PACK_STRUCT_STRUCT |
Response to a READ_CAPACITY_10 SCSI command.
structure holding the data to reply to an INQUIRY SCSI command
Structure holding sense data (status/error information)
Command Status Wrapper structure.
Command Block Wrapper structure.
Response to a READ_FORMAT_CAPACITIES SCSI command.
Data Fields | ||
---|---|---|
uint8_t | additional_length | |
uint32_t | block_count | |
uint32_t | block_size | |
uint8_t | bqueetc | |
uint8_t | byte[18] | |
uint8_t | capacity_list_length | |
uint8_t | cmdque | |
uint32_t | data_len | |
uint32_t | data_residue | |
uint32_t | desc_and_block_length | |
uint8_t | flags | |
uint32_t | last_block_addr | |
uint8_t | lun | |
uint8_t | peripheral | |
uint8_t | product_id[16] | |
uint8_t | product_rev[4] | |
uint8_t | removable | |
uint8_t | reserved[3] | |
uint8_t | response_data_format | |
uint8_t | sccstp | |
uint8_t | scsi_cmd_data[16] | |
uint8_t | scsi_cmd_len | |
uint32_t | signature | |
uint8_t | status | |
uint32_t | tag | |
uint8_t | vendor_id[8] | |
uint8_t | version |
#define MSD_CBW_SIGNATURE 0x43425355 |
Definition at line 39 of file usb_msd.c.
Referenced by msd_read_command_block().
#define MSD_COMMAND_FAILED 0x01 |
Definition at line 50 of file usb_msd.c.
Referenced by msd_read_command_block().
#define MSD_COMMAND_PASSED 0x00 |
Definition at line 49 of file usb_msd.c.
Referenced by msd_read_command_block().
#define MSD_CSW_SIGNATURE 0x53425355 |
Definition at line 40 of file usb_msd.c.
Referenced by msd_read_command_block().
#define MSD_GET_MAX_LUN 0xFE |
Definition at line 36 of file usb_msd.c.
Referenced by msdRequestsHook().
#define MSD_REQ_RESET 0xFF |
Definition at line 35 of file usb_msd.c.
Referenced by msdRequestsHook().
#define MSD_SETUP_INDEX | ( | setup | ) | MSD_SETUP_WORD(setup, 4) |
Definition at line 45 of file usb_msd.c.
Referenced by msdRequestsHook().
#define MSD_SETUP_LENGTH | ( | setup | ) | MSD_SETUP_WORD(setup, 6) |
Definition at line 46 of file usb_msd.c.
Referenced by msdRequestsHook().
#define MSD_SETUP_VALUE | ( | setup | ) | MSD_SETUP_WORD(setup, 2) |
Definition at line 44 of file usb_msd.c.
Referenced by msdRequestsHook().
#define SCSI_ASENSE_INVALID_COMMAND 0x20 |
Definition at line 88 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24 |
Definition at line 90 of file usb_msd.c.
Referenced by msd_read_command_block(), msd_scsi_process_inquiry(), and msd_scsi_process_send_diagnostic().
#define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21 |
Definition at line 89 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
#define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A |
Definition at line 94 of file usb_msd.c.
Referenced by msd_scsi_process_test_unit_ready().
#define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00 |
Definition at line 84 of file usb_msd.c.
Referenced by mass_storage_thread(), msd_read_command_block(), and msd_scsi_process_test_unit_ready().
#define SCSI_ASENSE_READ_ERROR 0x11 |
Definition at line 87 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
#define SCSI_ASENSE_WRITE_FAULT 0x03 |
Definition at line 85 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
#define SCSI_ASENSE_WRITE_PROTECTED 0x27 |
Definition at line 91 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
#define SCSI_ASENSEQ_NO_QUALIFIER 0x00 |
Definition at line 96 of file usb_msd.c.
Referenced by mass_storage_thread(), msd_read_command_block(), msd_scsi_process_inquiry(), msd_scsi_process_send_diagnostic(), msd_scsi_process_start_read_write_10(), and msd_scsi_process_test_unit_ready().
#define SCSI_CMD_FORMAT_UNIT 0x04 |
Definition at line 56 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_INQUIRY 0x12 |
Definition at line 57 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_MODE_SENSE_6 0x1A |
Definition at line 58 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E |
Definition at line 61 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_READ_10 0x28 |
Definition at line 64 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_READ_CAPACITY_10 0x25 |
Definition at line 63 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_READ_FORMAT_CAPACITIES 0x23 |
Definition at line 62 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_REQUEST_SENSE 0x03 |
Definition at line 55 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_SEND_DIAGNOSTIC 0x1D |
Definition at line 60 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_START_STOP_UNIT 0x1B |
Definition at line 59 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_TEST_UNIT_READY 0x00 |
Definition at line 54 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_VERIFY_10 0x2F |
Definition at line 66 of file usb_msd.c.
Referenced by msd_read_command_block().
#define SCSI_CMD_WRITE_10 0x2A |
Definition at line 65 of file usb_msd.c.
Referenced by msd_read_command_block(), and msd_scsi_process_start_read_write_10().
#define SCSI_SENSE_KEY_DATA_PROTECT 0x07 |
Definition at line 76 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
#define SCSI_SENSE_KEY_GOOD 0x00 |
Definition at line 69 of file usb_msd.c.
Referenced by mass_storage_thread(), and msd_read_command_block().
#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 |
Definition at line 74 of file usb_msd.c.
Referenced by msd_read_command_block(), msd_scsi_process_inquiry(), msd_scsi_process_send_diagnostic(), and msd_scsi_process_start_read_write_10().
#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 |
Definition at line 72 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
#define SCSI_SENSE_KEY_NOT_READY 0x02 |
Definition at line 71 of file usb_msd.c.
Referenced by msd_scsi_process_test_unit_ready().
#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 |
Definition at line 70 of file usb_msd.c.
Referenced by msd_scsi_process_test_unit_ready().
void debug_snd_evt_i | ( | eventmask_t | evt | ) |
Definition at line 921 of file usb_msd.c.
References dbg_printer.
Referenced by msdInit(), msdRequestsHook(), and usbEvent().
void debug_snd_evt_inl | ( | eventmask_t | evt | ) |
Definition at line 930 of file usb_msd.c.
References dbg_printer.
Referenced by msd_wait_for_isr(), and msdConfigureHookI().
void debug_snd_evt_nl | ( | eventmask_t | evt | ) |
Definition at line 937 of file usb_msd.c.
References dbg_printer.
Referenced by msd_scsi_process_inquiry(), msd_scsi_process_mode_sense_6(), msd_scsi_process_read_capacity_10(), msd_scsi_process_read_format_capacities(), msd_scsi_process_start_read_write_10(), msd_scsi_process_test_unit_ready(), and msd_wait_for_command_block().
void deinit_msd_driver | ( | void | ) |
Definition at line 1121 of file usb_msd.c.
References msdStop().
Referenced by thdUsbStorage().
|
static |
Definition at line 1087 of file usb_msd.c.
References configurationDescriptor, deviceDescriptor, languageDescriptor, productDescriptor, serialNumberDescriptor, and vendorDescriptor.
|
static |
Read-write buffers (TODO: need a way of specifying the size of this)
void init_msd_driver | ( | void * | dbgThreadPtr, |
USBMassStorageConfig * | msdConfig | ||
) |
Definition at line 1126 of file usb_msd.c.
References dbg_printer, msdInit(), msdStart(), and USBD.
Referenced by thdUsbStorage().
|
static |
Mass storage thread that processes commands.
Definition at line 1156 of file usb_msd.c.
References USBMassStorageDriver::bsem, USBMassStorageDriver::config, ep_data_config, MSD_BOT_RESET, MSD_EJECTED, MSD_IDLE, MSD_READ_COMMAND_BLOCK, msd_read_command_block(), msd_scsi_set_sense(), msd_wait_for_command_block(), msd_wait_for_isr(), USBMassStorageDriver::reconfigured_or_reset_event, SCSI_ASENSE_NO_ADDITIONAL_INFORMATION, SCSI_ASENSEQ_NO_QUALIFIER, SCSI_SENSE_KEY_GOOD, USBMassStorageDriver::state, USB_MS_DATA_EP, and USBMassStorageConfig::usbp.
Referenced by msdStart().
|
static |
Called when data can be read or written on the endpoint – wakes the thread up.
Definition at line 298 of file usb_msd.c.
References SEM_RELEASED.
bool msd_read_command_block | ( | USBMassStorageDriver * | msdp | ) |
Reads a newly received command block.
Definition at line 669 of file usb_msd.c.
References USBMassStorageDriver::bot_reset, USBMassStorageConfig::bulk_ep, USBMassStorageDriver::cbw, USBMassStorageDriver::config, USBMassStorageDriver::csw, MSD_CBW_SIGNATURE, MSD_COMMAND_FAILED, MSD_COMMAND_PASSED, MSD_CSW_SIGNATURE, MSD_IDLE, msd_scsi_process_inquiry(), msd_scsi_process_mode_sense_6(), msd_scsi_process_read_capacity_10(), msd_scsi_process_read_format_capacities(), msd_scsi_process_request_sense(), msd_scsi_process_send_diagnostic(), msd_scsi_process_start_read_write_10(), msd_scsi_process_start_stop_unit(), msd_scsi_process_test_unit_ready(), msd_scsi_set_sense(), msd_start_transmit(), msd_wait_for_isr(), USBMassStorageDriver::result, USBMassStorageConfig::rw_activity_callback, SCSI_ASENSE_INVALID_COMMAND, SCSI_ASENSE_INVALID_FIELD_IN_CDB, SCSI_ASENSE_NO_ADDITIONAL_INFORMATION, SCSI_ASENSEQ_NO_QUALIFIER, SCSI_CMD_FORMAT_UNIT, SCSI_CMD_INQUIRY, SCSI_CMD_MODE_SENSE_6, SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL, SCSI_CMD_READ_10, SCSI_CMD_READ_CAPACITY_10, SCSI_CMD_READ_FORMAT_CAPACITIES, SCSI_CMD_REQUEST_SENSE, SCSI_CMD_SEND_DIAGNOSTIC, SCSI_CMD_START_STOP_UNIT, SCSI_CMD_TEST_UNIT_READY, SCSI_CMD_VERIFY_10, SCSI_CMD_WRITE_10, SCSI_SENSE_KEY_GOOD, SCSI_SENSE_KEY_ILLEGAL_REQUEST, USBMassStorageDriver::state, and USBMassStorageConfig::usbp.
Referenced by mass_storage_thread().
void msd_register_evt_connected | ( | event_listener_t * | elp, |
eventmask_t | mask | ||
) |
register connected event source in local event mask
This function is a stub to chEvtRegisterMask
Definition at line 1142 of file usb_msd.c.
References USBMassStorageDriver::evt_connected.
Referenced by thdUsbStorage().
void msd_register_evt_ejected | ( | event_listener_t * | elp, |
eventmask_t | mask | ||
) |
register ejected event source in local event mask
This function is a stub to chEvtRegisterMask ejected event is a logical event : when host unmount the filesystem, not a physical event (event is not sent in case of unplugged usb wire)
Definition at line 1147 of file usb_msd.c.
References USBMassStorageDriver::evt_ejected.
bool msd_scsi_process_inquiry | ( | USBMassStorageDriver * | msdp | ) |
Processes an INQUIRY SCSI command.
Definition at line 349 of file usb_msd.c.
References USBMassStorageDriver::cbw, debug_snd_evt_nl(), EVT_SCSI_PROC_INQ, USBMassStorageDriver::inquiry, msd_scsi_set_sense(), msd_start_transmit(), USBMassStorageDriver::result, SCSI_ASENSE_INVALID_FIELD_IN_CDB, SCSI_ASENSEQ_NO_QUALIFIER, and SCSI_SENSE_KEY_ILLEGAL_REQUEST.
Referenced by msd_read_command_block().
bool msd_scsi_process_mode_sense_6 | ( | USBMassStorageDriver * | msdp | ) |
Processes a MODE_SENSE_6 SCSI command.
Definition at line 588 of file usb_msd.c.
References debug_snd_evt_nl(), EVT_SCSI_REQ_SENSE6, msd_start_transmit(), and USBMassStorageDriver::result.
Referenced by msd_read_command_block().
bool msd_scsi_process_read_capacity_10 | ( | USBMassStorageDriver * | msdp | ) |
Processes a READ_CAPACITY_10 SCSI command.
Definition at line 407 of file usb_msd.c.
References USBMassStorageDriver::block_dev_info, debug_snd_evt_nl(), EVT_SCSI_REQ_READ_CAP10, msd_start_transmit(), USBMassStorageDriver::result, and swap_uint32().
Referenced by msd_read_command_block().
bool msd_scsi_process_read_format_capacities | ( | USBMassStorageDriver * | msdp | ) |
Processes a READ_FORMAT_CAPACITIES SCSI command.
Definition at line 608 of file usb_msd.c.
References USBMassStorageDriver::block_dev_info, debug_snd_evt_nl(), EVT_SCSI_REQ_READ_FMT_CAP, msd_start_transmit(), USBMassStorageDriver::result, and swap_uint32().
Referenced by msd_read_command_block().
bool msd_scsi_process_request_sense | ( | USBMassStorageDriver * | msdp | ) |
Processes a REQUEST_SENSE SCSI command.
Definition at line 391 of file usb_msd.c.
References msd_start_transmit(), msd_wait_for_isr(), USBMassStorageDriver::result, and USBMassStorageDriver::sense.
Referenced by msd_read_command_block().
bool msd_scsi_process_send_diagnostic | ( | USBMassStorageDriver * | msdp | ) |
Processes a SEND_DIAGNOSTIC SCSI command.
Definition at line 425 of file usb_msd.c.
References USBMassStorageDriver::cbw, msd_scsi_set_sense(), USBMassStorageDriver::result, SCSI_ASENSE_INVALID_FIELD_IN_CDB, SCSI_ASENSEQ_NO_QUALIFIER, and SCSI_SENSE_KEY_ILLEGAL_REQUEST.
Referenced by msd_read_command_block().
bool msd_scsi_process_start_read_write_10 | ( | USBMassStorageDriver * | msdp | ) |
Processes a READ_WRITE_10 SCSI command.
Definition at line 449 of file usb_msd.c.
References USBMassStorageConfig::bbdp, USBMassStorageDriver::block_dev_info, USBMassStorageDriver::cbw, USBMassStorageDriver::config, debug_snd_evt_nl(), EVT_SCSI_REQ_SENSE10, msd_scsi_set_sense(), msd_start_receive(), msd_start_transmit(), msd_wait_for_isr(), USBMassStorageDriver::result, SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE, SCSI_ASENSE_READ_ERROR, SCSI_ASENSE_WRITE_FAULT, SCSI_ASENSE_WRITE_PROTECTED, SCSI_ASENSEQ_NO_QUALIFIER, SCSI_CMD_WRITE_10, SCSI_SENSE_KEY_DATA_PROTECT, SCSI_SENSE_KEY_ILLEGAL_REQUEST, SCSI_SENSE_KEY_MEDIUM_ERROR, swap_uint16(), and swap_uint32().
Referenced by msd_read_command_block().
bool msd_scsi_process_start_stop_unit | ( | USBMassStorageDriver * | msdp | ) |
Processes a START_STOP_UNIT SCSI command.
Definition at line 570 of file usb_msd.c.
References USBMassStorageDriver::cbw, USBMassStorageDriver::evt_ejected, MSD_EJECTED, USBMassStorageDriver::result, and USBMassStorageDriver::state.
Referenced by msd_read_command_block().
bool msd_scsi_process_test_unit_ready | ( | USBMassStorageDriver * | msdp | ) |
Processes a TEST_UNIT_READY SCSI command.
Definition at line 627 of file usb_msd.c.
References USBMassStorageConfig::bbdp, USBMassStorageDriver::config, debug_snd_evt_nl(), EVT_SCSI_REQ_TEST_UNIT_READY, msd_scsi_set_sense(), USBMassStorageDriver::result, SCSI_ASENSE_MEDIUM_NOT_PRESENT, SCSI_ASENSE_NO_ADDITIONAL_INFORMATION, SCSI_ASENSEQ_NO_QUALIFIER, SCSI_SENSE_KEY_NOT_READY, and SCSI_SENSE_KEY_RECOVERED_ERROR.
Referenced by msd_read_command_block().
|
inlinestatic |
Changes the SCSI sense information.
Definition at line 339 of file usb_msd.c.
References USBMassStorageDriver::sense.
Referenced by mass_storage_thread(), msd_read_command_block(), msd_scsi_process_inquiry(), msd_scsi_process_send_diagnostic(), msd_scsi_process_start_read_write_10(), and msd_scsi_process_test_unit_ready().
|
static |
Starts receiving data.
Definition at line 325 of file usb_msd.c.
References USBMassStorageDriver::bot_reset, USBMassStorageConfig::bulk_ep, USBMassStorageDriver::config, and USBMassStorageConfig::usbp.
Referenced by msd_scsi_process_start_read_write_10(), and msd_wait_for_command_block().
|
static |
Starts sending data.
Definition at line 311 of file usb_msd.c.
References USBMassStorageDriver::bot_reset, USBMassStorageConfig::bulk_ep, USBMassStorageDriver::config, and USBMassStorageConfig::usbp.
Referenced by msd_read_command_block(), msd_scsi_process_inquiry(), msd_scsi_process_mode_sense_6(), msd_scsi_process_read_capacity_10(), msd_scsi_process_read_format_capacities(), msd_scsi_process_request_sense(), and msd_scsi_process_start_read_write_10().
bool msd_wait_for_command_block | ( | USBMassStorageDriver * | msdp | ) |
Waits for a new command block.
Definition at line 654 of file usb_msd.c.
References USBMassStorageDriver::cbw, debug_snd_evt_nl(), EVT_WAIT_FOR_COMMAND_BLOCK, MSD_READ_COMMAND_BLOCK, msd_start_receive(), and USBMassStorageDriver::state.
Referenced by mass_storage_thread().
|
static |
Wait until the end-point interrupt handler has been called.
Definition at line 285 of file usb_msd.c.
References USBMassStorageDriver::bsem, debug_snd_evt_inl(), EVT_SEM_TAKEN, and SEM_TAKEN.
Referenced by mass_storage_thread(), msd_read_command_block(), msd_scsi_process_request_sense(), and msd_scsi_process_start_read_write_10().
void msdConfigureHookI | ( | USBMassStorageDriver * | msdp | ) |
USB device configured handler.
[in] | msdp | pointer to the USBMassStorageDriver object |
Definition at line 188 of file usb_msd.c.
References USBMassStorageDriver::bsem, USBMassStorageConfig::bulk_ep, USBMassStorageDriver::config, debug_snd_evt_inl(), USBMassStorageDriver::evt_connected, EVT_SEM_RELEASED, SEM_RELEASED, and USBMassStorageConfig::usbp.
Referenced by usbEvent().
void msdInit | ( | USBMassStorageDriver * | msdp | ) |
Initializse a USB mass storage driver.
Initializes a USB mass storage driver.
Definition at line 815 of file usb_msd.c.
References USBMassStorageDriver::bot_reset, USBMassStorageDriver::bsem, USBMassStorageDriver::config, debug_snd_evt_i(), USBMassStorageDriver::evt_connected, USBMassStorageDriver::evt_ejected, EVT_SEM_TAKEN, USBMassStorageDriver::inquiry, MSD_IDLE, USBMassStorageDriver::reconfigured_or_reset_event, USBMassStorageDriver::sense, USBMassStorageDriver::state, and USBMassStorageDriver::thread.
Referenced by init_msd_driver().
bool msdRequestsHook | ( | USBDriver * | usbp | ) |
Default requests hook.
[in] | usbp | pointer to the USBDriver object |
true | Message handled internally. |
false | Message not handled. |
Definition at line 205 of file usb_msd.c.
References USBMassStorageDriver::bot_reset, USBMassStorageDriver::bsem, USBMassStorageConfig::bulk_ep, USBMassStorageDriver::config, debug_snd_evt_i(), EVT_BOT_RESET, MSD_BOT_RESET, MSD_GET_MAX_LUN, MSD_REQ_RESET, MSD_SETUP_INDEX, MSD_SETUP_LENGTH, MSD_SETUP_VALUE, USBMassStorageDriver::state, and USBMassStorageConfig::usbp.
void msdStart | ( | USBMassStorageDriver * | msdp, |
const USBMassStorageConfig * | config | ||
) |
Starts a USB mass storage driver.
This function is sufficient to have USB mass storage running, it internally runs a thread that handles USB requests and transfers. The block device must be connected but no file system must be mounted, everything is handled by the host system.
Definition at line 855 of file usb_msd.c.
References USBMassStorageConfig::bbdp, USBMassStorageDriver::block_dev_info, USBMassStorageConfig::bulk_ep, config, USBMassStorageDriver::config, USBMassStorageDriver::inquiry, mass_storage_thread(), MSD_IDLE, USBMassStorageConfig::short_product_id, USBMassStorageConfig::short_product_version, USBMassStorageConfig::short_vendor_id, USBMassStorageDriver::state, USBMassStorageDriver::thread, and USBMassStorageConfig::usbp.
Referenced by init_msd_driver().
void msdStop | ( | USBMassStorageDriver * | msdp | ) |
Stops a USB mass storage driver.
This function waits for current tasks to be finished, if any, and then stops the mass storage thread.
Definition at line 900 of file usb_msd.c.
References USBMassStorageDriver::bsem, USBMassStorageConfig::bulk_ep, USBMassStorageDriver::config, USBMassStorageDriver::thread, and USBMassStorageConfig::usbp.
Referenced by deinit_msd_driver().
Byte-swap a 16 bits unsigned integer.
Definition at line 149 of file usb_msd.c.
Referenced by msd_scsi_process_start_read_write_10().
Byte-swap a 32 bits unsigned integer.
Definition at line 140 of file usb_msd.c.
Referenced by msd_scsi_process_read_capacity_10(), msd_scsi_process_read_format_capacities(), and msd_scsi_process_start_read_write_10().
|
static |
|
static |
Definition at line 945 of file usb_msd.c.
References debug_snd_evt_i(), EVT_USB_RESET, msdConfigureHookI(), and USBMassStorageDriver::reconfigured_or_reset_event.
|
static |
Definition at line 1036 of file usb_msd.c.
Referenced by getDescriptor().
thread_t* dbg_printer = NULL |
Definition at line 109 of file usb_msd.c.
Referenced by debug_snd_evt_i(), debug_snd_evt_inl(), debug_snd_evt_nl(), and init_msd_driver().
|
static |
Definition at line 988 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
|
static |
|
static |
|
static |
End-point 1 initialization structure.
Definition at line 168 of file usb_msd.c.
Referenced by mass_storage_thread().
|
static |
Definition at line 1047 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
|
static |
Definition at line 1069 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
|
static |
Definition at line 1080 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
|
static |
|
static |
|
static |
Definition at line 1058 of file usb_msd.c.
Referenced by getDescriptor().