diff options
| author | hathach <[email protected]> | 2013-02-01 10:33:43 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-02-01 10:33:43 +0700 |
| commit | 9e3785e7e1bd5bac3c8e24477edbde12cc09dd4b (patch) | |
| tree | c2233323659aeda002dbbcb6e910b669f1147aac /tinyusb/host | |
| parent | 1b963f6a7117d754c47e860159ac0aa90d1db6dc (diff) | |
add std=gnu99 for test build
add hcd_init to usbh_init and update test code
add TUSB_CFG_OS_TICK_PER_SECOND define for TUSB_OS_NONE
change osal_semaphore_wait and osal_queue_receive API to have timeout effectively
Diffstat (limited to 'tinyusb/host')
| -rw-r--r-- | tinyusb/host/hcd.c | 1 | ||||
| -rw-r--r-- | tinyusb/host/hcd.h | 5 | ||||
| -rw-r--r-- | tinyusb/host/usbd_host.c | 40 | ||||
| -rw-r--r-- | tinyusb/host/usbd_host.h | 1 |
4 files changed, 33 insertions, 14 deletions
diff --git a/tinyusb/host/hcd.c b/tinyusb/host/hcd.c index 2c085566e..6960d2cfa 100644 --- a/tinyusb/host/hcd.c +++ b/tinyusb/host/hcd.c @@ -41,7 +41,6 @@ tusb_error_t hcd_init(uint8_t coreid) { - return TUSB_ERROR_NONE; } diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h index 9ea26bdda..ed68171b7 100644 --- a/tinyusb/host/hcd.h +++ b/tinyusb/host/hcd.h @@ -60,7 +60,6 @@ typedef uint32_t pipe_handle_t; -#if 0 /** \brief Initialize HCD * * \param[in] para1 @@ -71,6 +70,10 @@ typedef uint32_t pipe_handle_t; tusb_error_t hcd_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT; +/// return the current connect status of roothub port +bool hcd_port_connect_status(uint8_t hostid) ATTR_WARN_UNUSED_RESULT; + +#if 0 //tusb_error_t hcd_pipe_open( // uint8_t hostid, uint8_t device_address, // diff --git a/tinyusb/host/usbd_host.c b/tinyusb/host/usbd_host.c index c3489525d..3c8c9ce83 100644 --- a/tinyusb/host/usbd_host.c +++ b/tinyusb/host/usbd_host.c @@ -58,12 +58,6 @@ //--------------------------------------------------------------------+ STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX]; -OSAL_TASK_DEF(enumeration_task, usbh_enumerate_task, 128, OSAL_PRIO_HIGH); - -#define ENUM_QUEUE_DEPTH 5 -OSAL_DEF_QUEUE(enumeration_queue, ENUM_QUEUE_DEPTH, uin32_t); -osal_queue_handle_t enumeration_queue_hdl; - //--------------------------------------------------------------------+ // PUBLIC API (Parameter Verification is required) //--------------------------------------------------------------------+ @@ -74,22 +68,44 @@ tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device } //--------------------------------------------------------------------+ +// ENUMERATION TASK & ITS DATA +//--------------------------------------------------------------------+ +OSAL_TASK_DEF(enumeration_task, usbh_enumerate_task, 128, OSAL_PRIO_HIGH); + +#define ENUM_QUEUE_DEPTH 5 +OSAL_DEF_QUEUE(enumeration_queue, ENUM_QUEUE_DEPTH, uin32_t); +osal_queue_handle_t enumeration_queue_hdl; + +void usbh_enumerate_task(void) +{ + OSAL_TASK_LOOP + { + OSAL_TASK_LOOP_BEGIN + + + + OSAL_TASK_LOOP_END + } +} + +//--------------------------------------------------------------------+ // CLASS-USBD API (don't require to verify parameters) //--------------------------------------------------------------------+ tusb_error_t usbh_init(void) { + uint32_t i; + memset(device_info_pool, 0, sizeof(usbh_device_info_t)*TUSB_CFG_HOST_DEVICE_MAX); + for(i=0; i<TUSB_CFG_HOST_CONTROLLER_NUM; i++) + { + ASSERT_STATUS( hcd_init(i) ); + } + ASSERT_STATUS( osal_task_create(&enumeration_task) ); enumeration_queue_hdl = osal_queue_create(&enumeration_queue); ASSERT_PTR(enumeration_queue_hdl, TUSB_ERROR_OSAL_QUEUE_FAILED); return TUSB_ERROR_NONE; } - -void usbh_enumerate_task(void) -{ - -} - #endif diff --git a/tinyusb/host/usbd_host.h b/tinyusb/host/usbd_host.h index d218fbd15..54d58ab81 100644 --- a/tinyusb/host/usbd_host.h +++ b/tinyusb/host/usbd_host.h @@ -140,6 +140,7 @@ typedef struct { uint8_t core_id; uint8_t hub_address; uint8_t hub_port; + uint8_t connect_status; } usbh_enumerate_t; //--------------------------------------------------------------------+ |
