summaryrefslogtreecommitdiff
path: root/tinyusb/host/usbd_host.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-01-27 17:57:35 +0700
committerhathach <[email protected]>2013-01-27 17:57:35 +0700
commit06f923c7bb95e146ee545194eba1c9357c4baf45 (patch)
tree09091d11a1839920ef56d3219174577ac50b765e /tinyusb/host/usbd_host.c
parent36dbd528708f7c7a65350aef5092b49f962d8a98 (diff)
add usbh_device_info_t to return device status
add usbh_init and test code replace usbh_device_is_plugged in hid_host and test_hid_host with usbh_device_info_t
Diffstat (limited to 'tinyusb/host/usbd_host.c')
-rw-r--r--tinyusb/host/usbd_host.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/tinyusb/host/usbd_host.c b/tinyusb/host/usbd_host.c
index 65794b8ad..adf741548 100644
--- a/tinyusb/host/usbd_host.c
+++ b/tinyusb/host/usbd_host.c
@@ -35,11 +35,44 @@
* This file is part of the tiny usb stack.
*/
-#include "usbd_host.h"
+#include "tusb_option.h"
#ifdef TUSB_CFG_HOST
-usbh_device_info_t usbh_device_pool[TUSB_CFG_HOST_DEVICE_MAX];
+#define _TINY_USB_SOURCE_FILE_
+
+//--------------------------------------------------------------------+
+// INCLUDE
+//--------------------------------------------------------------------+
+#include "common/common.h"
+#include "usbd_host.h"
+
+//--------------------------------------------------------------------+
+// MACRO CONSTANT TYPEDEF
+//--------------------------------------------------------------------+
+
+
+//--------------------------------------------------------------------+
+// INTERNAL OBJECT & FUNCTION DECLARATION
+//--------------------------------------------------------------------+
+STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX];
+
+//--------------------------------------------------------------------+
+// PUBLIC API (Parameter Verification is required)
+//--------------------------------------------------------------------+
+tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device_hdl)
+{
+ ASSERT(device_hdl < TUSB_CFG_HOST_DEVICE_MAX, 0);
+ return device_info_pool[device_hdl].status;
+}
+
+//--------------------------------------------------------------------+
+// CLASS-USBD API (don't require to verify parameters)
+//--------------------------------------------------------------------+
+void usbh_init(void)
+{
+ memset(device_info_pool, 0, sizeof(usbh_device_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
+}
#if 0
tusb_error_t tusbh_keyboard_open(tusb_handle_device_t device_hdl, uint8_t configure_num, tusb_handle_keyboard_t *keyboard_hdl)