diff --git a/demos/bsp/boards/embedded_artists/board_ea4357.c b/demos/bsp/boards/embedded_artists/board_ea4357.c index f8a22dab6..ff83ca324 100644 --- a/demos/bsp/boards/embedded_artists/board_ea4357.c +++ b/demos/bsp/boards/embedded_artists/board_ea4357.c @@ -59,6 +59,7 @@ void board_init(void) scu_pinmux(0x2, 3, MD_PUP | MD_EZI, FUNC7); // USB0 VBus Power // USB1 Power: EA4357 channel A U20 is enabled by SJ5 connected to pad 1-2, no more action required + // TODO Remove R170, R171, solder a pair of 15K to USB1 D+/D- to test with USB1 Host // TODO Device only USB0 // 1.5Kohm pull-up resistor is needed on the USB DP data signal. GPIO28 (base), P9_5 (LPC4357) controls @@ -66,18 +67,11 @@ void board_init(void) // GPIO_SetDir(5, BIT_(18), 1); // output // GPIO_ClearValue(5, BIT_(18)); - - //------------- I2C (required by LED) -------------// - // init I2C and set up MIC2555 to have 15k pull-down on USB1 D+ & D- + //------------- LED -------------// I2C_Init(LPC_I2C0, 100000); I2C_Cmd(LPC_I2C0, ENABLE); - - //------------- LED -------------// pca9532_init(); -// ASSERT_INT(0x058d, mic255_get_vendorid(), (void) 0); // verify vendor id -// ASSERT( mic255_regs_write(6, BIN8(1100)), (void) 0); // pull down D+/D- for host - #if CFG_UART_ENABLE //------------- UART -------------// scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_TX, MD_PDN, FUNC1); @@ -162,59 +156,4 @@ uint8_t board_uart_getchar(void) // ADC_ChannelCmd(LPC_ADC0, ADC_CH_TRIMPOT, ENABLE); //} -//------------- MIC2555 external OTG transceiver on USB1 -------------// - -// MIC2555 1YML = 0101111, 0YML = 0101101 -//#define MIC255_ADDR BIN8(0101111) - -//static uint8_t mic255_regs_read(uint8_t regs_addr) -//{ -// uint8_t value; -// -// ASSERT( SUCCESS == I2C_MasterTransferData( -// LPC_I2C0, -// & (I2C_M_SETUP_Type) -// { -// .sl_addr7bit = MIC255_ADDR, -// .retransmissions_max = 3, -// -// .tx_data = ®s_addr, -// .tx_length = 1, -// -// .rx_data = &value, -// .rx_length = 1 -// }, -// I2C_TRANSFER_POLLING), 0xFF); -// -// return value; -//} - -//static bool mic255_regs_write(uint8_t regs_addr, uint8_t data) -//{ -// uint8_t xfer_data[2] = { regs_addr, data} ; -// -// ASSERT( SUCCESS == I2C_MasterTransferData( -// LPC_I2C0, -// & (I2C_M_SETUP_Type) -// { -// .sl_addr7bit = MIC255_ADDR, -// .retransmissions_max = 3, -// -// .tx_data = xfer_data, -// .tx_length = 2, -// }, -// I2C_TRANSFER_POLLING), false); -// -// return true; -//} - - -//static uint16_t mic255_get_vendorid(void) -//{ -// uint8_t vendor_low = mic255_regs_read(0); -// uint8_t vendor_high = mic255_regs_read(1); -// -// return (vendor_high << 8) | vendor_low; -//} - #endif diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c index 6dfc711a2..33a071274 100644 --- a/demos/bsp/boards/printf_retarget.c +++ b/demos/bsp/boards/printf_retarget.c @@ -106,6 +106,7 @@ int __sys_readc (void) #if CFG_PRINTF_TARGET == PRINTF_TARGET_UART #define retarget_putc(c) board_uart_send( (uint8_t*) &c, 1); #elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO + volatile int32_t ITM_RxBuffer; #define retarget_putc(c) ITM_SendChar(c) #endif diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt index f2360c641..a95989020 100644 --- a/demos/host/host_os_none/host_os_none.uvopt +++ b/demos/host/host_os_none/host_os_none.uvopt @@ -135,7 +135,7 @@ 0 DLGUARM - + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) 0 @@ -158,24 +158,7 @@ -O975 -S0 -C0 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000) - - - 0 - 0 - 353 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - C:\Users\hathach\Dropbox\tinyusb\workspace\tinyusb\demos\host\src\cli.c - - -
-
+ 0 @@ -387,24 +370,7 @@ -O975 -S0 -C0 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000) - - - 0 - 0 - 353 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - C:\Users\hathach\Dropbox\tinyusb\workspace\tinyusb\demos\host\src\cli.c - - -
-
+ 0 @@ -458,10 +424,10 @@ 1 0 0 - 0 + 17 0 - 1 - 1 + 94 + 111 0 ..\src\main.c main.c @@ -476,7 +442,7 @@ 0 0 0 - 125 + 92 145 0 ..\src\cdc_serial_app.c @@ -492,8 +458,8 @@ 0 0 0 - 167 - 180 + 111 + 123 0 ..\src\keyboard_app.c keyboard_app.c @@ -508,7 +474,7 @@ 0 44 0 - 124 + 118 127 0 ..\src\mouse_app.c @@ -538,10 +504,10 @@ 1 0 0 - 27 + 1 0 - 1 - 8 + 121 + 150 0 ..\src\msc_app.c msc_app.c @@ -556,7 +522,7 @@ 0 18 0 - 4 + 8 11 0 ..\src\cli.c @@ -594,10 +560,10 @@ 1 0 0 - 0 + 78 0 - 141 - 142 + 27 + 31 0 ..\..\bsp\boards\embedded_artists\board_ea4357.c board_ea4357.c @@ -612,7 +578,7 @@ 0 6 0 - 126 + 93 135 0 ..\..\bsp\boards\printf_retarget.c @@ -746,10 +712,10 @@ 1 0 0 - 0 + 64 0 - 56 - 76 + 23 + 33 0 ..\..\..\tinyusb\tusb.c tusb.c @@ -810,10 +776,10 @@ 1 0 0 - 0 + 61 0 - 494 - 501 + 430 + 518 0 ..\..\..\tinyusb\host\usbh.c usbh.c @@ -826,10 +792,10 @@ 1 0 0 - 38 + 0 0 - 482 - 484 + 1 + 5 0 ..\..\..\tinyusb\host\ehci\ehci.c ehci.c @@ -973,7 +939,7 @@ 0 0 1 - 1 + 12 0 ..\..\..\tinyusb\class\hid_host.c hid_host.c @@ -986,10 +952,10 @@ 1 0 0 - 1 + 22 0 - 113 - 118 + 59 + 64 0 ..\..\..\tinyusb\class\msc_host.c msc_host.c @@ -1090,10 +1056,10 @@ 1 0 0 - 0 + 7 0 - 0 - 0 + 777 + 782 0 ..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_i2c.c lpc43xx_i2c.c @@ -1114,10 +1080,10 @@ 2 0 0 - 22 + 54 0 - 148 - 151 + 139 + 148 0 ..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s startup_LPC43xx.s @@ -1138,10 +1104,10 @@ 1 0 0 - 0 + 20 0 - 1 - 1 + 49 + 62 0 ..\..\..\vendor\fatfs\diskio.c diskio.c diff --git a/demos/host/src/cli.c b/demos/host/src/cli.c index adfdac56f..80fe9f7ef 100644 --- a/demos/host/src/cli.c +++ b/demos/host/src/cli.c @@ -161,6 +161,7 @@ void cli_init(void) { memclr_(cli_buffer, CLI_MAX_BUFFER); f_getlabel(NULL, volume_label, NULL); + cli_command_prompt(); } void cli_poll(char ch) diff --git a/demos/host/src/main.c b/demos/host/src/main.c index 6f33cc49c..44a4ea0e0 100644 --- a/demos/host/src/main.c +++ b/demos/host/src/main.c @@ -116,7 +116,6 @@ void os_none_start_scheduler(void) } } #endif -volatile int32_t ITM_RxBuffer; int main(void) { diff --git a/demos/host/src/msc_app.c b/demos/host/src/msc_app.c index efb552ada..0f37842e0 100644 --- a/demos/host/src/msc_app.c +++ b/demos/host/src/msc_app.c @@ -106,7 +106,6 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr) f_chdir("/"); // root as current dir cli_init(); - cli_command_prompt(); } } diff --git a/demos/host/src/tusb_config.h b/demos/host/src/tusb_config.h index 1913b7272..711802fab 100644 --- a/demos/host/src/tusb_config.h +++ b/demos/host/src/tusb_config.h @@ -73,8 +73,8 @@ //------------- CLASS -------------// #define TUSB_CFG_HOST_HUB 0 -#define TUSB_CFG_HOST_HID_KEYBOARD 0 -#define TUSB_CFG_HOST_HID_MOUSE 0 +#define TUSB_CFG_HOST_HID_KEYBOARD 1 +#define TUSB_CFG_HOST_HID_MOUSE 1 #define TUSB_CFG_HOST_HID_GENERIC 0 #define TUSB_CFG_HOST_MSC 1 #define TUSB_CFG_HOST_CDC 0 @@ -96,7 +96,7 @@ // COMMON CONFIGURATION //--------------------------------------------------------------------+ -#define TUSB_CFG_DEBUG 2 +#define TUSB_CFG_DEBUG 3 //#define TUSB_CFG_OS TUSB_OS_NONE // defined using eclipse build //#define TUSB_CFG_OS_TASK_PRIO diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c index f5f4a0d76..74d6751ba 100644 --- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c +++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c @@ -280,10 +280,8 @@ void test_control_xfer_error_stall(void) TEST_ASSERT_TRUE( p_control_qhd->qtd_overlay.alternate.terminate); TEST_ASSERT_FALSE( p_control_qhd->qtd_overlay.halted); - #if 0 // no neeed TEST_ASSERT_FALSE( p_setup->used ); TEST_ASSERT_FALSE( p_data->used ); TEST_ASSERT_FALSE( p_status->used ); - #endif } diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index 3c550cd3e..7d8d1b047 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -84,7 +84,7 @@ enum { HID_REQUEST_CONTROL_SET_PROTOCOL = 0x0b }; -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength; /**< Numeric expression that is the total size of the HID descriptor */ uint8_t bDescriptorType; /**< Constant name specifying type of HID descriptor. */ diff --git a/tinyusb/class/msc_host.c b/tinyusb/class/msc_host.c index 25518a757..26beeae13 100644 --- a/tinyusb/class/msc_host.c +++ b/tinyusb/class/msc_host.c @@ -74,19 +74,33 @@ bool tusbh_msc_is_mounted(uint8_t dev_addr) msch_data[dev_addr-1].is_initialized; } +bool tusbh_msc_is_busy(uint8_t dev_addr) +{ + return msch_data[dev_addr-1].is_initialized && + hcd_pipe_is_busy(msch_data[dev_addr-1].bulk_in); +} + +bool tusbh_msc_is_failed(uint8_t dev_addr) +{ + return msch_data[dev_addr-1].is_initialized && + hcd_pipe_is_error(msch_data[dev_addr-1].bulk_in); +} + +// TODO tusbh_msc_is_stalled + uint8_t const* tusbh_msc_get_vendor_name(uint8_t dev_addr) { - return tusbh_msc_is_mounted(dev_addr) ? msch_data[dev_addr-1].vendor_id : NULL; + return msch_data[dev_addr-1].is_initialized ? msch_data[dev_addr-1].vendor_id : NULL; } uint8_t const* tusbh_msc_get_product_name(uint8_t dev_addr) { - return tusbh_msc_is_mounted(dev_addr) ? msch_data[dev_addr-1].product_id : NULL; + return msch_data[dev_addr-1].is_initialized ? msch_data[dev_addr-1].product_id : NULL; } tusb_error_t tusbh_msc_get_capacity(uint8_t dev_addr, uint32_t* p_last_lba, uint32_t* p_block_size) { - if ( !tusbh_msc_is_mounted(dev_addr) ) return TUSB_ERROR_MSCH_DEVICE_NOT_MOUNTED; + if ( !msch_data[dev_addr-1].is_initialized ) return TUSB_ERROR_MSCH_DEVICE_NOT_MOUNTED; ASSERT(p_last_lba != NULL && p_block_size != NULL, TUSB_ERROR_INVALID_PARA); (*p_last_lba) = msch_data[dev_addr-1].last_lba; @@ -95,16 +109,6 @@ tusb_error_t tusbh_msc_get_capacity(uint8_t dev_addr, uint32_t* p_last_lba, uint return TUSB_ERROR_NONE; } -tusb_interface_status_t tusbh_msc_status(uint8_t dev_addr) -{ - if ( !tusbh_msc_is_mounted(dev_addr) ) return TUSB_INTERFACE_STATUS_INVALID_PARA; - - if ( hcd_pipe_is_busy(msch_data[dev_addr-1].bulk_in) ) return TUSB_INTERFACE_STATUS_BUSY; - if ( hcd_pipe_is_stalled(msch_data[dev_addr-1].bulk_in) ) return TUSB_INTERFACE_STATUS_ERROR; - - return TUSB_INTERFACE_STATUS_READY; -} - static inline void msc_cbw_add_signature(msc_cmd_block_wrapper_t *p_cbw, uint8_t lun) ATTR_ALWAYS_INLINE; static inline void msc_cbw_add_signature(msc_cmd_block_wrapper_t *p_cbw, uint8_t lun) { diff --git a/tinyusb/class/msc_host.h b/tinyusb/class/msc_host.h index b51b9f515..83409f859 100644 --- a/tinyusb/class/msc_host.h +++ b/tinyusb/class/msc_host.h @@ -59,7 +59,9 @@ // MASS STORAGE Application API //--------------------------------------------------------------------+ bool tusbh_msc_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT; -tusb_interface_status_t tusbh_msc_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT; +bool tusbh_msc_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT; +bool tusbh_msc_is_failed(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT; + uint8_t const* tusbh_msc_get_vendor_name(uint8_t dev_addr); uint8_t const* tusbh_msc_get_product_name(uint8_t dev_addr); tusb_error_t tusbh_msc_get_capacity(uint8_t dev_addr, uint32_t* p_last_lba, uint32_t* p_block_size); @@ -95,7 +97,7 @@ typedef struct { uint16_t block_size; uint32_t last_lba; // last logical block address - bool is_initialized; + volatile bool is_initialized; uint8_t vendor_id[8]; uint8_t product_id[16]; diff --git a/tinyusb/core/std_descriptors.h b/tinyusb/core/std_descriptors.h index 249d31491..0d0d3ef27 100644 --- a/tinyusb/core/std_descriptors.h +++ b/tinyusb/core/std_descriptors.h @@ -61,7 +61,7 @@ // STANDARD DESCRIPTORS //--------------------------------------------------------------------+ /// USB Standard Device Descriptor (section 9.6.1, table 9-8) -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of this descriptor in bytes. uint8_t bDescriptorType ; ///< DEVICE Descriptor Type. uint16_t bcdUSB ; ///< BUSB Specification Release Number in Binary-Coded Decimal (i.e., 2.10 is 210H). This field identifies the release of the USB Specification with which the device and its descriptors are compliant. @@ -82,7 +82,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { } tusb_descriptor_device_t; /// USB Standard Configuration Descriptor (section 9.6.1 table 9-10) */ -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of this descriptor in bytes uint8_t bDescriptorType ; ///< CONFIGURATION Descriptor Type uint16_t wTotalLength ; ///< Total length of data returned for this configuration. Includes the combined length of all descriptors (configuration, interface, endpoint, and class- or vendor-specific) returned for this configuration. @@ -95,7 +95,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { } tusb_descriptor_configuration_t; /// USB Standard Interface Descriptor (section 9.6.1 table 9-12) -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of this descriptor in bytes uint8_t bDescriptorType ; ///< INTERFACE Descriptor Type @@ -109,13 +109,13 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { } tusb_descriptor_interface_t; /// USB Standard Endpoint Descriptor (section 9.6.1 table 9-13) -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of this descriptor in bytes uint8_t bDescriptorType ; ///< ENDPOINT Descriptor Type uint8_t bEndpointAddress ; ///< The address of the endpoint on the USB device described by this descriptor. The address is encoded as follows: \n Bit 3...0: The endpoint number \n Bit 6...4: Reserved, reset to zero \n Bit 7: Direction, ignored for control endpoints 0 = OUT endpoint 1 = IN endpoint. - ATTR_PREPACKED struct ATTR_PACKED { + ATTR_PACKED_STRUCT(struct) { uint8_t xfer : 2; uint8_t sync : 2; uint8_t usage : 2; @@ -132,7 +132,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { } tusb_descriptor_endpoint_t; /// USB Other Speed Configuration Descriptor (section 9.6.1 table 9-11) -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of descriptor uint8_t bDescriptorType ; ///< Other_speed_Configuration Type uint16_t wTotalLength ; ///< Total length of data returned @@ -145,7 +145,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { } tusb_descriptor_other_speed_t; /// USB Device Qualifier Descriptor (section 9.6.1 table 9-9) -typedef ATTR_PREPACKED struct ATTR_PACKED { +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of descriptor uint8_t bDescriptorType ; ///< Device Qualifier Type uint16_t bcdUSB ; ///< USB specification version number (e.g., 0200H for V2.00) @@ -159,7 +159,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { } tusb_descriptor_device_qualifier_t; /// USB Interface Association Descriptor (IAD ECN) -typedef ATTR_PREPACKED struct ATTR_PACKED +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of descriptor uint8_t bDescriptorType ; ///< Other_speed_Configuration Type @@ -175,7 +175,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED } tusb_descriptor_interface_association_t; /// USB Header Descriptor -typedef ATTR_PREPACKED struct ATTR_PACKED +typedef ATTR_PACKED_STRUCT(struct) { uint8_t bLength ; ///< Size of this descriptor in bytes uint8_t bDescriptorType ; ///< Descriptor Type diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index 684051917..f3fe6614c 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -430,7 +430,7 @@ tusb_error_t hcd_pipe_queue_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) { - hcd_pipe_queue_xfer(pipe_hdl, buffer, total_bytes); + ASSERT_STATUS ( hcd_pipe_queue_xfer(pipe_hdl, buffer, total_bytes) ); ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(pipe_hdl); @@ -481,8 +481,14 @@ bool hcd_pipe_is_busy(pipe_handle_t pipe_hdl) return !p_qhd->qtd_overlay.halted && (p_qhd->p_qtd_list_head != NULL); } -bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl) +bool hcd_pipe_is_error(pipe_handle_t pipe_hdl) { + ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle( pipe_hdl ); + return p_qhd->qtd_overlay.halted; +} + +bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl) +{ // TODO to be remove ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle( pipe_hdl ); return (p_qhd->p_qtd_list_head == NULL); } @@ -679,13 +685,11 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd) p_qhd->qtd_overlay.alternate.terminate = 1; p_qhd->qtd_overlay.halted = 0; - #if 0 // no need to mark control qtds as not used - ehci_qtd_t *p_setup = get_control_qtds(dev_addr); + ehci_qtd_t *p_setup = get_control_qtds(p_qhd->device_address); ehci_qtd_t *p_data = p_setup + 1; ehci_qtd_t *p_status = p_setup + 2; - p_setup->used = p_data->used = p_status = 0; - #endif + p_setup->used = p_data->used = p_status->used = 0; } // call USBH callback diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h index ec4b40302..ea1d6bdf6 100644 --- a/tinyusb/host/ehci/ehci.h +++ b/tinyusb/host/ehci/ehci.h @@ -126,9 +126,9 @@ typedef struct { union{ ehci_link_t alternate; struct { - uint32_t : 5; - uint32_t used : 1; - uint32_t : 10; + uint32_t : 5; + uint32_t used : 1; + uint32_t : 10; uint32_t expected_bytes : 16; }; }; @@ -203,8 +203,8 @@ typedef struct { uint8_t interval_ms; // polling interval in frames (or milisecond) uint8_t reserved; - ehci_qtd_t *p_qtd_list_head; // head of the scheduled TD list - ehci_qtd_t *p_qtd_list_tail; // tail of the scheduled TD list + ehci_qtd_t * volatile p_qtd_list_head; // head of the scheduled TD list + ehci_qtd_t * volatile p_qtd_list_tail; // tail of the scheduled TD list }ATTR_ALIGNED(32) ehci_qhd_t; /// Highspeed Isochronous Transfer Descriptor (section 3.3) diff --git a/vendor/fatfs/diskio.c b/vendor/fatfs/diskio.c index 3b73a79c5..a3c1d8fee 100644 --- a/vendor/fatfs/diskio.c +++ b/vendor/fatfs/diskio.c @@ -56,14 +56,14 @@ //--------------------------------------------------------------------+ // IMPLEMENTATION //--------------------------------------------------------------------+ -static tusb_error_t wait_for_io_complete(uint8_t usb_addr) +static DRESULT wait_for_io_complete(uint8_t usb_addr) { #if TUSB_CFG_OS == TUSB_OS_NONE - while ( tusbh_msc_status(usb_addr) == TUSB_INTERFACE_STATUS_BUSY ) + while ( tusbh_msc_is_busy(usb_addr) ) { // timeout here } - return tusbh_msc_status(usb_addr) == TUSB_INTERFACE_STATUS_READY ? RES_OK : RES_ERROR; + return tusbh_msc_is_failed(usb_addr) ? RES_ERROR : RES_OK; #else #error semaphore instead of blocking #endif