mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-28 16:20:26 +00:00
resolve conflict between usbh & hcd
This commit is contained in:
parent
4f3b76caba
commit
0a13e37ba2
@ -40,6 +40,7 @@
|
|||||||
#include "usbh.h"
|
#include "usbh.h"
|
||||||
#include "mock_osal.h"
|
#include "mock_osal.h"
|
||||||
#include "mock_hcd.h"
|
#include "mock_hcd.h"
|
||||||
|
#include "mock_usbh_hcd.h"
|
||||||
|
|
||||||
extern usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX];
|
extern usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX];
|
||||||
tusb_handle_device_t dev_hdl;
|
tusb_handle_device_t dev_hdl;
|
||||||
@ -181,7 +182,7 @@ void test_enum_task_connect(void)
|
|||||||
osal_queue_receive_StubWithCallback(queue_recv_stub);
|
osal_queue_receive_StubWithCallback(queue_recv_stub);
|
||||||
hcd_port_connect_status_ExpectAndReturn(enum_connect.core_id, true);
|
hcd_port_connect_status_ExpectAndReturn(enum_connect.core_id, true);
|
||||||
hcd_port_speed_ExpectAndReturn(enum_connect.core_id, TUSB_SPEED_FULL);
|
hcd_port_speed_ExpectAndReturn(enum_connect.core_id, TUSB_SPEED_FULL);
|
||||||
hcd_pipe_addr0_open_IgnoreAndReturn(pipe_addr0);
|
hcd_addr0_open_IgnoreAndReturn(pipe_addr0);
|
||||||
|
|
||||||
hcd_pipe_control_xfer_StubWithCallback(pipe_control_stub);
|
hcd_pipe_control_xfer_StubWithCallback(pipe_control_stub);
|
||||||
// hcd_pipe_control_open_ExpectAnd(1, );
|
// hcd_pipe_control_open_ExpectAnd(1, );
|
||||||
|
@ -56,12 +56,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "usbh_hcd.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
typedef uint32_t pipe_handle_t;
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -72,7 +71,6 @@ tusb_error_t hcd_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// PIPE API
|
// PIPE API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
pipe_handle_t hcd_pipe_addr0_open(usbh_device_addr0_t const * dev_addr0);
|
|
||||||
pipe_handle_t hcd_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size);
|
pipe_handle_t hcd_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size);
|
||||||
tusb_error_t hcd_pipe_control_xfer(pipe_handle_t pipe_hdl, tusb_std_request_t const * p_request, uint8_t data[]);
|
tusb_error_t hcd_pipe_control_xfer(pipe_handle_t pipe_hdl, tusb_std_request_t const * p_request, uint8_t data[]);
|
||||||
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc);
|
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc);
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "usbh.h"
|
|
||||||
#include "osal/osal.h"
|
#include "osal/osal.h"
|
||||||
|
#include "usbh_hcd.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
@ -105,9 +105,9 @@ void usbh_enumeration_task(void)
|
|||||||
.wLength = 8
|
.wLength = 8
|
||||||
};
|
};
|
||||||
device_addr0.speed = hcd_port_speed(device_addr0.enum_entry.core_id);
|
device_addr0.speed = hcd_port_speed(device_addr0.enum_entry.core_id);
|
||||||
pipe_handle_t pipe_addr0 = hcd_pipe_addr0_open(&device_addr0);
|
pipe_handle_t pipe_addr0 = hcd_addr0_open(&device_addr0);
|
||||||
|
|
||||||
// hcd_pipe_control_xfer(pipe_addr0, &request_dev_desc)
|
// hcd_pipe_control_xfer(pipe_addr0, &request_dev_desc, )
|
||||||
}else // device connect via a hub
|
}else // device connect via a hub
|
||||||
{
|
{
|
||||||
ASSERT_MESSAGE("%s", "Hub is not supported yet");
|
ASSERT_MESSAGE("%s", "Hub is not supported yet");
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "usbh_hcd.h"
|
|
||||||
#include "hcd.h"
|
#include "hcd.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -117,6 +116,7 @@ typedef enum {
|
|||||||
|
|
||||||
typedef uint32_t tusbh_flag_class_t;
|
typedef uint32_t tusbh_flag_class_t;
|
||||||
typedef uint32_t tusb_handle_device_t;
|
typedef uint32_t tusb_handle_device_t;
|
||||||
|
typedef uint8_t tusbh_device_status_t;
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||||
|
@ -59,13 +59,12 @@
|
|||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
|
#include "hcd.h"
|
||||||
|
#include "usbh.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// USBH
|
// USBH
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
typedef uint8_t tusbh_device_status_t;
|
|
||||||
typedef uint32_t pipe_handle_t;
|
|
||||||
|
|
||||||
typedef struct ATTR_ALIGNED(4){
|
typedef struct ATTR_ALIGNED(4){
|
||||||
uint8_t core_id;
|
uint8_t core_id;
|
||||||
uint8_t hub_addr;
|
uint8_t hub_addr;
|
||||||
@ -77,6 +76,7 @@ typedef struct {
|
|||||||
usbh_enumerate_t enum_entry;
|
usbh_enumerate_t enum_entry;
|
||||||
tusb_speed_t speed;
|
tusb_speed_t speed;
|
||||||
tusb_std_request_t request_packet; // needed to be on USB RAM
|
tusb_std_request_t request_packet; // needed to be on USB RAM
|
||||||
|
uint8_t dev_desc[8];
|
||||||
} usbh_device_addr0_t;
|
} usbh_device_addr0_t;
|
||||||
|
|
||||||
typedef struct { // TODO internal structure, re-order members
|
typedef struct { // TODO internal structure, re-order members
|
||||||
@ -90,6 +90,7 @@ typedef struct { // TODO internal structure, re-order members
|
|||||||
uint8_t configure_count;
|
uint8_t configure_count;
|
||||||
|
|
||||||
tusbh_device_status_t status;
|
tusbh_device_status_t status;
|
||||||
|
|
||||||
pipe_handle_t pipe_control;
|
pipe_handle_t pipe_control;
|
||||||
tusb_std_request_t request_control;
|
tusb_std_request_t request_control;
|
||||||
|
|
||||||
@ -103,12 +104,11 @@ typedef struct { // TODO internal structure, re-order members
|
|||||||
} usbh_device_info_t;
|
} usbh_device_info_t;
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// HCD
|
// ADDRESS 0 API
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// IMPLEMENTATION
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
pipe_handle_t hcd_addr0_open(usbh_device_addr0_t *dev_addr0);
|
||||||
|
tusb_error_t hcd_addr0_get_dev_desc(usbh_device_addr0_t *dev_addr0);
|
||||||
|
tusb_error_t hcd_addr0_set_addr(usbh_device_addr0_t *dev_addr0, uint8_t new_addr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user