updating usbh init with class init

This commit is contained in:
hathach
2013-02-08 12:52:46 +07:00
parent 489b98cb93
commit 5bacdc6c0f
7 changed files with 48 additions and 6 deletions
+10 -2
View File
@@ -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
+2
View File
@@ -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
+7 -1
View File
@@ -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;
+1 -1
View File
@@ -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