46 #include "../../libchip/include/usbhs.h" 81 if (pDesc->bLength == 0)
86 USBInterfaceDescriptor *pIf = (USBInterfaceDescriptor *)pDesc;
91 if (pIf->bInterfaceClass ==
105 > pIf->bInterfaceNumber)
115 USBEndpointDescriptor *pEp = (USBEndpointDescriptor *)pDesc;
117 switch (pEp->bmAttributes & 0x3) {
119 if (pEp->bEndpointAddress & 0x80)
120 pCdcd->
bIntInPIPE = pEp->bEndpointAddress & 0x7F;
125 if (pEp->bEndpointAddress & 0x80)
181 sizeof(CDCLineCoding),
197 sizeof(CDCLineCoding),
213 #if (TRACE_LEVEL >= TRACE_LEVEL_INFO) 247 uint8_t firstInterface, uint8_t numInterface)
260 pCdcd->
pUsbd = pUsbd;
288 USBGenericDescriptor *pDescriptors,
297 pDescriptors, dwLength,
364 void *pData, uint32_t dwSize,
400 void *pData, uint32_t dwSize,
405 uint32_t endpointSize;
412 if (dwSize % endpointSize == 0) {
443 CDCLineCoding *pLineCoding)
446 pLineCoding->dwDTERate = pCdcd->
lineCoding.dwDTERate;
447 pLineCoding->bCharFormat = pCdcd->
lineCoding.bCharFormat;
448 pLineCoding->bParityType = pCdcd->
lineCoding.bParityType;
449 pLineCoding->bDataBits = pCdcd->
lineCoding.bDataBits;
468 uint16_t wSerialState)
uint32_t CDCDSerialPort_Write(CDCDSerialPort *pCdcd, void *pData, uint32_t dwSize, TransferCallback fCallback, void *pArg)
__STATIC_INLINE uint32_t USBHS_GetEpSize(Usbhs *pUsbhs, uint8_t Ep)
#define USBGenericDescriptor_ENDPOINT
static void _UsbDataSent_ZLP(CDCDSerialPort *pCdcd)
#define USBEndpointDescriptor_INTERRUPT
uint16_t CDCDSerialPort_GetSerialState(const CDCDSerialPort *pCdcd)
#define CDCSerialState_BREAK
void CDCDSerialPort_SetSerialState(CDCDSerialPort *pCdcd, uint16_t wSerialState)
uint8_t USBGenericRequest_GetType(const USBGenericRequest *request)
uint32_t CDCDSerialPort_RequestHandler(CDCDSerialPort *pCdcd, const USBGenericRequest *request)
void CDCLineCoding_Initialize(CDCLineCoding *lineCoding, uint32_t bitrate, uint8_t stopbits, uint8_t parity, uint8_t databits)
static void _GetLineCoding(CDCDSerialPort *pCdcd)
USBInterfaceDescriptor * pIfDesc
#define CDCSerialState_FRAMING
uint8_t USBD_Stall(uint8_t bEndpoint)
#define CDCControlLineState_RTS
static void _SetControlLineState(CDCDSerialPort *pCdcd, const USBGenericRequest *request)
static void _SetLineCoding(CDCDSerialPort *pCdcd)
uint8_t USBD_Read(uint8_t bEndpoint, void *pData, uint32_t dLength, TransferCallback fCallback, void *pArgument)
uint8_t CDCDSerialPort_GetControlLineState(const CDCDSerialPort *pCdcd)
#define USBHS
(USBHS ) Base Address
uint8_t USBD_Write(uint8_t bEndpoint, const void *pData, uint32_t dLength, TransferCallback fCallback, void *pArgument)
#define CDCLineCoding_ONESTOPBIT
void CDCDSerialPort_Initialize(CDCDSerialPort *pCdcd, USBDDriver *pUsbd, CDCDSerialPortEventHandler fEventHandler, void *pArg, uint8_t firstInterface, uint8_t numInterface)
uint32_t(* USBDescriptorParseFunction)(void *descriptor, void *parseArg)
#define CDCSerialState_OVERRUN
static CDCLineCoding lineCoding
CDCDSerialPortEventHandler fEventHandler
#define USBEndpointDescriptor_BULK
#define CDCLineCoding_NOPARITY
uint8_t USBGenericRequest_GetRequest(const USBGenericRequest *request)
void(* TransferCallback)(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
void CDCDSerialPort_GetLineCoding(const CDCDSerialPort *pCdcd, CDCLineCoding *pLineCoding)
#define CDCSerialState_RINGSIGNAL
#define CDCControlLineState_DTR
static uint32_t _Interfaces_Parse(USBGenericDescriptor *pDesc, CDCDParseData *pArg)
#define CDCSerialState_PARITY
#define CDCDSerialPortEvent_SETCONTROLLINESTATE
uint32_t(* CDCDSerialPortEventHandler)(uint32_t dwEvent, uint32_t dwParam, void *pArguments)
#define USBGenericDescriptor_INTERFACE
struct _CDCDParseData CDCDParseData
static void _SetLineCodingCallback(CDCDSerialPort *pCdcd)
uint8_t bControlLineState
TransferCallback fTransCLK
USBGenericDescriptor * CDCDSerialPort_ParseInterfaces(CDCDSerialPort *pCdcd, USBGenericDescriptor *pDescriptors, uint32_t dwLength)
#define USBGenericRequest_CLASS
#define CDCDataInterfaceDescriptor_CLASS
#define CDCGenericRequest_SETLINECODING
#define CDCGenericRequest_GETLINECODING
#define CDCCommunicationInterfaceDescriptor_CLASS
#define CDCDSerialPortEvent_SETLINECODING
Standard board header file.
#define CDCGenericRequest_SETCONTROLLINESTATE
#define USBD_STATUS_SUCCESS
#define TRACE_INFO_WP(...)
USBGenericDescriptor * USBGenericDescriptor_Parse(const USBGenericDescriptor *descriptor, uint32_t totalLength, USBDescriptorParseFunction parseFunction, void *parseArg)
uint32_t CDCDSerialPort_Read(const CDCDSerialPort *pCdcd, void *pData, uint32_t dwSize, TransferCallback fCallback, void *pArg)