?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /******************************************************************************
2  
3 USB Host Human Interface Device Driver Header File
4  
5 Description:
6 This is the header file for a USB Embedded Host that is Human Interface
7 Device Class .
8  
9 This file should be included with usb_host.h to provide the USB hardware
10 interface. It must be included after the application-specific usb_config.h
11 file and after the USB Embedded Host header file usb_host.h, as definitions
12 in those files are required for proper compilation.
13  
14 Acronyms/abbreviations used by this class:
15 * HID - Human Interface Device
16  
17 To interface with usb_host.c, the routine USBHostHIDInitialize() should be
18 specified as the Initialize() function, and USBHostHIDEventHandler() should
19 be specified as the EventHandler() function in the usbClientDrvTable[] array
20 declared in usb_config.h.
21  
22 This driver can be configured to use transfer events from usb_host.c. Transfer
23 events require more RAM and ROM than polling, but it cuts down or even
24 eliminates the required polling of the various USBxxxTasks functions. For this
25 class, USBHostHIDTasks() is compiled out if transfer events from usb_host.c
26 are used. However, USBHostTasks() still must be called to provide attach,
27 enumeration, and detach services. If transfer events from usb_host.c
28 are going to be used, USB_ENABLE_TRANSFER_EVENT should be defined. If transfer
29 status is going to be polled, USB_ENABLE_TRANSFER_EVENT should not be defined.
30  
31 This driver can also be configured to provide HID transfer events to
32 the next layer. Generating these events requires a small amount of extra ROM,
33 but no extra RAM. The layer above this driver must be configured to receive
34 and respond to the events. If HID transfer events are going to be
35 sent to the next layer, USB_HID_ENABLE_TRANSFER_EVENT should be defined. If
36 HID transfer status is going to be polled, USB_HID_ENABLE_TRANSFER_EVENT
37 should not be defined. In any case transfer event EVENT_HID_RPT_DESC_PARSED
38 will be sent to interface layer. Application must provide a function
39 to collect the report descriptor information. Report descriptor information will
40 be overwritten with new report descriptor(in case multiple interface are present)
41 information when cotrol returns to HID driver . This is done to avoid using
42 extra RAM.
43  
44 Since HID transfers are performed with interrupt taransfers,
45 USB_SUPPORT_INTERRUPT_TRANSFERS must be defined.
46  
47 Summary:
48 This is the header file for a USB Embedded Host that is Human Interface
49 Device Class .
50  
51 *******************************************************************************/
52 //DOM-IGNORE-BEGIN
53 /*******************************************************************************
54  
55 * FileName: usb_host_hid.h
56 * Dependencies: None
57 * Processor: PIC24/dsPIC30/dsPIC33/PIC32MX
58 * Compiler: C30 v2.01/C32 v0.00.18
59 * Company: Microchip Technology, Inc.
60  
61 Software License Agreement
62  
63 The software supplied herewith by Microchip Technology Incorporated
64 (the “Company”) for its PICmicro® Microcontroller is intended and
65 supplied to you, the Company’s customer, for use solely and
66 exclusively on Microchip PICmicro Microcontroller products. The
67 software is owned by the Company and/or its supplier, and is
68 protected under applicable copyright laws. All rights are reserved.
69 Any use in violation of the foregoing restrictions may subject the
70 user to criminal sanctions under applicable laws, as well as to
71 civil liability for the breach of the terms and conditions of this
72 license.
73  
74 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
75 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
76 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
77 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
78 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
79 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
80  
81 Change History:
82 Rev Description
83 ---- -----------------------------------------------
84 2.6a- No change
85 2.7a
86 *******************************************************************************/
87 //DOM-IGNORE-END
88  
89 //DOM-IGNORE-BEGIN
90 #ifndef _USB_HOST_HID_H_
91 #define _USB_HOST_HID_H_
92 //DOM-IGNORE-END
93  
94  
95 #include "usb_host_hid_parser.h"
96  
97 // *****************************************************************************
98 // *****************************************************************************
99 // Section: Constants
100 // *****************************************************************************
101 // *****************************************************************************
102  
103 // *****************************************************************************
104 // Section: HID Class Error Codes
105 // *****************************************************************************
106  
107 #define USB_HID_CLASS_ERROR USB_ERROR_CLASS_DEFINED
108  
109 #define USB_HID_COMMAND_PASSED USB_SUCCESS // Command was successful.
110 #define USB_HID_COMMAND_FAILED (USB_HID_CLASS_ERROR | HID_COMMAND_FAILED) // Command failed at the device.
111 #define USB_HID_PHASE_ERROR (USB_HID_CLASS_ERROR | HID_PHASE_ERROR) // Command had a phase error at the device.
112 #define USB_HID_DEVICE_NOT_FOUND (USB_HID_CLASS_ERROR | 0x03) // Device with the specified address is not available.
113 #define USB_HID_DEVICE_BUSY (USB_HID_CLASS_ERROR | 0x04) // A transfer is currently in progress.
114 #define USB_HID_NO_REPORT_DESCRIPTOR (USB_HID_CLASS_ERROR | 0x05) // No report descriptor found
115 #define USB_HID_INTERFACE_ERROR (USB_HID_CLASS_ERROR | 0x06) // The interface layer cannot support the device.
116 #define USB_HID_REPORT_DESCRIPTOR_BAD (USB_HID_CLASS_ERROR | 0x07) // Report Descriptor for not proper
117 #define USB_HID_RESET_ERROR (USB_HID_CLASS_ERROR | 0x0A) // An error occurred while resetting the device.
118 #define USB_HID_ILLEGAL_REQUEST (USB_HID_CLASS_ERROR | 0x0B) // Cannot perform requested operation.
119  
120  
121 // *****************************************************************************
122 // Section: Interface and Protocol Constants
123 // *****************************************************************************
124  
125 #define DEVICE_CLASS_HID 0x03 /* HID Interface Class Code */
126  
127 #define DSC_HID 0x21 /* HID Descriptor Code */
128 #define DSC_RPT 0x2200 /* Report Descriptor Code */
129 #define DSC_PHY 0x23 /* Pysical Descriptor Code */
130  
131 // *****************************************************************************
132 // Section: Additional return values for USBHostHIDDeviceStatus (see USBHostDeviceStatus also)
133 // *****************************************************************************
134  
135 #define USB_HID_DEVICE_DETACHED 0x50 // Device is detached.
136 #define USB_HID_INITIALIZING 0x51 // Device is initializing.
137 #define USB_PROCESSING_REPORT_DESCRIPTOR 0x52 // Parser is processing report descriptor.
138 #define USB_HID_NORMAL_RUNNING 0x53 // Device is running and available for data transfers.
139 #define USB_HID_DEVICE_HOLDING 0x54 // Device is holding due to error
140 #define USB_HID_RESETTING_DEVICE 0x55 // Device is being reset.
141  
142 // *****************************************************************************
143 // Section: HID Event Definition
144 // *****************************************************************************
145  
146 // If the application has not defined an offset for HID events, set it to 0.
147 #ifndef EVENT_HID_OFFSET
148 #define EVENT_HID_OFFSET 0
149 #endif
150  
151 // No event occured (NULL event)
152 #define EVENT_HID_NONE EVENT_HID_BASE + EVENT_HID_OFFSET + 0
153 // A Report Descriptor has been parsed. The returned data pointer is NULL.
154 // The application must collect details, or simply return TRUE if the
155 // application is already aware of the data format.
156 #define EVENT_HID_RPT_DESC_PARSED EVENT_HID_BASE + EVENT_HID_OFFSET + 1
157 //#define EVENT_HID_TRANSFER EVENT_HID_BASE + EVENT_HID_OFFSET + 3 // Unused - value retained for legacy.
158 // A HID Read transfer has completed. The returned data pointer points to a
159 // HID_TRANSFER_DATA structure, with information about the transfer.
160 #define EVENT_HID_READ_DONE EVENT_HID_BASE + EVENT_HID_OFFSET + 4
161 // A HID Write transfer has completed. The returned data pointer points to a
162 // HID_TRANSFER_DATA structure, with information about the transfer.
163 #define EVENT_HID_WRITE_DONE EVENT_HID_BASE + EVENT_HID_OFFSET + 5
164 // HID reset complete. The returned data pointer is NULL.
165 #define EVENT_HID_RESET EVENT_HID_BASE + EVENT_HID_OFFSET + 6
166 // A HID device has attached. The returned data pointer points to a
167 // USB_HID_DEVICE_ID structure.
168 #define EVENT_HID_ATTACH EVENT_HID_BASE + EVENT_HID_OFFSET + 7
169 // A HID device has detached. The returned data pointer points to a
170 // byte with the previous address of the detached device.
171 #define EVENT_HID_DETACH EVENT_HID_BASE + EVENT_HID_OFFSET + 8
172 // There was a problem parsing the report descriptor of the attached device.
173 // Communication with the device is not allowed, and the device should be
174 // detached.
175 #define EVENT_HID_BAD_REPORT_DESCRIPTOR EVENT_HID_BASE + EVENT_HID_OFFSET + 9
176 // An error occurred while trying to do a HID reset. The returned data pointer
177 // is NULL.
178 #define EVENT_HID_RESET_ERROR EVENT_HID_BASE + EVENT_HID_OFFSET + 10
179  
180  
181  
182 // *****************************************************************************
183 // *****************************************************************************
184 // Section: Data Structures
185 // *****************************************************************************
186 // *****************************************************************************
187  
188 //******************************************************************************
189 /* HID Data Details
190  
191 This structure defines the objects used by the application to access required
192 report. Application must use parser interface functions to fill these details.
193 e.g. USBHostHID_ApiFindValue
194 */
195 typedef struct _HID_DATA_DETAILS
196 {
197 WORD reportLength; // reportLength - the expected length of the parent report.
198 WORD reportID; // reportID - report ID - the first byte of the parent report.
199 BYTE bitOffset; // BitOffset - bit offset within the report.
200 BYTE bitLength; // bitlength - length of the data in bits.
201 BYTE count; // count - what's left of the message after this data.
202 BYTE signExtend; // extend - sign extend the data.
203 BYTE interfaceNum; // interfaceNum - informs HID layer about interface number.
204 } HID_DATA_DETAILS;
205 // Note: One would ordinarily get these values from a parser
206 // find. (e.g. USBHostHID_ApiFindValue)
207  
208  
209 // *****************************************************************************
210 /* HID User Data Size
211  
212 This defines the data type required to hold the maximum field size data.
213 */
214 #if((HID_MAX_DATA_FIELD_SIZE >= 1) && (HID_MAX_DATA_FIELD_SIZE <= 8)) /* Maximum size of data field within a report */
215 typedef unsigned char HID_USER_DATA_SIZE;
216 #elif((HID_MAX_DATA_FIELD_SIZE >= 9) && (HID_MAX_DATA_FIELD_SIZE <= 16))
217 typedef unsigned int HID_USER_DATA_SIZE;
218 #elif((HID_MAX_DATA_FIELD_SIZE >= 17) && (HID_MAX_DATA_FIELD_SIZE <= 32))
219 typedef unsigned long HID_USER_DATA_SIZE;
220 #else
221 typedef unsigned char HID_USER_DATA_SIZE;
222 #endif
223  
224  
225 // *****************************************************************************
226 /* HID Device ID Information
227  
228 This structure contains identification information about an attached device.
229 */
230 typedef struct _USB_HID_DEVICE_ID
231 {
232 WORD vid; // Vendor ID of the device
233 WORD pid; // Product ID of the device
234 BYTE deviceAddress; // Address of the device on the USB
235 BYTE clientDriverID; // Client driver ID for device requests
236 } USB_HID_DEVICE_ID;
237  
238  
239 // *****************************************************************************
240 /* HID Transfer Information
241  
242 This structure is used when the event handler is used to notify the upper layer
243 of transfer completion (EVENT_HID_READ_DONE or EVENT_HID_WRITE_DONE).
244 */
245  
246 typedef struct _HID_TRANSFER_DATA
247 {
248 DWORD dataCount; // Count of bytes transferred.
249 BYTE bErrorCode; // Transfer error code.
250 } HID_TRANSFER_DATA;
251  
252  
253 // *****************************************************************************
254 // *****************************************************************************
255 // Section: Function Prototypes
256 // *****************************************************************************
257 // *****************************************************************************
258  
259 /*******************************************************************************
260 Function:
261 BOOL USBHostHIDDeviceDetect( BYTE deviceAddress )
262  
263 Description:
264 This function determines if a HID device is attached and ready to use.
265  
266 Precondition:
267 None
268  
269 Parameters:
270 BYTE deviceAddress - Address of the attached device.
271  
272 Return Values:
273 TRUE - HID present and ready
274 FALSE - HID not present or not ready
275  
276 Remarks:
277 None
278 *******************************************************************************/
279 BOOL USBHostHIDDeviceDetect( BYTE deviceAddress );
280  
281  
282 /*******************************************************************************
283 Function:
284 BYTE USBHostHIDDeviceStatus( BYTE deviceAddress )
285  
286 Summary:
287  
288 Description:
289 This function determines the status of a HID device.
290  
291 Preconditions: None
292  
293 Parameters:
294 BYTE deviceAddress - address of device to query
295  
296 Return Values:
297 USB_HID_DEVICE_NOT_FOUND - Illegal device address, or the
298 device is not an HID
299 USB_HID_INITIALIZING - HID is attached and in the
300 process of initializing
301 USB_PROCESSING_REPORT_DESCRIPTOR - HID device is detected and report
302 descriptor is being parsed
303 USB_HID_NORMAL_RUNNING - HID Device is running normal,
304 ready to send and receive reports
305 USB_HID_DEVICE_HOLDING - Driver has encountered error and
306 could not recover
307 USB_HID_DEVICE_DETACHED - HID detached.
308  
309 Remarks:
310 None
311 *******************************************************************************/
312 BYTE USBHostHIDDeviceStatus( BYTE deviceAddress );
313  
314 /*******************************************************************************
315 Function:
316 BYTE USBHostHIDRead( BYTE deviceAddress,BYTE reportid, BYTE interface,
317 BYTE size, BYTE *data)
318  
319 Summary:
320 This function starts a Get report transfer reuest from the device,
321 utilizing the function USBHostHIDTransfer();
322  
323 Precondition:
324 None
325  
326 Parameters:
327 BYTE deviceAddress - Device address
328 BYTE reportid - Report ID of the requested report
329 BYTE interface - Interface number
330 BYTE size - Byte size of the data buffer
331 BYTE *data - Pointer to the data buffer
332  
333 Return Values:
334 USB_SUCCESS - Request started successfully
335 USB_HID_DEVICE_NOT_FOUND - No device with specified address
336 USB_HID_DEVICE_BUSY - Device not in proper state for
337 performing a transfer
338 Others - Return values from USBHostRead()
339  
340 Remarks:
341 None
342 *******************************************************************************/
343 #define USBHostHIDRead( deviceAddress,reportid,interface,size,data) \
344 USBHostHIDTransfer( deviceAddress,1,interface,reportid,size,data)
345  
346  
347 /*******************************************************************************
348 Function:
349 BYTE USBHostHIDResetDevice( BYTE deviceAddress )
350  
351 Summary:
352 This function starts a HID reset.
353  
354 Description:
355 This function starts a HID reset. A reset can be
356 issued only if the device is attached and not being initialized.
357  
358 Precondition:
359 None
360  
361 Parameters:
362 BYTE deviceAddress - Device address
363  
364 Return Values:
365 USB_SUCCESS - Reset started
366 USB_MSD_DEVICE_NOT_FOUND - No device with specified address
367 USB_MSD_ILLEGAL_REQUEST - Device is in an illegal state for reset
368  
369 Remarks:
370 None
371 *******************************************************************************/
372 BYTE USBHostHIDResetDevice( BYTE deviceAddress );
373  
374 /*******************************************************************************
375 Function:
376 void USBHostHIDTasks( void )
377  
378 Summary:
379 This function performs the maintenance tasks required by HID class
380  
381 Description:
382 This function performs the maintenance tasks required by the HID
383 class. If transfer events from the host layer are not being used, then
384 it should be called on a regular basis by the application. If transfer
385 events from the host layer are being used, this function is compiled out,
386 and does not need to be called.
387  
388 Precondition:
389 USBHostHIDInitialize() has been called.
390  
391 Parameters:
392 None - None
393  
394 Returns:
395 None
396  
397 Remarks:
398 None
399 *******************************************************************************/
400 void USBHostHIDTasks( void );
401  
402 /*******************************************************************************
403 Function:
404 BYTE USBHostHIDTerminateTransfer( BYTE deviceAddress, BYTE direction, BYTE interfaceNum )
405  
406 Summary:
407 This function terminates a transfer that is in progress.
408  
409 Description:
410 This function terminates a transfer that is in progress.
411  
412 Precondition:
413 None
414  
415 Parameters:
416 BYTE deviceAddress - Device address
417 BYTE direction - Transfer direction. Valid values are:
418 * 1 = In (Read)
419 * 0 = Out (Write)
420 BYTE interfaceNum - Interface number
421  
422 Return Values:
423 USB_SUCCESS - Transfer terminated
424 USB_HID_DEVICE_NOT_FOUND - No device with specified address
425  
426 Remarks:
427 None
428 *******************************************************************************/
429 BYTE USBHostHIDTerminateTransfer( BYTE deviceAddress, BYTE direction, BYTE interfaceNum );
430  
431 /*******************************************************************************
432 Function:
433 USBHostHIDTransfer( BYTE deviceAddress, BYTE direction, BYTE interfaceNum,
434 BYTE reportid, BYTE size, BYTE *data)
435  
436 Summary:
437 This function starts a HID transfer.
438  
439 Description:
440 This function starts a HID transfer. A read/write wrapper is provided in application
441 interface file to access this function.
442  
443 Preconditions:
444 None
445  
446 Parameters:
447 BYTE deviceAddress - Device address
448 BYTE direction - 1=read, 0=write
449 BYTE interfaceNum - Interface number
450 BYTE reportid - Report ID of the requested report
451 BYTE size - Byte size of the data buffer
452 BYTE *data - Pointer to the data buffer
453  
454 Return Values:
455 USB_SUCCESS - Request started successfully
456 USB_HID_DEVICE_NOT_FOUND - No device with specified address
457 USB_HID_DEVICE_BUSY - Device not in proper state for
458 performing a transfer
459 Remarks:
460 None
461 *******************************************************************************/
462 BYTE USBHostHIDTransfer( BYTE deviceAddress, BYTE direction, BYTE interfaceNum, WORD reportid, WORD size, BYTE *data);
463  
464 /*******************************************************************************
465 Function:
466 BOOL USBHostHIDTransferIsComplete( BYTE deviceAddress,
467 BYTE *errorCode, DWORD *byteCount )
468  
469 Summary:
470 This function indicates whether or not the last transfer is complete.
471  
472 Description:
473 This function indicates whether or not the last transfer is complete.
474 If the functions returns TRUE, the returned byte count and error
475 code are valid. Since only one transfer can be performed at once
476 and only one endpoint can be used, we only need to know the
477 device address.
478  
479 Precondition:
480 None
481  
482 Parameters:
483 BYTE deviceAddress - Device address
484 BYTE *errorCode - Error code from last transfer
485 DWORD *byteCount - Number of bytes transferred
486  
487 Return Values:
488 TRUE - Transfer is complete, errorCode is valid
489 FALSE - Transfer is not complete, errorCode is not valid
490 *******************************************************************************/
491 BOOL USBHostHIDTransferIsComplete( BYTE deviceAddress, BYTE *errorCode, BYTE *byteCount );
492  
493  
494 /*******************************************************************************
495 Function:
496 BYTE USBHostHIDWrite( BYTE deviceAddress,BYTE reportid, BYTE interface,
497 BYTE size, BYTE *data)
498  
499 Summary:
500 This function starts a Set report transfer request to the device,
501 utilizing the function USBHostHIDTransfer();
502  
503 Precondition:
504 None
505  
506 Parameters:
507 BYTE deviceAddress - Device address
508 BYTE reportid - Report ID of the requested report
509 BYTE interface - Interface number
510 BYTE size - Byte size of the data buffer
511 BYTE *data - Pointer to the data buffer
512  
513 Return Values:
514 USB_SUCCESS - Request started successfully
515 USB_HID_DEVICE_NOT_FOUND - No device with specified address
516 USB_HID_DEVICE_BUSY - Device not in proper state for
517 performing a transfer
518 Others - Return values from USBHostIssueDeviceRequest(),
519 and USBHostWrite()
520  
521 Remarks:
522 None
523 *******************************************************************************/
524 #define USBHostHIDWrite( address,reportid,interface,size,data) \
525 USBHostHIDTransfer( address,0,interface,reportid,size,data)
526  
527 /*******************************************************************************
528 Function:
529 BOOL USBHostHID_ApiFindBit(WORD usagePage,WORD usage,HIDReportTypeEnum type,
530 BYTE* Report_ID, BYTE* Report_Length, BYTE* Start_Bit)
531  
532 Description:
533 This function is used to locate a specific button or indicator.
534 Once the report descriptor is parsed by the HID layer without any error,
535 data from the report descriptor is stored in pre defined dat structures.
536 This function traverses these data structure and exract data required
537 by application
538  
539 Precondition:
540 None
541  
542 Parameters:
543 WORD usagePage - usage page supported by application
544 WORD usage - usage supported by application
545 HIDReportTypeEnum type - report type Input/Output for the particular
546 usage
547 BYTE* Report_ID - returns the report ID of the required usage
548 BYTE* Report_Length - returns the report length of the required usage
549 BYTE* Start_Bit - returns the start bit of the usage in a
550 particular report
551  
552 Return Values:
553 TRUE - If the required usage is located in the report descriptor
554 FALSE - If the application required usage is not supported by the
555 device(i.e report descriptor).
556  
557 Remarks:
558 Application event handler with event 'EVENT_HID_RPT_DESC_PARSED' is called.
559 Application is suppose to fill in data details in structure 'HID_DATA_DETAILS'.
560 This function can be used to the get the details of the required usages.
561 *******************************************************************************/
562 BOOL USBHostHID_ApiFindBit(WORD usagePage,WORD usage,HIDReportTypeEnum type,BYTE* Report_ID,
563 BYTE* Report_Length, BYTE* Start_Bit);
564  
565  
566 /*******************************************************************************
567 Function:
568 BOOL USBHostHID_ApiFindValue(WORD usagePage,WORD usage,
569 HIDReportTypeEnum type,BYTE* Report_ID,BYTE* Report_Length,BYTE*
570 Start_Bit, BYTE* Bit_Length)
571  
572 Description:
573 Find a specific Usage Value. Once the report descriptor is parsed by the HID
574 layer without any error, data from the report descriptor is stored in
575 pre defined dat structures. This function traverses these data structure and
576 exract data required by application.
577  
578 Precondition:
579 None
580  
581 Parameters:
582 WORD usagePage - usage page supported by application
583 WORD usage - usage supported by application
584 HIDReportTypeEnum type - report type Input/Output for the particular
585 usage
586 BYTE* Report_ID - returns the report ID of the required usage
587 BYTE* Report_Length - returns the report length of the required usage
588 BYTE* Start_Bit - returns the start bit of the usage in a
589 particular report
590 BYTE* Bit_Length - returns size of requested usage type data in bits
591  
592 Return Values:
593 TRUE - If the required usage is located in the report descriptor
594 FALSE - If the application required usage is not supported by the
595 device(i.e report descriptor).
596  
597 Remarks:
598 Application event handler with event 'EVENT_HID_RPT_DESC_PARSED' is called.
599 Application is suppose to fill in data details structure 'HID_DATA_DETAILS'
600 This function can be used to the get the details of the required usages.
601 *******************************************************************************/
602 BOOL USBHostHID_ApiFindValue(WORD usagePage,WORD usage,HIDReportTypeEnum type,BYTE* Report_ID,
603 BYTE* Report_Length,BYTE* Start_Bit, BYTE* Bit_Length);
604  
605  
606 /*******************************************************************************
607 Function:
608 BYTE USBHostHID_ApiGetCurrentInterfaceNum(void)
609  
610 Description:
611 This function reurns the interface number of the cuurent report descriptor
612 parsed. This function must be called to fill data interface detail data
613 structure and passed as parameter when requesinf for report transfers.
614  
615 Precondition:
616 None
617  
618 Parameters:
619 BYTE *errorCode - Error code from last transfer
620 DWORD *byteCount - Number of bytes transferred
621  
622 Return Values:
623 TRUE - Transfer is complete, errorCode is valid
624 FALSE - Transfer is not complete, errorCode is not valid
625  
626 Remarks:
627 None
628 *******************************************************************************/
629 BYTE USBHostHID_ApiGetCurrentInterfaceNum(void);
630  
631  
632 /****************************************************************************
633 Function:
634 BYTE* USBHostHID_GetCurrentReportInfo()
635  
636 Description:
637 This function returns a pointer to the current report info structure.
638  
639 Precondition:
640 None
641  
642 Parameters:
643 None
644  
645 Returns:
646 BYTE * - Pointer to the report Info structure.
647  
648 Remarks:
649 None
650 ***************************************************************************/
651  
652 #define USBHostHID_GetCurrentReportInfo() (&deviceRptInfo)
653  
654  
655 /****************************************************************************
656 Function:
657 BYTE* USBHostHID_GetItemListPointers()
658  
659 Description:
660 This function returns a pointer to list of item pointers storedin a
661 structure.
662  
663 Precondition:
664 None
665  
666 Parameters:
667 None
668  
669 Returns:
670 BYTE * - Pointer to list of item pointers structure.
671  
672 Remarks:
673 None
674 ***************************************************************************/
675 #define USBHostHID_GetItemListPointers() (&itemListPtrs)
676  
677  
678 /*******************************************************************************
679 Function:
680 BOOL USBHostHID_ApiImportData(BYTE *report, WORD reportLength,
681 HID_USER_DATA_SIZE *buffer,HID_DATA_DETAILS *pDataDetails)
682 Description:
683 This function can be used by application to extract data from the input
684 reports. On receiving the input report from the device application can call
685 the function with required inputs 'HID_DATA_DETAILS'.
686  
687 Precondition:
688 None
689  
690 Parameters:
691 BYTE *report - Input report received from device
692 WORD reportLength - Length of input report report
693 HID_USER_DATA_SIZE *buffer - Buffer into which data needs to be
694 populated
695 HID_DATA_DETAILS *pDataDetails - data details extracted from report
696 descriptor
697 Return Values:
698 TRUE - If the required data is retrieved from the report
699 FALSE - If required data is not found.
700  
701 Remarks:
702 None
703 *******************************************************************************/
704 BOOL USBHostHID_ApiImportData(BYTE *report,WORD reportLength,HID_USER_DATA_SIZE *buffer, HID_DATA_DETAILS *pDataDetails);;
705  
706  
707 // *****************************************************************************
708 // *****************************************************************************
709 // Section: USB Host Callback Function Prototypes
710 // *****************************************************************************
711 // *****************************************************************************
712  
713 /*******************************************************************************
714 Function:
715 BOOL USBHostHIDInitialize( BYTE address, WORD flags, BYTE clientDriverID )
716  
717 Summary:
718 This function is the initialization routine for this client driver.
719  
720 Description:
721 This function is the initialization routine for this client driver. It
722 is called by the host layer when the USB device is being enumerated.For a
723 HID device we need to look into HID descriptor, interface descriptor and
724 endpoint descriptor.
725  
726 Precondition:
727 None
728  
729 Parameters:
730 BYTE address - Address of the new device
731 DWORD flags - Initialization flags
732 BYTE clientDriverID - Client driver identification for device requests
733  
734 Return Values:
735 TRUE - We can support the device.
736 FALSE - We cannot support the device.
737  
738 Remarks:
739 None
740 *******************************************************************************/
741 BOOL USBHostHIDInitialize( BYTE address, DWORD flags, BYTE clientDriverID );
742  
743 /*******************************************************************************
744 Function:
745 BOOL USBHostHIDEventHandler( BYTE address, USB_EVENT event,
746 void *data, DWORD size )
747  
748 Precondition:
749 The device has been initialized.
750  
751 Summary:
752 This function is the event handler for this client driver.
753  
754 Description:
755 This function is the event handler for this client driver. It is called
756 by the host layer when various events occur.
757  
758 Parameters:
759 BYTE address - Address of the device
760 USB_EVENT event - Event that has occurred
761 void *data - Pointer to data pertinent to the event
762 DWORD size - Size of the data
763  
764 Return Values:
765 TRUE - Event was handled
766 FALSE - Event was not handled
767  
768 Remarks:
769 None
770 *******************************************************************************/
771 BOOL USBHostHIDEventHandler( BYTE address, USB_EVENT event, void *data, DWORD size );
772  
773  
774  
775 // *****************************************************************************
776 // *****************************************************************************
777 // Section: Legacy Macros
778 // *****************************************************************************
779 // *****************************************************************************
780  
781 // This macro provides legacy support for an older API function.
782 #define USBHostHID_ApiDeviceDetect() USBHostHIDDeviceDetect( 1 )
783  
784 // This macro provides legacy support for an older API function.
785 #define USBHostHID_ApiGetReport( r, i, s, d ) USBHostHIDRead( 1, r, i, s, d )
786  
787 // This macro provides legacy support for an older API function.
788 #define USBHostHID_ApiSendReport( r, i, s, d ) USBHostHIDWrite( 1, r, i, s, d )
789  
790 // This macro provides legacy support for an older API function.
791 #define USBHostHID_ApiResetDevice() USBHostHIDResetDeviceWithWait( 1 )
792  
793 // This macro provides legacy support for an older API function.
794 #define USBHostHID_ApiTransferIsComplete( e, c ) USBHostHIDTransferIsComplete( 1, e, c )
795  
796  
797 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3