host msc: call read_capacity as part of enumeration

- add tuh_msc_get_block_count(), tuh_msc_get_block_size()
- rename tuh_msc_mounted_cb/tuh_msc_unmounted_cb to
tuh_msc_mount_cb/tuh_msc_unmount_cb to match device stack naming
- change tuh_msc_is_busy() to tuh_msc_ready()
- add CFG_TUH_MSC_MAXLUN (default to 4) to hold lun capacities
- add host msc configured to for state check.
This commit is contained in:
hathach
2021-02-23 19:41:11 +07:00
parent 386a386345
commit 5108d76136
5 changed files with 125 additions and 93 deletions

View File

@@ -48,7 +48,7 @@ static DSTATUS disk_state[CFG_TUSB_HOST_DEVICE_MAX];
static DRESULT wait_for_io_complete(uint8_t usb_addr)
{
// TODO with RTOS, this should use semaphore instead of blocking
while ( tuh_msc_is_busy(usb_addr) )
while ( !tuh_msc_ready(usb_addr) )
{
// TODO should have timeout here
#if CFG_TUSB_OS != OPT_OS_NONE