73typedef enum : uint8_t {
82typedef enum : uint16_t {
96typedef enum : uint8_t {
112typedef enum : uint8_t {
126typedef enum : uint8_t {
137typedef enum : uint8_t {
152typedef enum : uint8_t {
169typedef enum : uint16_t {
448ra8_usb_hmsc_read10(uint8_t target_lun, uint32_t lba, uint16_t block_count, uint8_t* out_buf);
480ra8_usb_hmsc_write10(uint8_t target_lun, uint32_t lba, uint16_t block_count,
const uint8_t* in_buf);
519 uint32_t data_transfer_length,
551 uint32_t expected_tag,
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Native USB controller driver public API (device + host modes).
ra8_usb_speed_t
Selects which controller instance the call targets.
ra8_usb_hmsc_class_t
Class / subclass / protocol triplet that identifies an MSC function within an attached USB device's d...
@ k_ra8_hmsc_protocol_bbb
Bulk-Only Transport.
@ k_ra8_hmsc_class_msc
MSC interface class.
@ k_ra8_hmsc_subclass_scsi
Transparent SCSI subclass.
void(* ra8_usb_hmsc_attach_fn_t)(void *ctx, const ra8_usb_hmsc_device_t *device)
Attach-callback signature.
ra8_err_t ra8_usb_hmsc_inquiry(uint8_t target_lun, ra8_usb_hmsc_inquiry_response_t *response)
Issue a SCSI INQUIRY (opcode 0x12) over BBB.
ra8_usb_hmsc_pipe_t
PIPE numbers used by the host-MSC driver for the attached peripheral's bulk endpoints.
@ k_ra8_hmsc_pipe_bulk_in
PIPE3 -> attached EP bulk IN.
@ k_ra8_hmsc_pipe_bulk_out
PIPE4 -> attached EP bulk OUT.
ra8_err_t ra8_usb_hmsc_read_capacity(uint8_t target_lun, uint32_t *block_count, uint32_t *block_size)
Issue a SCSI READ CAPACITY(10) (opcode 0x25) over BBB.
ra8_err_t ra8_usb_hmsc_build_cbw(uint8_t target_lun, uint32_t data_transfer_length, bool data_in, const uint8_t *cdb, uint8_t cdb_len, uint8_t *out_cbw)
Construct the 31-byte CBW header for the given SCSI command.
ra8_err_t ra8_usb_hmsc_attach_callback(ra8_usb_hmsc_attach_fn_t on_attach, void *ctx)
Register (or detach) the attach callback.
ra8_usb_hmsc_max_lun_t
Compile-time ceiling on the number of logical units the starter tracks per attached device.
@ k_ra8_hmsc_max_lun
Max LUNs the starter tracks.
ra8_err_t ra8_usb_hmsc_read10(uint8_t target_lun, uint32_t lba, uint16_t block_count, uint8_t *out_buf)
Issue a SCSI READ(10) (opcode 0x28) over BBB.
ra8_err_t ra8_usb_hmsc_enumerate(ra8_usb_hmsc_device_t *out_device)
Enumerate the attached MSC device end to end (polled).
ra8_usb_hmsc_csw_status_t
CSW status field values returned by the device after a CBW.
@ k_ra8_hmsc_csw_status_failed
Command failed.
@ k_ra8_hmsc_csw_status_phase_error
BBB phase error – need reset recovery.
@ k_ra8_hmsc_csw_status_passed
Command succeeded.
ra8_err_t ra8_usb_hmsc_close(void)
Tear down the host-MSC driver and release the controller.
ra8_usb_hmsc_packet_t
Packet sizing for the attached device's bulk endpoints.
@ k_ra8_hmsc_bulk_max_packet_fs
Bulk size at full speed.
@ k_ra8_hmsc_bulk_max_packet_hs
Bulk size at high speed.
ra8_usb_hmsc_resp_size_t
Standard SCSI response payload sizes.
@ k_ra8_hmsc_read_capacity_resp_len
READ_CAPACITY(10).
@ k_ra8_hmsc_block_size_default
SCSI default block.
@ k_ra8_hmsc_inquiry_resp_len
INQUIRY response len.
ra8_usb_hmsc_request_t
MSC class-specific request codes the host issues to the attached device.
@ k_ra8_hmsc_req_get_max_lun
1-byte response.
@ k_ra8_hmsc_req_mass_storage_reset
0-byte payload.
ra8_err_t ra8_usb_hmsc_decode_csw(const uint8_t *csw, uint32_t expected_tag, ra8_usb_hmsc_csw_status_t *out_status)
Decode a 13-byte CSW.
ra8_usb_hmsc_scsi_t
SCSI opcodes the host-MSC class issues over BBB.
@ k_ra8_hmsc_scsi_inquiry
INQUIRY.
@ k_ra8_hmsc_scsi_request_sense
REQUEST SENSE.
@ k_ra8_hmsc_scsi_read_10
READ(10).
@ k_ra8_hmsc_scsi_write_10
WRITE(10).
@ k_ra8_hmsc_scsi_read_capacity_10
READ CAPACITY(10).
@ k_ra8_hmsc_scsi_test_unit_ready
TEST UNIT READY.
ra8_err_t ra8_usb_hmsc_init(ra8_usb_speed_t speed)
Bring up the host-MSC driver on a chosen USB controller.
ra8_err_t ra8_usb_hmsc_write10(uint8_t target_lun, uint32_t lba, uint16_t block_count, const uint8_t *in_buf)
Issue a SCSI WRITE(10) (opcode 0x2A) over BBB.
Snapshot of the attached MSC device, passed to the attach callback.
uint8_t interface_number
MSC bInterfaceNumber.
uint16_t vendor_id
idVendor from device descriptor.
uint8_t device_address
Assigned USB address (1..127).
uint8_t max_lun
Get-Max-LUN response (0..15).
uint8_t bulk_in_ep
Attached device's bulk IN EP num.
uint16_t bulk_out_max_packet
Attached bulk-OUT wMaxPacketSize.
uint16_t bulk_in_max_packet
Attached bulk-IN wMaxPacketSize.
uint8_t bulk_out_ep
Attached device's bulk OUT EP num.
uint16_t product_id
idProduct from device descriptor.
Decoded SCSI INQUIRY response.
uint8_t vendor_id[8]
T10 Vendor ID, ASCII.
uint8_t peripheral_device_type
Bits [4:0] of byte 0.
uint8_t version
SPC version code.
uint8_t peripheral_qualifier
Bits [7:5] of byte 0.
uint8_t removable
1 = removable medium.
uint8_t product_id[16]
Product ID, ASCII.
uint8_t product_revision[4]
Product revision, ASCII.