LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_hiduser.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id: mw_usbd_hiduser.h.rca 1.2 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $
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 "usbd.h"
29 #include "usbd_hid.h"
30 #include "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 {
92  /* memory allocation params */
93  uint32_t mem_base;
98  uint32_t mem_size;
101  /* HID paramas */
102  uint8_t max_reports;
105  uint8_t pad[3];
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 
336 
343 typedef struct USBD_HID_API
344 {
357 
380 
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 
419 #endif /* __HIDUSER_H__ */