summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authoruestczyh222 <[email protected]>2017-11-16 14:51:04 +0800
committerBernard Xiong <[email protected]>2017-11-16 19:05:17 +0800
commite365ff547321604741a6f01deb23f87ac0f658c5 (patch)
tree43a5b022773bb9137b4a2661c26b1c18b862b071 /components/drivers/include
parent40d0ff99605f6b50e0120cb61e2f3234ae567c7f (diff)
[Components][Drivers][USB][HID]Update to common hid
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/usb_common.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/usb_common.h b/components/drivers/include/drivers/usb_common.h
index 08462d9244..0422404f6d 100644
--- a/components/drivers/include/drivers/usb_common.h
+++ b/components/drivers/include/drivers/usb_common.h
@@ -218,6 +218,27 @@ extern "C" {
#define USB_EP_DESC_NUM(addr) (addr & USB_EP_DESC_NUM_MASK)
#define USB_EP_DIR(addr) ((addr & USB_DIR_MASK)>>7)
+#ifdef RT_USB_DEVICE_HID
+ #ifdef RT_USB_DEVICE_HID_KEYBOARD
+ #define HID_REPORT_ID_KEYBOARD1 1
+ #if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>1
+ #define HID_REPORT_ID_KEYBOARD2 2
+ #if RT_USB_DEVICE_HID_KEYBOARD_NUMBER>2
+ #define HID_REPORT_ID_KEYBOARD3 3
+ #endif
+ #endif
+ #endif
+ #ifdef RT_USB_DEVICE_HID_MEDIA
+ #define HID_REPORT_ID_MEDIA 4
+ #endif
+ #ifdef RT_USB_DEVICE_HID_GENERAL
+ #define HID_REPORT_ID_GENERAL 5
+ #endif
+ #ifdef RT_USB_DEVICE_HID_MOUSE
+ #define HID_REPORT_ID_MOUSE 6
+ #endif
+#endif
+
#define uswap_32(x) \
((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
@@ -372,6 +393,8 @@ struct usb_qualifier_descriptor
#ifndef HID_SUB_DESCRIPTOR_MAX
#define HID_SUB_DESCRIPTOR_MAX 1
#endif
+
+#ifdef RT_USB_DEVICE_HID
struct uhid_descriptor
{
rt_uint8_t bLength;
@@ -387,6 +410,15 @@ struct uhid_descriptor
};
typedef struct uhid_descriptor* uhid_desc_t;
+struct hid_report
+{
+ rt_uint8_t report_id;
+ rt_uint8_t report[63];
+ rt_uint8_t size;
+};
+typedef struct hid_report* hid_report_t;
+extern void HID_Report_Received(hid_report_t report);
+#endif
struct urequest
{
rt_uint8_t request_type;