1:
9:
10:
14:
#ifndef __USB_HID_CLASS_API_H__
15:
#define __USB_HID_CLASS_API_H__
16:
17:
18:
#include "usb_hid_type.h"
19:
#include "usb_hid_log.h"
20:
21:
22:
#define HID_MAJOR_VERSION (0x01)
23:
24:
25:
#define HID_MINOR_VERSION (0x00)
26:
27:
28:
#define USB_DESC_TYPE_HID (0x21U)
29:
30:
31:
#define USB_DESC_TYPE_REPORT (0x22U)
32:
33:
34:
typedef enum {
35: REPORT_TYPE_INPUT = 1,
36: REPORT_TYPE_OUTPUT,
37: REPORT_TYPE_FEATURE
38: }
REPORT_TYPE_SELECTOR;
39:
40:
41:
typedef struct HidDescInfo*
PHID_DESC_INFO;
42:
typedef struct HidReportInfo*
PHID_REPORT_INFO;
43:
typedef struct HidProtocol*
PHID_PROTOCOL;
44:
typedef struct HidIdle*
PHID_IDLE;
45:
46:
55:
typedef struct HidDescInfo {
56: uhs_ubit16_t u16Length;
57: uhs_ubit8_t* pu8Buff;
58: }
HID_DESC_INFO;
59:
60:
65:
typedef struct HidReportInfo {
66:
REPORT_TYPE_SELECTOR ReportTypeSelector;
67: uhs_ubit8_t u8Id;
68: uhs_ubit16_t u16Length;
69: uhs_ubit8_t* pu8Buff;
70: }
HID_REPORT_INFO;
71:
72:
77:
typedef struct HidProtocol {
78: uhs_ubit8_t u8Data;
79: }
HID_PROTOCOL;
80:
81:
87:
typedef struct HidIdle {
88: uhs_ubit8_t u8Id;
89: uhs_ubit8_t u8Duration;
90: }
HID_IDLE;
91:
92:
93:
extern uhs_status_t
Usbh_Hid_GetVersion(uhs_ubit8_t* pu8MajorVersion, uhs_ubit8_t* pu8MinorVersion);
94:
extern uhs_status_t
Usbh_Hid_RegistCallBack(
void* pContext,
hid_callback_t pUserNotifyCallback);
95:
extern uhs_status_t
Usbh_Hid_GetHIDDescriptor(
void* pContext,
PHID_DESC_INFO pstData);
96:
extern uhs_status_t
Usbh_Hid_GetReportDescriptor(
void* pContext,
PHID_DESC_INFO pstData);
97:
extern uhs_status_t
Usbh_Hid_GetReport(
void* pContext,
PHID_REPORT_INFO pstData);
98:
extern uhs_status_t
Usbh_Hid_GetProtocol(
void* pContext,
PHID_PROTOCOL pstData);
99:
extern uhs_status_t
Usbh_Hid_SetIdle(
void* pContext,
PHID_IDLE pstData);
100:
extern uhs_status_t
Usbh_Hid_SetProtocol(
void* pContext,
PHID_PROTOCOL pstData);
101:
extern uhs_status_t
Usbh_Hid_RestartIntIN(
void* pContext);
102:
extern uhs_status_t
Usbh_Hid_StopIntIN(
void* pContext);
103:
104:
105:
106:
107:
108:
109:
110:
#ifdef USBH_STACK_DEBUG_BUILD
111:
#define CIAPI_HID_REPORT_SUMMARY(err) Usbh_Hid_Log_ReportError( g_filename, __LINE__, (err), (uhs_ubit8_t*)"1", 0 )
112:
#define CIAPI_HID_REPORT_DETAIL(err, mesg, len) Usbh_Hid_Log_ReportError( g_filename, __LINE__, (err), (mesg), (len) )
113:
#define CIAPI_HID_REPORT_MILESTONE(num) Usbh_Hid_Log_ReportMilestone((num))
114:
#else
115:
#define CIAPI_HID_REPORT_SUMMARY(err) Usbh_Hid_Log_ReportDummy(err)
116:
#define CIAPI_HID_REPORT_DETAIL(err, mesg, len) Usbh_Hid_Log_ReportDummy(err)
117:
#define CIAPI_HID_REPORT_MILESTONE(num) Usbh_Hid_Log_ReportMilestone((num))
118:
#endif
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
#endif