Open FFBoard
Open source force feedback firmware
msc_host.c File Reference

Go to the source code of this file.

Classes

struct  msch_interface_t
 

Enumerations

enum  { MSC_STAGE_IDLE = 0 , MSC_STAGE_CMD , MSC_STAGE_DATA , MSC_STAGE_STATUS }
 

Functions

static TU_ATTR_ALWAYS_INLINE msch_interface_tget_itf (uint8_t dev_addr)
 
uint8_t tuh_msc_get_maxlun (uint8_t dev_addr)
 
uint32_t tuh_msc_get_block_count (uint8_t dev_addr, uint8_t lun)
 
uint32_t tuh_msc_get_block_size (uint8_t dev_addr, uint8_t lun)
 
bool tuh_msc_mounted (uint8_t dev_addr)
 
bool tuh_msc_ready (uint8_t dev_addr)
 
static void cbw_init (msc_cbw_t *cbw, uint8_t lun)
 
bool tuh_msc_scsi_command (uint8_t daddr, msc_cbw_t const *cbw, void *data, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_read_capacity (uint8_t dev_addr, uint8_t lun, scsi_read_capacity10_resp_t *response, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_inquiry (uint8_t dev_addr, uint8_t lun, scsi_inquiry_resp_t *response, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_test_unit_ready (uint8_t dev_addr, uint8_t lun, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_request_sense (uint8_t dev_addr, uint8_t lun, void *response, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_read10 (uint8_t dev_addr, uint8_t lun, void *buffer, uint32_t lba, uint16_t block_count, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_write10 (uint8_t dev_addr, uint8_t lun, void const *buffer, uint32_t lba, uint16_t block_count, tuh_msc_complete_cb_t complete_cb, uintptr_t arg)
 
bool tuh_msc_reset (uint8_t dev_addr)
 
bool msch_init (void)
 
bool msch_deinit (void)
 
void msch_close (uint8_t dev_addr)
 
bool msch_xfer_cb (uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
 
static void config_get_maxlun_complete (tuh_xfer_t *xfer)
 
static bool config_test_unit_ready_complete (uint8_t dev_addr, tuh_msc_complete_data_t const *cb_data)
 
static bool config_request_sense_complete (uint8_t dev_addr, tuh_msc_complete_data_t const *cb_data)
 
static bool config_read_capacity_complete (uint8_t dev_addr, tuh_msc_complete_data_t const *cb_data)
 
bool msch_open (uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *desc_itf, uint16_t max_len)
 
bool msch_set_config (uint8_t dev_addr, uint8_t itf_num)
 

Variables

static CFG_TUH_MEM_SECTION msch_interface_t _msch_itf [CFG_TUH_DEVICE_MAX]
 
CFG_TUH_MEM_SECTION static CFG_TUH_MEM_ALIGN uint8_t _msch_buffer [sizeof(scsi_inquiry_resp_t)]
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MSC_STAGE_IDLE 
MSC_STAGE_CMD 
MSC_STAGE_DATA 
MSC_STAGE_STATUS 

Definition at line 46 of file msc_host.c.

Function Documentation

◆ cbw_init()

static void cbw_init ( msc_cbw_t cbw,
uint8_t  lun 
)
inlinestatic

Definition at line 122 of file msc_host.c.

◆ config_get_maxlun_complete()

static void config_get_maxlun_complete ( tuh_xfer_t xfer)
static

Definition at line 435 of file msc_host.c.

◆ config_read_capacity_complete()

static bool config_read_capacity_complete ( uint8_t  dev_addr,
tuh_msc_complete_data_t const *  cb_data 
)
static

Definition at line 480 of file msc_host.c.

◆ config_request_sense_complete()

static bool config_request_sense_complete ( uint8_t  dev_addr,
tuh_msc_complete_data_t const *  cb_data 
)
static

Definition at line 471 of file msc_host.c.

◆ config_test_unit_ready_complete()

static bool config_test_unit_ready_complete ( uint8_t  dev_addr,
tuh_msc_complete_data_t const *  cb_data 
)
static

Definition at line 451 of file msc_host.c.

◆ get_itf()

static TU_ATTR_ALWAYS_INLINE msch_interface_t * get_itf ( uint8_t  dev_addr)
inlinestatic

Definition at line 87 of file msc_host.c.

◆ msch_close()

void msch_close ( uint8_t  dev_addr)

Definition at line 297 of file msc_host.c.

◆ msch_deinit()

bool msch_deinit ( void  )

Definition at line 293 of file msc_host.c.

◆ msch_init()

bool msch_init ( void  )

Definition at line 287 of file msc_host.c.

◆ msch_open()

bool msch_open ( uint8_t  rhport,
uint8_t  dev_addr,
tusb_desc_interface_t const *  desc_itf,
uint16_t  max_len 
)

Definition at line 371 of file msc_host.c.

◆ msch_set_config()

bool msch_set_config ( uint8_t  dev_addr,
uint8_t  itf_num 
)

Definition at line 402 of file msc_host.c.

◆ msch_xfer_cb()

bool msch_xfer_cb ( uint8_t  dev_addr,
uint8_t  ep_addr,
xfer_result_t  event,
uint32_t  xferred_bytes 
)

Definition at line 312 of file msc_host.c.

◆ tuh_msc_get_block_count()

uint32_t tuh_msc_get_block_count ( uint8_t  dev_addr,
uint8_t  lun 
)

Definition at line 99 of file msc_host.c.

◆ tuh_msc_get_block_size()

uint32_t tuh_msc_get_block_size ( uint8_t  dev_addr,
uint8_t  lun 
)

Definition at line 104 of file msc_host.c.

◆ tuh_msc_get_maxlun()

uint8_t tuh_msc_get_maxlun ( uint8_t  dev_addr)

Definition at line 94 of file msc_host.c.

◆ tuh_msc_inquiry()

bool tuh_msc_inquiry ( uint8_t  dev_addr,
uint8_t  lun,
scsi_inquiry_resp_t response,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 167 of file msc_host.c.

◆ tuh_msc_mounted()

bool tuh_msc_mounted ( uint8_t  dev_addr)

Definition at line 109 of file msc_host.c.

◆ tuh_msc_read10()

bool tuh_msc_read10 ( uint8_t  dev_addr,
uint8_t  lun,
void *  buffer,
uint32_t  lba,
uint16_t  block_count,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 222 of file msc_host.c.

◆ tuh_msc_read_capacity()

bool tuh_msc_read_capacity ( uint8_t  dev_addr,
uint8_t  lun,
scsi_read_capacity10_resp_t response,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 151 of file msc_host.c.

◆ tuh_msc_ready()

bool tuh_msc_ready ( uint8_t  dev_addr)

Definition at line 114 of file msc_host.c.

◆ tuh_msc_request_sense()

bool tuh_msc_request_sense ( uint8_t  dev_addr,
uint8_t  lun,
void *  response,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 204 of file msc_host.c.

◆ tuh_msc_reset()

bool tuh_msc_reset ( uint8_t  dev_addr)

Definition at line 268 of file msc_host.c.

◆ tuh_msc_scsi_command()

bool tuh_msc_scsi_command ( uint8_t  daddr,
msc_cbw_t const *  cbw,
void *  data,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 129 of file msc_host.c.

◆ tuh_msc_test_unit_ready()

bool tuh_msc_test_unit_ready ( uint8_t  dev_addr,
uint8_t  lun,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 188 of file msc_host.c.

◆ tuh_msc_write10()

bool tuh_msc_write10 ( uint8_t  dev_addr,
uint8_t  lun,
void const *  buffer,
uint32_t  lba,
uint16_t  block_count,
tuh_msc_complete_cb_t  complete_cb,
uintptr_t  arg 
)

Definition at line 244 of file msc_host.c.

Variable Documentation

◆ _msch_buffer

CFG_TUH_MEM_SECTION static CFG_TUH_MEM_ALIGN uint8_t _msch_buffer[sizeof(scsi_inquiry_resp_t)]
static

Definition at line 83 of file msc_host.c.

◆ _msch_itf

CFG_TUH_MEM_SECTION msch_interface_t _msch_itf[CFG_TUH_DEVICE_MAX]
static

Definition at line 78 of file msc_host.c.