Paparazzi UAS v7.0_unstable
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... | |
Typedefs | |
typedef uint32_t | DWORD |
typedef uint16_t | WORD |
Variables | |
static USBMassStorageDriver | UMSD |
thread_t * | dbg_printer = NULL |
static USBInEndpointState | ep1_in_state |
IN end-point 1 state. | |
static USBOutEndpointState | ep1_out_state |
OUT end-point 1 state. | |
static const USBEndpointConfig | ep_data_config |
End-point 1 initialization structure. | |
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 |
#define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21 |
void debug_snd_evt_i | ( | eventmask_t | evt | ) |
Definition at line 921 of file usb_msd.c.
References dbg_printer, and foo.
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, and foo.
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, and foo.
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().
Definition at line 1121 of file usb_msd.c.
References msdStop(), and UMSD.
Referenced by thdUsbStorage().
|
static |
Definition at line 1087 of file usb_msd.c.
References configurationDescriptor, deviceDescriptor, foo, languageDescriptor, productDescriptor, serialNumberDescriptor, and vendorDescriptor.
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, foo, msdConfig, msdInit(), msdStart(), UMSD, usbConfig, and USBD.
Referenced by thdUsbStorage().
Mass storage thread that processes commands.
Definition at line 1158 of file usb_msd.c.
References ep_data_config, foo, 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(), SCSI_ASENSE_NO_ADDITIONAL_INFORMATION, SCSI_ASENSEQ_NO_QUALIFIER, SCSI_SENSE_KEY_GOOD, and USB_MS_DATA_EP.
Referenced by msdStart().
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 foo, and 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 foo, 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(), 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, and SCSI_SENSE_KEY_ILLEGAL_REQUEST.
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 1144 of file usb_msd.c.
References USBMassStorageDriver::evt_connected, foo, and UMSD.
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 1149 of file usb_msd.c.
References USBMassStorageDriver::evt_ejected, foo, and UMSD.
bool msd_scsi_process_inquiry | ( | USBMassStorageDriver * | msdp | ) |
Processes an INQUIRY SCSI command.
Definition at line 349 of file usb_msd.c.
References debug_snd_evt_nl(), EVT_SCSI_PROC_INQ, foo, msd_scsi_set_sense(), msd_start_transmit(), 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, foo, and msd_start_transmit().
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 debug_snd_evt_nl(), EVT_SCSI_REQ_READ_CAP10, foo, msd_start_transmit(), 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 debug_snd_evt_nl(), EVT_SCSI_REQ_READ_FMT_CAP, foo, msd_start_transmit(), 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 foo, msd_start_transmit(), and msd_wait_for_isr().
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 foo, msd_scsi_set_sense(), 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 debug_snd_evt_nl(), EVT_SCSI_REQ_SENSE10, foo, msd_scsi_set_sense(), msd_start_receive(), msd_start_transmit(), msd_wait_for_isr(), 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 foo, and MSD_EJECTED.
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 debug_snd_evt_nl(), EVT_SCSI_REQ_TEST_UNIT_READY, foo, msd_scsi_set_sense(), 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 foo.
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 foo.
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 foo.
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 debug_snd_evt_nl(), EVT_WAIT_FOR_COMMAND_BLOCK, foo, MSD_READ_COMMAND_BLOCK, and msd_start_receive().
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 debug_snd_evt_inl(), EVT_SEM_TAKEN, foo, 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 |
@iclass
Definition at line 188 of file usb_msd.c.
References debug_snd_evt_inl(), ep_data_config, EVT_SEM_RELEASED, foo, and SEM_RELEASED.
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 debug_snd_evt_i(), EVT_SEM_TAKEN, foo, and MSD_IDLE.
Referenced by init_msd_driver().
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, foo, MSD_BOT_RESET, MSD_GET_MAX_LUN, MSD_REQ_RESET, MSD_SETUP_INDEX, MSD_SETUP_LENGTH, MSD_SETUP_VALUE, USBMassStorageDriver::state, UMSD, 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 config, foo, mass_storage_thread(), and MSD_IDLE.
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 foo.
Referenced by deinit_msd_driver().
Byte-swap a 16 bits unsigned integer.
Definition at line 149 of file usb_msd.c.
References val.
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.
References val.
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, foo, msdConfigureHookI(), USBMassStorageDriver::reconfigured_or_reset_event, and UMSD.
|
static |
Definition at line 1036 of file usb_msd.c.
Referenced by getDescriptor().
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 |
End-point 1 initialization structure.
Definition at line 168 of file usb_msd.c.
Referenced by mass_storage_thread(), and msdConfigureHookI().
|
static |
Definition at line 1047 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
Definition at line 1069 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
Definition at line 1080 of file usb_msd.c.
Referenced by getDescriptor().
|
static |
Definition at line 33 of file usb_msd.c.
Referenced by deinit_msd_driver(), init_msd_driver(), msd_register_evt_connected(), msd_register_evt_ejected(), msdRequestsHook(), and usbEvent().
Definition at line 1112 of file usb_msd.c.
Referenced by init_msd_driver().
|
static |
Definition at line 1058 of file usb_msd.c.
Referenced by getDescriptor().