scsi.h File Reference

SCSI protocol definitions for USBUS. More...

Detailed Description

SCSI protocol definitions for USBUS.

Author
Dylan Laduranty dylan.nosp@m..lad.nosp@m.urant.nosp@m.y@me.nosp@m.sotic.nosp@m..com

Definition in file scsi.h.

#include "byteorder.h"
+ Include dependency graph for scsi.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  msc_test_unit_pkt_t
 Packet structure to answer (SCSI_TEST_UNIT_READY) request. More...
 
struct  msc_mode_parameter_pkt_t
 Packet structure to answer (SCSI_MODE_SELECT6) and (SCSI_MODE_SENSE6) requests. More...
 
struct  msc_cbw_rw10_pkt_t
 CBW Packet structure for (SCSI_READ10) and (SCSI_WRITE10) requests. More...
 
struct  msc_inquiry_pkt_t
 Packet structure to answer (SCSI_INQUIRY) request. More...
 
struct  msc_read_fmt_capa_pkt_t
 Packet structure to answer (SCSI_READ_FORMAT_CAPACITIES) request. More...
 
struct  msc_request_sense_pkt_t
 Packet structure to answer (SCSI_REQUEST_SENSE) request. More...
 
struct  msc_read_capa_pkt_t
 Packet structure to answer (SCSI_READ_CAPACITY) request. More...
 
struct  msc_cbw_buf_t
 Command Block Wrapper packet structure. More...
 
struct  msc_csw_buf_t
 Command Status Wrapper packet structure. More...
 
struct  cbw_info_t
 USBUS Command Block Wrapper information. More...
 

Macros

#define SCSI_CBW_SIGNATURE   0x43425355
 Command Block Wrapper signature.
 
#define SCSI_CSW_SIGNATURE   0x53425355
 Command Status Wrapper signature.
 
#define SCSI_REQUEST_SENSE_ERROR   0x70
 SCSI Request Sense error type.
 

Functions

void usbus_msc_scsi_process_cmd (usbus_t *usbus, usbus_handler_t *handler, usbdev_ep_t *ep, size_t len)
 Process incoming Command Block Wrapper buffer. More...
 
void scsi_gen_csw (usbus_handler_t *handler, cbw_info_t *cmd)
 Generate Command Status Wrapper and send it to the host. More...
 
#define USBUS_MSC_VENDOR_ID   "RIOT-OS"
 
#define USBUS_MSC_PRODUCT_ID   "RIOT_MSC_DISK "
 
#define USBUS_MSC_PRODUCT_REV   " 1.0"
 

USB SCSI Commands

See also
Table 9 - Packet Commands Supported by ATAPI Block Devices from INF-8070i draft published by SFF
#define SCSI_TEST_UNIT_READY   0x00
 SCSI Test Unit Ready.
 
#define SCSI_REQUEST_SENSE   0x03
 SCSI Request Sense.
 
#define SCSI_FORMAT_UNIT   0x04
 SCSI Format Unit.
 
#define SCSI_INQUIRY   0x12
 SCSI Inquiry.
 
#define SCSI_MODE_SELECT6   0x15
 SCSI Mode Select6.
 
#define SCSI_MODE_SENSE6   0x1A
 SCSI Mode Sense6.
 
#define SCSI_START_STOP_UNIT   0x1B
 SCSI Start Stop Unit.
 
#define SCSI_MEDIA_REMOVAL   0x1E
 SCSI Media Removal.
 
#define SCSI_READ_FORMAT_CAPACITIES   0x23
 SCSI Read Format Capacities.
 
#define SCSI_READ_CAPACITY   0x25
 SCSI Read Capacity.
 
#define SCSI_READ10   0x28
 SCSI Read10.
 
#define SCCI_READ12   0xA8
 SCSI Read12.
 
#define SCSI_WRITE10   0x2A
 SCSI Write10.
 
#define SCSI_WRITE12   0xAA
 SCSI Write12.
 
#define SCSI_SEEK   0x2B
 SCSI Seek.
 
#define SCSI_WRITE_AND_VERIFY   0x2E
 SCSI Write and Verify.
 
#define SCSI_VERIFY10   0x2F
 SCSI Verify10.
 
#define SCSI_MODE_SELECT10   0x55
 SCSI Mode Select10.
 
#define SCSI_MODE_SENSE10   0x5A
 SCSI Mode Sense10.
 

USB SCSI Version list

#define SCSI_VERSION_NONE   0x0000
 
#define SCSI_VERSION_SCSI1   0x0001
 
#define SCSI_VERSION_SCSI2   0x0002
 

USB SCSI Read format capacities descriptor type

See also
( msc_read_fmt_capa_pkt_t )
#define SCSI_READ_FMT_CAPA_TYPE_RESERVED   0x00
 
#define SCSI_READ_FMT_CAPA_TYPE_UNFORMATTED   0x01
 
#define SCSI_READ_FMT_CAPA_TYPE_FORMATTED   0x02
 
#define SCSI_READ_FMT_CAPA_TYPE_NO_MEDIA   0x03
 

USB SCSI Request Sense Sense Key type

#define SCSI_SENSE_KEY_NO_SENSE   0x00
 
#define SCSI_SENSE_KEY_RECOVERED_ERROR   0x01
 
#define SCSI_SENSE_KEY_NOT_READY   0x02
 
#define SCSI_SENSE_KEY_MEDIUM_ERROR   0x03
 
#define SCSI_SENSE_KEY_HARDWARE_ERROR   0x04
 
#define SCSI_SENSE_KEY_ILLEGAL_REQUEST   0x05
 
#define SCSI_SENSE_KEY_UNIT_ATTENTION   0x06
 
#define SCSI_SENSE_KEY_DATA_PROTECT   0x07
 
#define SCSI_SENSE_KEY_BLANK_CHECK   0x08
 
#define SCSI_SENSE_KEY_VENDOR_SPECIFIC   0x09
 
#define SCSI_SENSE_KEY_ABORTED_COMMAND   0x0B
 
#define SCSI_SENSE_KEY_VOLUME_OVERFLOW   0x0D
 
#define SCSI_SENSE_KEY_MISCOMPARE   0x0E
 

Function Documentation

◆ scsi_gen_csw()

void scsi_gen_csw ( usbus_handler_t handler,
cbw_info_t cmd 
)

Generate Command Status Wrapper and send it to the host.

Parameters
handlerMSC device struct
cmdstruct containing needed information to generate CBW response

◆ usbus_msc_scsi_process_cmd()

void usbus_msc_scsi_process_cmd ( usbus_t usbus,
usbus_handler_t handler,
usbdev_ep_t ep,
size_t  len 
)

Process incoming Command Block Wrapper buffer.

Parameters
usbusUSBUS thread to use
handlerMSC device struct
epEndpoint pointer to read CBW from
lenSize of the received CBW buffer