mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Remove compiler warnings.
This commit is contained in:
parent
e9830a7ee3
commit
790bacc8f2
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
LPCUSB, an USB device driver for LPC microcontrollers
|
||||
LPCUSB, an USB device driver for LPC microcontrollers
|
||||
Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -16,7 +16,7 @@
|
|||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
@ -46,6 +46,7 @@
|
|||
*/
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -186,7 +187,7 @@ static const unsigned char abDescriptors[] = {
|
|||
0x02, // bmAttributes = bulk
|
||||
LE_WORD(MAX_PACKET_SIZE), // wMaxPacketSize
|
||||
0x00, // bInterval
|
||||
|
||||
|
||||
// string descriptors
|
||||
0x04,
|
||||
DESC_STRING,
|
||||
|
@ -211,7 +212,7 @@ static const unsigned char abDescriptors[] = {
|
|||
|
||||
/**
|
||||
Local function to handle incoming bulk data
|
||||
|
||||
|
||||
@param [in] bEP
|
||||
@param [in] bEPStatus
|
||||
*/
|
||||
|
@ -221,21 +222,21 @@ static void BulkOut(unsigned char bEP, unsigned char bEPStatus)
|
|||
long lHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
( void ) bEPStatus;
|
||||
|
||||
|
||||
// get data from USB into intermediate buffer
|
||||
iLen = USBHwEPRead(bEP, abBulkBuf, sizeof(abBulkBuf));
|
||||
for (i = 0; i < iLen; i++) {
|
||||
// put into queue
|
||||
xQueueSendFromISR( xRxedChars, &( abBulkBuf[ i ] ), &lHigherPriorityTaskWoken );
|
||||
xQueueSendFromISR( xRxedChars, &( abBulkBuf[ i ] ), &lHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
|
||||
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Local function to handle outgoing bulk data
|
||||
|
||||
|
||||
@param [in] bEP
|
||||
@param [in] bEPStatus
|
||||
*/
|
||||
|
@ -245,7 +246,7 @@ static void BulkIn(unsigned char bEP, unsigned char bEPStatus)
|
|||
long lHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
( void ) bEPStatus;
|
||||
|
||||
|
||||
if (uxQueueMessagesWaitingFromISR( xCharsForTx ) == 0) {
|
||||
// no more data, disable further NAK interrupts until next USB frame
|
||||
USBHwNakIntEnable(0);
|
||||
|
@ -260,19 +261,19 @@ static void BulkIn(unsigned char bEP, unsigned char bEPStatus)
|
|||
}
|
||||
}
|
||||
iLen = i;
|
||||
|
||||
|
||||
// send over USB
|
||||
if (iLen > 0) {
|
||||
USBHwEPWrite(bEP, abBulkBuf, iLen);
|
||||
}
|
||||
|
||||
|
||||
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Local function to handle the USB-CDC class requests
|
||||
|
||||
|
||||
@param [in] pSetup
|
||||
@param [out] piLen
|
||||
@param [out] ppbData
|
||||
|
@ -315,7 +316,7 @@ DBG("SET_CONTROL_LINE_STATE %X\n", pSetup->wValue);
|
|||
|
||||
/**
|
||||
Writes one character to VCOM port
|
||||
|
||||
|
||||
@param [in] c character to write
|
||||
@returns character written, or EOF if character could not be written
|
||||
*/
|
||||
|
@ -336,13 +337,13 @@ char cc = ( char ) c;
|
|||
|
||||
/**
|
||||
Reads one character from VCOM port
|
||||
|
||||
|
||||
@returns character read, or EOF if character could not be read
|
||||
*/
|
||||
int VCOM_getchar(void)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
|
||||
/* Block the task until a character is available. */
|
||||
xQueueReceive( xRxedChars, &c, portMAX_DELAY );
|
||||
return c;
|
||||
|
@ -351,7 +352,7 @@ int VCOM_getchar(void)
|
|||
|
||||
/**
|
||||
Interrupt handler
|
||||
|
||||
|
||||
Simply calls the USB ISR
|
||||
*/
|
||||
//void USBIntHandler(void)
|
||||
|
@ -364,7 +365,7 @@ void USB_IRQHandler(void)
|
|||
static void USBFrameHandler(unsigned short wFrame)
|
||||
{
|
||||
( void ) wFrame;
|
||||
|
||||
|
||||
if( uxQueueMessagesWaitingFromISR( xCharsForTx ) > 0 )
|
||||
{
|
||||
// data available, enable NAK interrupt on bulk in
|
||||
|
@ -398,7 +399,7 @@ unsigned long CPUcpsie(void)
|
|||
void vUSBTask( void *pvParameters )
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
/* Just to prevent compiler warnings about the unused parameter. */
|
||||
( void ) pvParameters;
|
||||
DBG("Initialising USB stack\n");
|
||||
|
@ -412,8 +413,8 @@ void vUSBTask( void *pvParameters )
|
|||
anything so just delete ourselves. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// initialise stack
|
||||
USBInit();
|
||||
|
||||
|
@ -427,7 +428,7 @@ void vUSBTask( void *pvParameters )
|
|||
USBHwRegisterEPIntHandler(INT_IN_EP, NULL);
|
||||
USBHwRegisterEPIntHandler(BULK_IN_EP, BulkIn);
|
||||
USBHwRegisterEPIntHandler(BULK_OUT_EP, BulkOut);
|
||||
|
||||
|
||||
// register frame handler
|
||||
USBHwRegisterFrameHandler(USBFrameHandler);
|
||||
|
||||
|
@ -438,9 +439,9 @@ void vUSBTask( void *pvParameters )
|
|||
|
||||
NVIC_SetPriority( USB_IRQn, configUSB_INTERRUPT_PRIORITY );
|
||||
NVIC_EnableIRQ( USB_IRQn );
|
||||
|
||||
|
||||
// connect to bus
|
||||
|
||||
|
||||
DBG("Connecting to USB bus\n");
|
||||
USBHwConnect(TRUE);
|
||||
|
||||
|
@ -448,7 +449,7 @@ void vUSBTask( void *pvParameters )
|
|||
for( ;; )
|
||||
{
|
||||
c = VCOM_getchar();
|
||||
if (c != EOF)
|
||||
if (c != EOF)
|
||||
{
|
||||
// Echo character back with INCREMENT_ECHO_BY offset, so for example if
|
||||
// INCREMENT_ECHO_BY is 1 and 'A' is received, 'B' will be echoed back.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
LPCUSB, an USB device driver for LPC microcontrollers
|
||||
LPCUSB, an USB device driver for LPC microcontrollers
|
||||
Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -16,7 +16,7 @@
|
|||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
@ -28,10 +28,10 @@
|
|||
|
||||
/** @file
|
||||
Control transfer handler.
|
||||
|
||||
|
||||
This module handles control transfers and is normally installed on the
|
||||
endpoint 0 callback.
|
||||
|
||||
|
||||
Control transfers can be of the following type:
|
||||
0 Standard;
|
||||
1 Class;
|
||||
|
@ -72,11 +72,11 @@ static unsigned char *apbDataStore[4] = {NULL, NULL, NULL, NULL};
|
|||
/**
|
||||
Local function to handle a request by calling one of the installed
|
||||
request handlers.
|
||||
|
||||
|
||||
In case of data going from host to device, the data is at *ppbData.
|
||||
In case of data going from device to host, the handler can either
|
||||
choose to write its data at *ppbData or update the data pointer.
|
||||
|
||||
|
||||
@param [in] pSetup The setup packet
|
||||
@param [in,out] *piLen Pointer to data length
|
||||
@param [in,out] ppbData Data buffer.
|
||||
|
@ -87,7 +87,7 @@ static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, unsigned char **ppb
|
|||
{
|
||||
TFnHandleRequest *pfnHandler;
|
||||
int iType;
|
||||
|
||||
|
||||
iType = REQTYPE_GET_TYPE(pSetup->bmRequestType);
|
||||
pfnHandler = apfnReqHandlers[iType];
|
||||
if (pfnHandler == NULL) {
|
||||
|
@ -101,7 +101,7 @@ static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, unsigned char **ppb
|
|||
|
||||
/**
|
||||
Local function to stall the control endpoint
|
||||
|
||||
|
||||
@param [in] bEPStat Endpoint status
|
||||
*/
|
||||
static void StallControlPipe(unsigned char bEPStat)
|
||||
|
@ -109,6 +109,7 @@ static void StallControlPipe(unsigned char bEPStat)
|
|||
unsigned char *pb;
|
||||
int i;
|
||||
|
||||
( void ) bEPStat;
|
||||
USBHwEPStall(0x80, TRUE);
|
||||
|
||||
// dump setup packet
|
||||
|
@ -188,7 +189,7 @@ void USBHandleControlTransfer(unsigned char bEP, unsigned char bEPStat)
|
|||
DataIn();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
if (iResidue > 0) {
|
||||
// store data
|
||||
iChunk = USBHwEPRead(0x00, pbData, iResidue);
|
||||
|
@ -231,7 +232,7 @@ void USBHandleControlTransfer(unsigned char bEP, unsigned char bEPStat)
|
|||
|
||||
/**
|
||||
Registers a callback for handling requests
|
||||
|
||||
|
||||
@param [in] iType Type of request, e.g. REQTYPE_TYPE_STANDARD
|
||||
@param [in] *pfnHandler Callback function pointer
|
||||
@param [in] *pbDataStore Data storage area for this type of request
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
LPCUSB, an USB device driver for LPC microcontrollers
|
||||
LPCUSB, an USB device driver for LPC microcontrollers
|
||||
Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -16,7 +16,7 @@
|
|||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
@ -28,11 +28,11 @@
|
|||
|
||||
/** @file
|
||||
Standard request handler.
|
||||
|
||||
|
||||
This modules handles the 'chapter 9' processing, specifically the
|
||||
standard device requests in table 9-3 from the universal serial bus
|
||||
specification revision 2.0
|
||||
|
||||
|
||||
Specific types of devices may specify additional requests (for example
|
||||
HID devices add a GET_DESCRIPTOR request for interfaces), but they
|
||||
will not be part of this module.
|
||||
|
@ -40,7 +40,7 @@
|
|||
@todo some requests have to return a request error if device not configured:
|
||||
@todo GET_INTERFACE, GET_STATUS, SET_INTERFACE, SYNCH_FRAME
|
||||
@todo this applies to the following if endpoint != 0:
|
||||
@todo SET_FEATURE, GET_FEATURE
|
||||
@todo SET_FEATURE, GET_FEATURE
|
||||
*/
|
||||
|
||||
#include "usbdebug.h"
|
||||
|
@ -52,11 +52,11 @@
|
|||
|
||||
/* general descriptor field offsets */
|
||||
#define DESC_bLength 0 /**< length offset */
|
||||
#define DESC_bDescriptorType 1 /**< descriptor type offset */
|
||||
#define DESC_bDescriptorType 1 /**< descriptor type offset */
|
||||
|
||||
/* config descriptor field offsets */
|
||||
#define CONF_DESC_wTotalLength 2 /**< total length offset */
|
||||
#define CONF_DESC_bConfigurationValue 5 /**< configuration value offset */
|
||||
#define CONF_DESC_bConfigurationValue 5 /**< configuration value offset */
|
||||
#define CONF_DESC_bmAttributes 7 /**< configuration characteristics */
|
||||
|
||||
/* interface descriptor field offsets */
|
||||
|
@ -90,12 +90,12 @@ void USBRegisterDescriptors(const unsigned char *pabDescriptors)
|
|||
/**
|
||||
Parses the list of installed USB descriptors and attempts to find
|
||||
the specified USB descriptor.
|
||||
|
||||
|
||||
@param [in] wTypeIndex Type and index of the descriptor
|
||||
@param [in] wLangID Language ID of the descriptor (currently unused)
|
||||
@param [out] *piLen Descriptor length
|
||||
@param [out] *ppbData Descriptor data
|
||||
|
||||
|
||||
@return TRUE if the descriptor was found, FALSE otherwise
|
||||
*/
|
||||
BOOL USBGetDescriptor(unsigned short wTypeIndex, unsigned short wLangID, int *piLen, unsigned char **ppbData)
|
||||
|
@ -103,15 +103,16 @@ BOOL USBGetDescriptor(unsigned short wTypeIndex, unsigned short wLangID, int *pi
|
|||
unsigned char bType, bIndex;
|
||||
unsigned char *pab;
|
||||
int iCurIndex;
|
||||
|
||||
|
||||
( void ) wLangID;
|
||||
ASSERT(pabDescrip != NULL);
|
||||
|
||||
bType = GET_DESC_TYPE(wTypeIndex);
|
||||
bIndex = GET_DESC_INDEX(wTypeIndex);
|
||||
|
||||
|
||||
pab = (unsigned char *)pabDescrip;
|
||||
iCurIndex = 0;
|
||||
|
||||
|
||||
while (pab[DESC_bLength] != 0) {
|
||||
if (pab[DESC_bDescriptorType] == bType) {
|
||||
if (iCurIndex == bIndex) {
|
||||
|
@ -144,12 +145,12 @@ BOOL USBGetDescriptor(unsigned short wTypeIndex, unsigned short wLangID, int *pi
|
|||
Configures the device according to the specified configuration index and
|
||||
alternate setting by parsing the installed USB descriptor list.
|
||||
A configuration index of 0 unconfigures the device.
|
||||
|
||||
|
||||
@param [in] bConfigIndex Configuration index
|
||||
@param [in] bAltSetting Alternate setting number
|
||||
|
||||
|
||||
@todo function always returns TRUE, add stricter checking?
|
||||
|
||||
|
||||
@return TRUE if successfully configured, FALSE otherwise
|
||||
*/
|
||||
static BOOL USBSetConfiguration(unsigned char bConfigIndex, unsigned char bAltSetting)
|
||||
|
@ -158,7 +159,7 @@ static BOOL USBSetConfiguration(unsigned char bConfigIndex, unsigned char bAltSe
|
|||
unsigned char bCurConfig, bCurAltSetting;
|
||||
unsigned char bEP;
|
||||
unsigned short wMaxPktSize;
|
||||
|
||||
|
||||
ASSERT(pabDescrip != NULL);
|
||||
|
||||
if (bConfigIndex == 0) {
|
||||
|
@ -203,7 +204,7 @@ static BOOL USBSetConfiguration(unsigned char bConfigIndex, unsigned char bAltSe
|
|||
// skip to next descriptor
|
||||
pab += pab[DESC_bLength];
|
||||
}
|
||||
|
||||
|
||||
// configure device
|
||||
USBHwConfigDevice(TRUE);
|
||||
}
|
||||
|
@ -214,7 +215,7 @@ static BOOL USBSetConfiguration(unsigned char bConfigIndex, unsigned char bAltSe
|
|||
|
||||
/**
|
||||
Local function to handle a standard device request
|
||||
|
||||
|
||||
@param [in] pSetup The setup packet
|
||||
@param [in,out] *piLen Pointer to data length
|
||||
@param [in,out] ppbData Data buffer.
|
||||
|
@ -226,7 +227,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, unsigned char *
|
|||
unsigned char *pbData = *ppbData;
|
||||
|
||||
switch (pSetup->bRequest) {
|
||||
|
||||
|
||||
case REQ_GET_STATUS:
|
||||
// bit 0: self-powered
|
||||
// bit 1: remote wakeup = not supported
|
||||
|
@ -234,7 +235,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, unsigned char *
|
|||
pbData[1] = 0;
|
||||
*piLen = 2;
|
||||
break;
|
||||
|
||||
|
||||
case REQ_SET_ADDRESS:
|
||||
USBHwSetAddress(pSetup->wValue);
|
||||
break;
|
||||
|
@ -255,7 +256,7 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, unsigned char *
|
|||
return FALSE;
|
||||
}
|
||||
// configuration successful, update current configuration
|
||||
bConfiguration = pSetup->wValue & 0xFF;
|
||||
bConfiguration = pSetup->wValue & 0xFF;
|
||||
break;
|
||||
|
||||
case REQ_CLEAR_FEATURE:
|
||||
|
@ -276,14 +277,14 @@ static BOOL HandleStdDeviceReq(TSetupPacket *pSetup, int *piLen, unsigned char *
|
|||
DBG("Illegal device req %d\n", pSetup->bRequest);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Local function to handle a standard interface request
|
||||
|
||||
|
||||
@param [in] pSetup The setup packet
|
||||
@param [in,out] *piLen Pointer to data length
|
||||
@param [in] ppbData Data buffer.
|
||||
|
@ -307,13 +308,13 @@ static BOOL HandleStdInterfaceReq(TSetupPacket *pSetup, int *piLen, unsigned cha
|
|||
case REQ_SET_FEATURE:
|
||||
// not defined for interface
|
||||
return FALSE;
|
||||
|
||||
|
||||
case REQ_GET_INTERFACE: // TODO use bNumInterfaces
|
||||
// there is only one interface, return n-1 (= 0)
|
||||
pbData[0] = 0;
|
||||
*piLen = 1;
|
||||
break;
|
||||
|
||||
|
||||
case REQ_SET_INTERFACE: // TODO use bNumInterfaces
|
||||
// there is only one interface (= 0)
|
||||
if (pSetup->wValue != 0) {
|
||||
|
@ -333,7 +334,7 @@ static BOOL HandleStdInterfaceReq(TSetupPacket *pSetup, int *piLen, unsigned cha
|
|||
|
||||
/**
|
||||
Local function to handle a standard endpoint request
|
||||
|
||||
|
||||
@param [in] pSetup The setup packet
|
||||
@param [in,out] *piLen Pointer to data length
|
||||
@param [in] ppbData Data buffer.
|
||||
|
@ -351,7 +352,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, unsigned char
|
|||
pbData[1] = 0;
|
||||
*piLen = 2;
|
||||
break;
|
||||
|
||||
|
||||
case REQ_CLEAR_FEATURE:
|
||||
if (pSetup->wValue == FEA_ENDPOINT_HALT) {
|
||||
// clear HALT by unstalling
|
||||
|
@ -360,7 +361,7 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, unsigned char
|
|||
}
|
||||
// only ENDPOINT_HALT defined for endpoints
|
||||
return FALSE;
|
||||
|
||||
|
||||
case REQ_SET_FEATURE:
|
||||
if (pSetup->wValue == FEA_ENDPOINT_HALT) {
|
||||
// set HALT by stalling
|
||||
|
@ -378,16 +379,16 @@ static BOOL HandleStdEndPointReq(TSetupPacket *pSetup, int *piLen, unsigned char
|
|||
DBG("Illegal EP req %d\n", pSetup->bRequest);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Default handler for standard ('chapter 9') requests
|
||||
|
||||
|
||||
If a custom request handler was installed, this handler is called first.
|
||||
|
||||
|
||||
@param [in] pSetup The setup packet
|
||||
@param [in,out] *piLen Pointer to data length
|
||||
@param [in] ppbData Data buffer.
|
||||
|
@ -400,7 +401,7 @@ BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, unsigned char **
|
|||
if ((pfnHandleCustomReq != NULL) && pfnHandleCustomReq(pSetup, piLen, ppbData)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
switch (REQTYPE_GET_RECIP(pSetup->bmRequestType)) {
|
||||
case REQTYPE_RECIP_DEVICE: return HandleStdDeviceReq(pSetup, piLen, ppbData);
|
||||
case REQTYPE_RECIP_INTERFACE: return HandleStdInterfaceReq(pSetup, piLen, ppbData);
|
||||
|
@ -412,15 +413,15 @@ BOOL USBHandleStandardRequest(TSetupPacket *pSetup, int *piLen, unsigned char **
|
|||
|
||||
/**
|
||||
Registers a callback for custom device requests
|
||||
|
||||
|
||||
In USBHandleStandardRequest, the custom request handler gets a first
|
||||
chance at handling the request before it is handed over to the 'chapter 9'
|
||||
request handler.
|
||||
|
||||
|
||||
This can be used for example in HID devices, where a REQ_GET_DESCRIPTOR
|
||||
request is sent to an interface, which is not covered by the 'chapter 9'
|
||||
specification.
|
||||
|
||||
|
||||
@param [in] pfnHandler Callback function pointer
|
||||
*/
|
||||
void USBRegisterCustomReqHandler(TFnHandleRequest *pfnHandler)
|
||||
|
|
Loading…
Reference in a new issue