summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-02-08 12:52:46 +0700
committerhathach <[email protected]>2013-02-08 12:52:46 +0700
commit5bacdc6c0fb7ea5255974142498b2dc56e3778ee (patch)
tree405864b2ad77c8c640f98840eb01db39f2f191e9 /tinyusb
parent489b98cb933e1f4b164bf1172a405d22528d2b8b (diff)
updating usbh init with class init
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/class/hid_host.h12
-rw-r--r--tinyusb/common/common.h2
-rw-r--r--tinyusb/host/usbh.c8
-rw-r--r--tinyusb/tusb_option.h2
4 files changed, 20 insertions, 4 deletions
diff --git a/tinyusb/class/hid_host.h b/tinyusb/class/hid_host.h
index 0fb1c3299..e1e4c2c9b 100644
--- a/tinyusb/class/hid_host.h
+++ b/tinyusb/class/hid_host.h
@@ -81,8 +81,16 @@ typedef struct {
keyboard_interface_t instance[TUSB_CFG_HOST_HID_KEYBOARD_NO_INSTANCES_PER_DEVICE];
} class_hid_keyboard_info_t;
-void class_hid_keyboard_init(void);
-tusb_error_t class_hid_keyboard_install(uint8_t const dev_addr, uint8_t const *descriptor) ATTR_WARN_UNUSED_RESULT;
+void hidh_keyboard_init(void);
+tusb_error_t hidh_keyboard_install(uint8_t const dev_addr, uint8_t const *descriptor) ATTR_WARN_UNUSED_RESULT;
+
+static inline void hidh_init(void) ATTR_ALWAYS_INLINE;
+static inline void hidh_init(void)
+{
+#if TUSB_CFG_HOST_HID_KEYBOARD
+ hidh_keyboard_init();
+#endif
+}
#endif
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index 6859b0e01..c883faf2c 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -79,8 +79,10 @@
// TODO try to manipulate gcc cmd option instead
#ifndef _TEST_
#define STATIC_ static
+ #define INLINE_ inline
#else
#define STATIC_
+ #define INLINE_
#endif
#define STRING_(x) #x // stringify without expand
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 00574d52f..faa305464 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -93,10 +93,16 @@ tusb_error_t usbh_init(void)
ASSERT_STATUS( hcd_init(TUSB_CFG_HOST_CONTROLLER_START_INDEX+i) );
}
+ //------------- Enumeration & Reporter Task init -------------//
ASSERT_STATUS( osal_task_create(&enum_task) );
enum_queue_hdl = osal_queue_create(&enum_queue);
ASSERT_PTR(enum_queue_hdl, TUSB_ERROR_OSAL_QUEUE_FAILED);
+ //------------- class init -------------//
+#if HOST_CLASS_HID
+ hidh_init();
+#endif
+
return TUSB_ERROR_NONE;
}
@@ -109,7 +115,7 @@ void usbh_enumeration_task(void)
usbh_enumerate_t enum_entry;
tusb_std_request_t request_packet;
- // for OSAL_NONE local variable wont retain value after blocking service sem_wait/queue_recv
+ // for OSAL_NONE local variable won't retain value after blocking service sem_wait/queue_recv
static uint8_t new_addr;
static uint8_t configure_selected = 1;
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h
index d2001eae3..3fab8f1f2 100644
--- a/tinyusb/tusb_option.h
+++ b/tinyusb/tusb_option.h
@@ -123,7 +123,7 @@
#warning TUSB_CFG_HOST_ENUM_BUFFER_SIZE is not defined, default value is 256
#endif
- #define HOST_CLASS_HID ( (defined TUSB_CFG_HOST_HID_KEYBOARD) )
+ #define HOST_CLASS_HID ( TUSB_CFG_HOST_HID_KEYBOARD )
#define HOST_EHCI
#endif // end TUSB_CFG_HOST