diff options
| author | hathach <[email protected]> | 2013-01-29 11:06:30 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-01-29 11:06:30 +0700 |
| commit | 6db8af20236cfecba5aef54da148309982b28396 (patch) | |
| tree | 7ab84b2947702c8860d799b1e4234d6af37e8609 /tinyusb | |
| parent | 06f923c7bb95e146ee545194eba1c9357c4baf45 (diff) | |
update usbh_init and test
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/common/errors.h | 1 | ||||
| -rw-r--r-- | tinyusb/host/usbd_host.c | 18 | ||||
| -rw-r--r-- | tinyusb/host/usbd_host.h | 10 | ||||
| -rw-r--r-- | tinyusb/osal/osal.h | 4 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 2 |
5 files changed, 23 insertions, 12 deletions
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h index b96bb5997..a39e99b27 100644 --- a/tinyusb/common/errors.h +++ b/tinyusb/common/errors.h @@ -66,6 +66,7 @@ ENTRY(TUSB_ERROR_CLASS_DEVICE_DONT_SUPPORT)\ ENTRY(TUSB_ERROR_CLASS_DATA_NOT_AVAILABLE)\ ENTRY(TUSB_ERROR_OSAL_TIMEOUT)\ + ENTRY(TUSB_ERROR_OSAL_QUEUE_FAILED)\ ENTRY(TUSB_ERROR_FAILED)\ diff --git a/tinyusb/host/usbd_host.c b/tinyusb/host/usbd_host.c index adf741548..134bdc038 100644 --- a/tinyusb/host/usbd_host.c +++ b/tinyusb/host/usbd_host.c @@ -46,6 +46,7 @@ //--------------------------------------------------------------------+ #include "common/common.h" #include "usbd_host.h" +#include "osal/osal.h" //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF @@ -57,6 +58,10 @@ //--------------------------------------------------------------------+ STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX]; +#define ENUM_DEPTH 2 +STATIC_ osal_queue_t queue_enumerate; +STATIC_ uint8_t queue_enumerate_buffer[ENUM_DEPTH*sizeof(usbh_enumerate_t)]; + //--------------------------------------------------------------------+ // PUBLIC API (Parameter Verification is required) //--------------------------------------------------------------------+ @@ -69,21 +74,16 @@ tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device //--------------------------------------------------------------------+ // CLASS-USBD API (don't require to verify parameters) //--------------------------------------------------------------------+ -void usbh_init(void) +tusb_error_t usbh_init(void) { memset(device_info_pool, 0, sizeof(usbh_device_info_t)*TUSB_CFG_HOST_DEVICE_MAX); +// ASSERT_STATUS(osal_queue_create()); + return TUSB_ERROR_NONE; } -#if 0 -tusb_error_t tusbh_keyboard_open(tusb_handle_device_t device_hdl, uint8_t configure_num, tusb_handle_keyboard_t *keyboard_hdl) +void usbh_enumerate_task(void) { - ASSERT(device_hdl < TUSB_CFG_HOST_DEVICE_MAX, TUSB_ERROR_INVALID_PARA); - ASSERT_INT_WITHIN(1, TUSB_CFG_CONFIGURATION_MAX, configure_num, TUSB_ERROR_INVALID_PARA); - ASSERT_PTR(keyboard_hdl, TUSB_ERROR_INVALID_PARA); - return TUSB_ERROR_NONE; } -#endif - #endif diff --git a/tinyusb/host/usbd_host.h b/tinyusb/host/usbd_host.h index ece9930cd..d218fbd15 100644 --- a/tinyusb/host/usbd_host.h +++ b/tinyusb/host/usbd_host.h @@ -135,6 +135,13 @@ typedef enum { } pipe_status_t; typedef uint32_t tusb_handle_device_t; + +typedef struct { + uint8_t core_id; + uint8_t hub_address; + uint8_t hub_port; +} usbh_enumerate_t; + //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ @@ -153,8 +160,9 @@ tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device //--------------------------------------------------------------------+ #ifdef _TINY_USB_SOURCE_FILE_ -void usbh_init(void); +tusb_error_t usbh_init(void); pipe_status_t usbh_pipe_status_get(pipe_handle_t pipe_hdl) ATTR_WARN_UNUSED_RESULT; +void usbh_enum_task(void); #endif diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 8284ae6f8..844c3c083 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -80,8 +80,8 @@ enum // QUEUE API //--------------------------------------------------------------------+ typedef uint32_t osal_queue_id_t; - -tusb_error_t osal_queue_create(osal_queue_id_t qid, uint8_t *buffer); +//osal_queue_id_t osal_queue_create(osal_queue_t *queue, uint8_t *buffer); +osal_queue_id_t osal_queue_create(osal_queue_id_t *queue, uint8_t *buffer); tusb_error_t osal_queue_put(osal_queue_id_t qid, uint32_t data, osal_timeout_t msec); tusb_error_t osal_queue_get(osal_queue_id_t qid, uint32_t *data, osal_timeout_t msec); diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index c7b9acae0..c3be90fad 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -68,6 +68,8 @@ typedef struct{ volatile uint16_t rd_ptr ; ///< read pointer } osal_queue_t; +//typedef osal_queue_t osal_queue_id_t*; + #define OSAL_DEF_QUEUE(name, size)\ osal_queue_t name;\ uint8_t buffer_##name[size] |
