USBD ROM Stack  2.0
ROM based USB device stack
mw_usbd_hiduser.h
Go to the documentation of this file.
1 /***********************************************************************
2  * $Id:: mw_usbd_hiduser.h 1728 2014-09-19 17:56:35Z nxp73930 $
3  *
4  * Project: USB device ROM Stack
5  *
6  * Description:
7  * HID Custom User Module Definitions.
8  *
9  ***********************************************************************
10  * Copyright(C) 2011, NXP Semiconductor
11  * All rights reserved.
12  *
13  * Software that is described herein is for illustrative purposes only
14  * which provides customers with programming information regarding the
15  * products. This software is supplied "AS IS" without any warranties.
16  * NXP Semiconductors assumes no responsibility or liability for the
17  * use of the software, conveys no license or title under any patent,
18  * copyright, or mask work right to the product. NXP Semiconductors
19  * reserves the right to make changes in the software without
20  * notification. NXP Semiconductors also make no representation or
21  * warranty that such application will be suitable for the specified
22  * use without further testing or modification.
23  **********************************************************************/
24 
25 #ifndef __HIDUSER_H__
26 #define __HIDUSER_H__
27 
28 #include "mw_usbd.h"
29 #include "mw_usbd_hid.h"
30 #include "mw_usbd_core.h"
31 
65 typedef struct _HID_REPORT_T {
66  uint16_t len;
67  uint8_t idle_time;
75  uint8_t __pad;
76  uint8_t *desc;
78 
90 typedef struct USBD_HID_INIT_PARAM {
91  /* memory allocation params */
92  uint32_t mem_base;
97  uint32_t mem_size;
100  /* HID paramas */
101  uint8_t max_reports;
104  uint8_t pad[3];
105  uint8_t *intf_desc;
117  /* user defined functions */
118  /* required functions */
143  ErrorCode_t (*HID_GetReport)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *length);
144 
168  ErrorCode_t (*HID_SetReport)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length);
169 
170  /* optional functions */
171 
202  ErrorCode_t (*HID_GetPhysDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuf, uint16_t *length);
203 
227  ErrorCode_t (*HID_SetIdle)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t idleTime);
228 
250  ErrorCode_t (*HID_SetProtocol)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t protocol);
251 
271  ErrorCode_t (*HID_EpIn_Hdlr)(USBD_HANDLE_T hUsb, void *data, uint32_t event);
291  ErrorCode_t (*HID_EpOut_Hdlr)(USBD_HANDLE_T hUsb, void *data, uint32_t event);
292 
293  /* user override-able function */
315  ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuf, uint16_t *length);
335  ErrorCode_t (*HID_Ep0_Hdlr)(USBD_HANDLE_T hUsb, void *data, uint32_t event);
336 
338 
345 typedef struct USBD_HID_API {
357  uint32_t (*GetMemSize)(USBD_HID_INIT_PARAM_T *param);
358 
381 
383 
384 /*-----------------------------------------------------------------------------
385  * Private functions & structures prototypes
386  *-----------------------------------------------------------------------------*/
389 typedef struct _HID_CTRL_T {
390  /* pointer to controller */
391  USB_CORE_CTRL_T *pUsbCtrl;
392  /* descriptor pointers */
393  uint8_t *hid_desc;
394  USB_HID_REPORT_T *report_data;
395 
396  uint8_t protocol;
397  uint8_t if_num; /* interface number */
398  uint8_t epin_adr; /* IN interrupt endpoint */
399  uint8_t epout_adr; /* OUT interrupt endpoint */
400 
401  /* user defined functions */
402  ErrorCode_t (*HID_GetReport)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *length);
403  ErrorCode_t (*HID_SetReport)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length);
404  ErrorCode_t (*HID_GetPhysDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuf, uint16_t *length);
405  ErrorCode_t (*HID_SetIdle)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t idleTime);
406  ErrorCode_t (*HID_SetProtocol)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t protocol);
407 
408  /* virtual overridable functions */
409  ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuf, uint16_t *length);
410 
411 } USB_HID_CTRL_T;
412 
414 extern uint32_t mwHID_GetMemSize(USBD_HID_INIT_PARAM_T *param);
415 
416 extern ErrorCode_t mwHID_init(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T *param);
417 
422 #endif /* __HIDUSER_H__ */
ErrorCode_t
Definition: error.h:38
HID class API functions structure.This structure contains pointers to all the function exposed by HID...
Definition: mw_usbd_hiduser.h:345
uint32_t mem_base
Definition: mw_usbd_hiduser.h:92
ROM API for USB device stack.
uint8_t __pad
Definition: mw_usbd_hiduser.h:75
uint16_t len
Definition: mw_usbd_hiduser.h:66
Common definitions and declarations for the library USB HID Class driver.
uint8_t * desc
Definition: mw_usbd_hiduser.h:76
Common definitions and declarations for the USB stack.
USB_HID_REPORT_T * report_data
Definition: mw_usbd_hiduser.h:109
uint8_t * intf_desc
Definition: mw_usbd_hiduser.h:105
uint32_t mem_size
Definition: mw_usbd_hiduser.h:97
USB descriptors data structure.
Definition: mw_usbd_hiduser.h:90
HID report descriptor data structure.
Definition: mw_usbd_hiduser.h:65
uint8_t max_reports
Definition: mw_usbd_hiduser.h:101
void * USBD_HANDLE_T
Definition: mw_usbd.h:704
uint8_t idle_time
Definition: mw_usbd_hiduser.h:67