| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_hiduser.h
Go to the documentation of this file.
1 /*
2 * @brief Definition of functions exported by ROM based HID function driver
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #ifndef __HIDUSER_H__
33 #define __HIDUSER_H__
34
35 #include "usbd.h"
36 #include "usbd_hid.h"
37 #include "usbd_core.h"
38
39
66 typedef struct _HID_REPORT_T {
67 uint16_t len;
68 uint8_t idle_time;
76 uint8_t __pad;
77 uint8_t* desc;
78 } USB_HID_REPORT_T;
79
91 typedef struct USBD_HID_INIT_PARAM
92 {
93 /* memory allocation params */
94 uint32_t mem_base;
99 uint32_t mem_size;
102 /* HID paramas */
103 uint8_t max_reports;
106 uint8_t* intf_desc;
110 USB_HID_REPORT_T* report_data;
118 /* user defined functions */
119 /* required functions */
143 ErrorCode_t (*HID_GetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length);
144
167 ErrorCode_t (*HID_SetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length);
168
169 /* optional functions */
170
201 ErrorCode_t (*HID_GetPhysDesc)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
202
226 ErrorCode_t (*HID_SetIdle)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t idleTime);
227
249 ErrorCode_t (*HID_SetProtocol)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t protocol);
250
270 ErrorCode_t (*HID_EpIn_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
290 ErrorCode_t (*HID_EpOut_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
291
292 /* user overridable function */
313 ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
333 ErrorCode_t (*HID_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
334
335 } USBD_HID_INIT_PARAM_T;
336
343 typedef struct USBD_HID_API
344 {
356 uint32_t (*GetMemSize)(USBD_HID_INIT_PARAM_T* param);
357
379 ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param);
380
381 } USBD_HID_API_T;
382
383 /*-----------------------------------------------------------------------------
384 * Private functions & structures prototypes
385 *-----------------------------------------------------------------------------*/
388 typedef struct _HID_CTRL_T {
389 /* pointer to controller */
390 USB_CORE_CTRL_T* pUsbCtrl;
391 /* descriptor pointers */
392 uint8_t* hid_desc;
393 USB_HID_REPORT_T* report_data;
394
395 uint8_t protocol;
396 uint8_t if_num; /* interface number */
397 uint8_t epin_adr; /* IN interrupt endpoint */
398 uint8_t epout_adr; /* OUT interrupt endpoint */
399
400 /* user defined functions */
401 ErrorCode_t (*HID_GetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length);
402 ErrorCode_t (*HID_SetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length);
403 ErrorCode_t (*HID_GetPhysDesc)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
404 ErrorCode_t (*HID_SetIdle)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t idleTime);
405 ErrorCode_t (*HID_SetProtocol)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t protocol);
406
407 /* virtual overridable functions */
408 ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
409
410 }USB_HID_CTRL_T;
411
412
415 #endif /* __HIDUSER_H__ */