diff options
| author | hathach <[email protected]> | 2013-01-22 17:41:06 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-01-22 17:41:06 +0700 |
| commit | 38ce3f7534ec9e3e0b10b8923d7d17e437463e86 (patch) | |
| tree | 4eb3c2e065610c6b1dadc14a9c98e421041c5546 /tinyusb/class/hid_host.c | |
| parent | cfe7a3d23b4639c3578b166fc865450bc439d82c (diff) | |
start to support
- usbd host
- osal
some global define
#define TUSB_CFG_HOST_CONTROLLER_NUM
#define TUSB_CFG_HOST_DEVICE_MAX
#define TUSB_CFG_CONFIGURATION_MAX
rename & refractor HID type structure & enum
use CException to test asssertion library
add test for hid_host_keyboard with usbd configure get & osal queue get stubs
update test for assertion library
refractor ASSERT_STATUS in assertion library
update tusb_error_t values
rename usb basic type & enum in tusb_types.h and std_descriptors.h
Diffstat (limited to 'tinyusb/class/hid_host.c')
| -rw-r--r-- | tinyusb/class/hid_host.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index 17b1aca0e..d0c3f13ea 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -39,12 +39,24 @@ #if defined DEVICE_CLASS_HID && defined TUSB_CFG_HOST -bool tusb_host_keyboard_get(tusb_interface_keyboard_handle_t const * const handle, tusb_keyboard_report_t * const report) +tusb_error_t tusbh_keyboard_get(tusb_handle_configure_t const config_hdl, tusb_keyboard_report_t * const report) { - ASSSERT_PTR(handle, false); - ASSSERT_PTR(report, false); + tusb_configure_info_t *p_cfg_info; - return true; + pipe_handle_t pipe_in; + osal_queue_id_t qid; + + ASSERT_PTR(report, TUSB_ERROR_INVALID_PARA); + ASSERT_STATUS( usbh_configure_info_get(config_hdl, &p_cfg_info) ); + + pipe_in = p_cfg_info->classes.hid_keyboard.pipe_in; + qid = p_cfg_info->classes.hid_keyboard.qid; + + ASSERT(0 != pipe_in, TUSB_ERROR_CLASS_DEVICE_DONT_SUPPORT); + ASSERT_STATUS( osal_queue_get(qid, (uint32_t*)report, OSAL_TIMEOUT_WAIT_FOREVER) ); + ASSERT_STATUS( osal_queue_get(qid, ((uint32_t*)report)+1, OSAL_TIMEOUT_WAIT_FOREVER) ); + + return TUSB_ERROR_NONE; } #endif |
