📄 lib_desc.h
字号:
void (*getInterface) (
SPipe *pPipe, /* Default Pipe Handler */
short interface); /* Interface index */
void (*getStatus) (
SPipe *pPipe, /* Default Pipe Handler */
char recipient, /* device, interface, endpoint */
short index); /* interface or endpoint index */
void (*setAddress) (
SPipe *pPipe, /* Default Pipe Handler */
char address); /* device, interface, endpoint */
void (*setConfiguration) (
SPipe *pPipe, /* Default Pipe Handler */
short cfgValue); /* Configuration value */
void (*setDescriptor) (
SPipe *pPipe, /* Default Pipe Handler */
char type, /* Descriptor type */
char index, /* Descriptor index */
short langID, /* Language ID */
short length); /* Desriptor length */
void (*setFeature) (
SPipe *pPipe, /* Default Pipe Handler */
char recipient, /* device, interface, endpoint */
short index, /* interface or endpoint index */
short feature); /* Feature selector */
void (*setInterface) (
SPipe *pPipe, /* Default Pipe Handler */
short interface, /* Interface index */
short setting); /* Alternative setting */
void (*synchFrame) (
SPipe *pPipe, /* Default Pipe Handler */
short endpoint); /* Endpoint index */
/* ======================================================================= */
/* Following pointers are used by dispatchClassRequest() */
/* and dispatchVendorRequest() */
/* ======================================================================= */
void *pPrivateClassData;
void *pPrivateVendorData;
} USBDesc;
/* *********************************************************************** */
/* Following functions are define in lib_desc.c. They handle standard */
/* request in order to match with USB spec. Rev. 1.1. Once the request has */
/* been checked according to the USB status, the request is transmitted to */
/* the application calling the application request handler. */
/* *********************************************************************** */
extern void usbDescOutHandler(
SPipe *pPipe); /* OUT pipe handler */
extern void usbDescInHandler(
SPipe *pPipe); /* IN pipe handler */
extern void usbDescCtlHandler(
USBDesc const *pDesc, /* Application request handlers */
SPipe *pPipe, /* Control pipe handler */
USBSetupData *pSetup, /* Pointer to a setup structure as defined in USB spec */
char *dataOut, /* Buffer used in DATA OUT transactions */
unsigned int dataOutMax , /* Buffer size */
unsigned int *dataOutSize);/* Number of bytes received */
/* ======================================================================= */
/* Following functions are used when a Setup packet has been sent to the */
/* device. According to the request, they call the corresponding functions */
/* ======================================================================= */
/* usbDescDispatchRequest handle standart request or call */
/* USBDesc->dispatchVendorRequest() or */
/* USBDesc->dispatchClassRequest() */
extern void usbDescDispatchRequest(
USBDesc const *pDesc, /* pointer to application request handlers */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
/* ======================================================================= */
/* Following functions handle standard request they are called by the */
/* application through usbDescDispatchRequest (). */
/* If this is a valid request, they transmit the request to the application*/
/* layer */
/* ======================================================================= */
extern void usbDescClearFeature(
void (*clearFeature) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescGetConfiguration(
void (*getConfiguration) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescGetDescriptor(
void (*getDescriptor) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescGetInterface(
void (*getInterface) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescGetStatus(
void (*getStatus) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescSetAddress(
void (*setAddress) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescSetConfiguration(
void (*setConfiguration) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescSetDescriptor(
void (*setDescriptor) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescSetFeature(
void (*setFeature) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescSetInterface(
void (*setInterface) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
extern void usbDescSynchFrame(
void (*synchFrame) (), /* Pointer to application request handler */
SPipe *pPipe, /* Default Pipe Handler */
USBSetupData *pSetup); /* Descriptor type */
/* ************************************ */
/* usbDescRequestError */
/* */
/* Arguments: */
/* pPipe: pointer to default pipe */
/* handler */
/* Return: */
/* Nothing */
/* Description: */
/* Answers with Request Error */
/* Initialize a STALL handshake */
/* ************************************ */
__inline void usbDescRequestError(SPipe *pPipe)
{
at91_usb_ep_stall(USB_ENDPOINT_REF(pPipe));
}
/* ************************************ */
/* usbSendStatus */
/* */
/* Arguments: */
/* pPipe: pointer to default pipe */
/* handler */
/* Return: */
/* Nothing */
/* Description: */
/* Acknowledge a control write tx. */
/* Send a sero length packet */
/* ************************************ */
__inline void usbDescSendStatus(SPipe *pPipe)
{
/* Send a zero length packet */
pPipe->Write(pPipe, 0, 0);
}
/* ************************************ */
/* usbDescSynchFrame */
/* */
/* Arguments: */
/* pPipe: pointer to default pipe */
/* handler */
/* pEp: pointer to endpoint */
/* standard USB descriptor */
/* Return: */
/* Nothing */
/* Description: */
/* Configure USB endpoints according*/
/* to the endpoint descriptor */
/* ************************************ */
extern void usbDescConfigure(
StructUSB *pUsb,
const char epNumber,
USBEndpointDesc const *pEp);
#endif /* lib_desc_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -