change xfer_cb return type from void to bool
This commit is contained in:
parent
15ad585e67
commit
b3e81673c0
|
@ -209,10 +209,11 @@ bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cdch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
|
bool cdch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
|
||||||
{
|
{
|
||||||
(void) ep_addr;
|
(void) ep_addr;
|
||||||
tuh_cdc_xfer_isr( dev_addr, event, 0, xferred_bytes );
|
tuh_cdc_xfer_isr( dev_addr, event, 0, xferred_bytes );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cdch_close(uint8_t dev_addr)
|
void cdch_close(uint8_t dev_addr)
|
||||||
|
|
|
@ -113,7 +113,7 @@ void tuh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_i
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void cdch_init(void);
|
void cdch_init(void);
|
||||||
bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length);
|
bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length);
|
||||||
void cdch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
bool cdch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
||||||
void cdch_close(uint8_t dev_addr);
|
void cdch_close(uint8_t dev_addr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -233,7 +233,7 @@ bool hidh_open_subtask(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t c
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
|
bool hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
|
||||||
{
|
{
|
||||||
(void) xferred_bytes; // TODO may need to use this para later
|
(void) xferred_bytes; // TODO may need to use this para later
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ void hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32
|
||||||
if ( ep_addr == keyboardh_data[dev_addr-1].ep_in )
|
if ( ep_addr == keyboardh_data[dev_addr-1].ep_in )
|
||||||
{
|
{
|
||||||
tuh_hid_keyboard_isr(dev_addr, event);
|
tuh_hid_keyboard_isr(dev_addr, event);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -249,13 +249,15 @@ void hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32
|
||||||
if ( ep_addr == mouseh_data[dev_addr-1].ep_in )
|
if ( ep_addr == mouseh_data[dev_addr-1].ep_in )
|
||||||
{
|
{
|
||||||
tuh_hid_mouse_isr(dev_addr, event);
|
tuh_hid_mouse_isr(dev_addr, event);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CFG_TUSB_HOST_HID_GENERIC
|
#if CFG_TUSB_HOST_HID_GENERIC
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hidh_close(uint8_t dev_addr)
|
void hidh_close(uint8_t dev_addr)
|
||||||
|
|
|
@ -197,7 +197,7 @@ void tuh_hid_generic_isr(uint8_t dev_addr, xfer_result_t event);
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void hidh_init(void);
|
void hidh_init(void);
|
||||||
bool hidh_open_subtask(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length);
|
bool hidh_open_subtask(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length);
|
||||||
void hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
bool hidh_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
||||||
void hidh_close(uint8_t dev_addr);
|
void hidh_close(uint8_t dev_addr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -336,6 +336,7 @@ bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
|
||||||
|
|
||||||
enum { SCSI_XFER_TIMEOUT = 2000 };
|
enum { SCSI_XFER_TIMEOUT = 2000 };
|
||||||
//------------- SCSI Inquiry -------------//
|
//------------- SCSI Inquiry -------------//
|
||||||
|
TU_LOG2("SCSI Inquiry\r\n");
|
||||||
tusbh_msc_inquiry(dev_addr, 0, msch_buffer);
|
tusbh_msc_inquiry(dev_addr, 0, msch_buffer);
|
||||||
TU_ASSERT( osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT) );
|
TU_ASSERT( osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT) );
|
||||||
|
|
||||||
|
@ -343,6 +344,7 @@ bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
|
||||||
memcpy(p_msc->product_id, ((scsi_inquiry_resp_t*) msch_buffer)->product_id, 16);
|
memcpy(p_msc->product_id, ((scsi_inquiry_resp_t*) msch_buffer)->product_id, 16);
|
||||||
|
|
||||||
//------------- SCSI Read Capacity 10 -------------//
|
//------------- SCSI Read Capacity 10 -------------//
|
||||||
|
TU_LOG2("SCSI Read Capacity 10\r\n");
|
||||||
tusbh_msc_read_capacity10(dev_addr, 0, msch_buffer);
|
tusbh_msc_read_capacity10(dev_addr, 0, msch_buffer);
|
||||||
TU_ASSERT( osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT));
|
TU_ASSERT( osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT));
|
||||||
|
|
||||||
|
@ -383,7 +385,7 @@ bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void msch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
|
bool msch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes)
|
||||||
{
|
{
|
||||||
msch_interface_t* p_msc = &msch_data[dev_addr-1];
|
msch_interface_t* p_msc = &msch_data[dev_addr-1];
|
||||||
if ( ep_addr == p_msc->ep_in )
|
if ( ep_addr == p_msc->ep_in )
|
||||||
|
@ -396,6 +398,8 @@ void msch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32
|
||||||
osal_semaphore_post(msch_sem_hdl, true);
|
osal_semaphore_post(msch_sem_hdl, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void msch_close(uint8_t dev_addr)
|
void msch_close(uint8_t dev_addr)
|
||||||
|
|
|
@ -193,7 +193,7 @@ typedef struct
|
||||||
|
|
||||||
void msch_init(void);
|
void msch_init(void);
|
||||||
bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length);
|
bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length);
|
||||||
void msch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
bool msch_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
||||||
void msch_close(uint8_t dev_addr);
|
void msch_close(uint8_t dev_addr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool hub_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf
|
||||||
|
|
||||||
// is the response of interrupt endpoint polling
|
// is the response of interrupt endpoint polling
|
||||||
#include "usbh_hcd.h" // FIXME remove
|
#include "usbh_hcd.h" // FIXME remove
|
||||||
void hub_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
|
bool hub_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
|
||||||
{
|
{
|
||||||
(void) xferred_bytes; // TODO can be more than 1 for hub with lots of ports
|
(void) xferred_bytes; // TODO can be more than 1 for hub with lots of ports
|
||||||
(void) ep_addr;
|
(void) ep_addr;
|
||||||
|
@ -227,6 +227,8 @@ void hub_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32
|
||||||
// TODO [HUB] check if hub is still plugged before polling status endpoint since failed usually mean hub unplugged
|
// TODO [HUB] check if hub is still plugged before polling status endpoint since failed usually mean hub unplugged
|
||||||
// TU_ASSERT ( hub_status_pipe_queue(dev_addr) );
|
// TU_ASSERT ( hub_status_pipe_queue(dev_addr) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hub_close(uint8_t dev_addr)
|
void hub_close(uint8_t dev_addr)
|
||||||
|
|
|
@ -182,7 +182,7 @@ bool hub_status_pipe_queue(uint8_t dev_addr);
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void hub_init(void);
|
void hub_init(void);
|
||||||
bool hub_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length);
|
bool hub_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length);
|
||||||
void hub_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
bool hub_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
|
||||||
void hub_close(uint8_t dev_addr);
|
void hub_close(uint8_t dev_addr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#define DRIVER_NAME(_name)
|
#define DRIVER_NAME(_name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static host_class_driver_t const usbh_class_drivers[] =
|
static usbh_class_driver_t const usbh_class_drivers[] =
|
||||||
{
|
{
|
||||||
#if CFG_TUH_CDC
|
#if CFG_TUH_CDC
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,9 +60,9 @@ typedef struct {
|
||||||
|
|
||||||
void (* const init) (void);
|
void (* const init) (void);
|
||||||
bool (* const open)(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const * itf_desc, uint16_t* outlen);
|
bool (* const open)(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const * itf_desc, uint16_t* outlen);
|
||||||
void (* const xfer_cb) (uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t len);
|
bool (* const xfer_cb) (uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
|
||||||
void (* const close) (uint8_t);
|
void (* const close) (uint8_t);
|
||||||
} host_class_driver_t;
|
} usbh_class_driver_t;
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -107,6 +107,9 @@ bool usbh_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const
|
||||||
|
|
||||||
bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
|
bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
|
||||||
|
|
||||||
|
|
||||||
|
bool tuh_control_xfer (uint8_t dev_addr, tusb_control_request_t const* request, uint8_t* buffer, uint16_t buflen);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue