88 #if defined(STM32F10X_MD)
89 #include "stm32f10x.h"
90 #elif defined(STM32F30X)
91 #include "stm32f30x.h"
93 #error UnsupportedArch
128 .MaxPacketSize = 0x40,
135 .User_GetConfiguration = NOP_Process,
137 .User_GetInterface = NOP_Process,
138 .User_SetInterface = NOP_Process,
139 .User_GetStatus = NOP_Process,
140 .User_ClearFeature = NOP_Process,
141 .User_SetEndPointFeature = NOP_Process,
142 .User_SetDeviceFeature = NOP_Process,
160 pInformation->Current_Configuration = 0;
181 pInformation->Current_Configuration = 0;
182 pInformation->Current_Interface = 0;
185 pInformation->Current_Feature = 0;
191 OTG_DEV_EP_Init(EP1_IN, OTG_DEV_EP_TYPE_INT, 2);
194 OTG_DEV_EP_Init(EP1_OUT, OTG_DEV_EP_TYPE_INT, 2);
196 SetBTABLE(BTABLE_ADDRESS);
199 SetEPType(ENDP0, EP_CONTROL);
200 SetEPTxAddr(ENDP0, ENDP0_TXADDR);
201 SetEPTxStatus(ENDP0, EP_TX_STALL);
202 Clear_Status_Out(ENDP0);
204 SetEPRxAddr(ENDP0, ENDP0_RXADDR);
208 #if defined(PIOS_INCLUDE_USB_HID)
210 SetEPType(ENDP1, EP_INTERRUPT);
211 SetEPTxAddr(ENDP1, ENDP1_TXADDR);
213 SetEPTxStatus(ENDP1, EP_TX_NAK);
215 SetEPRxAddr(ENDP1, ENDP1_RXADDR);
217 SetEPRxStatus(ENDP1, EP_RX_VALID);
220 #if defined(PIOS_INCLUDE_USB_CDC)
222 SetEPType(ENDP2, EP_INTERRUPT);
223 SetEPTxAddr(ENDP2, ENDP2_TXADDR);
224 SetEPTxStatus(ENDP2, EP_TX_NAK);
226 SetEPRxAddr(ENDP2, ENDP2_RXADDR);
228 SetEPRxStatus(ENDP2, EP_RX_DIS);
231 SetEPType(ENDP3, EP_BULK);
232 SetEPTxAddr(ENDP3, ENDP3_TXADDR);
233 SetEPTxStatus(ENDP3, EP_TX_NAK);
235 SetEPRxAddr(ENDP3, ENDP3_RXADDR);
237 SetEPRxStatus(ENDP3, EP_RX_VALID);
257 if (pInformation->Current_Configuration != 0) {
312 uint8_t *(*CopyOutRoutine) (uint16_t);
313 const uint8_t *(*CopyInRoutine) (uint16_t);
315 CopyInRoutine = NULL;
316 CopyOutRoutine = NULL;
318 switch (Type_Recipient) {
319 case (STANDARD_REQUEST | INTERFACE_RECIPIENT):
320 switch (pInformation->USBwIndex0) {
321 #if defined(PIOS_INCLUDE_USB_CDC)
328 switch (pInformation->USBwValue1) {
340 case (CLASS_REQUEST | INTERFACE_RECIPIENT):
341 switch (pInformation->USBwIndex0) {
342 #if defined(PIOS_INCLUDE_USB_CDC)
354 #if defined(PIOS_INCLUDE_USB_CDC)
380 if ((CopyInRoutine == NULL) && (CopyOutRoutine == NULL)) {
381 return USB_UNSUPPORT;
385 if ((CopyInRoutine != NULL) && (CopyOutRoutine != NULL)) {
387 return USB_UNSUPPORT;
390 if (CopyInRoutine != NULL) {
391 pInformation->Ctrl_Info.CopyDataIn = CopyInRoutine;
392 pInformation->Ctrl_Info.Usb_wOffset = 0;
393 (*CopyInRoutine) (0);
394 }
else if (CopyOutRoutine != NULL) {
395 pInformation->Ctrl_Info.CopyDataOut = CopyOutRoutine;
396 pInformation->Ctrl_Info.Usb_rOffset = 0;
397 (*CopyOutRoutine) (0);
414 switch (Type_Recipient) {
415 case (CLASS_REQUEST | INTERFACE_RECIPIENT):
416 switch (pInformation->USBwIndex0) {
417 #if defined(PIOS_INCLUDE_USB_CDC)
430 #if defined(PIOS_INCLUDE_USB_CDC)
445 return USB_UNSUPPORT;
481 uint8_t wValue0 = pInformation->USBwValue0;
524 if (AlternateSetting > 0) {
525 return USB_UNSUPPORT;
526 }
else if (Interface > 0) {
527 return USB_UNSUPPORT;
541 uint8_t wValue0 = pInformation->USBwValue0;
556 pInformation->Ctrl_Info.Usb_wLength = 1;
static void PIOS_USBHOOK_SetDeviceAddress(void)
static ONE_DESCRIPTOR Hid_Descriptor
static const uint8_t * PIOS_USBHOOK_GetStringDescriptor(uint16_t Length)
void PIOS_USB_HID_RegisterHidDescriptor(const uint8_t *desc, uint16_t desc_size)
static const uint8_t * PIOS_USBHOOK_GetHIDDescriptor(uint16_t Length)
static const uint8_t * PIOS_USBHOOK_GetConfigDescriptor(uint16_t Length)
static ONE_DESCRIPTOR Config_Descriptor
Main PiOS header to include all the compiled in PiOS options.
static ONE_DESCRIPTOR String_Descriptor[4]
static ONE_DESCRIPTOR Hid_Report_Descriptor
static void PIOS_USBHOOK_Status_Out(void)
APIs for PIOS_USBHOOK layer.
void PIOS_USB_HID_RegisterHidReport(const uint8_t *desc, uint16_t desc_size)
void PIOS_USBHOOK_Deactivate(void)
static void PIOS_USBHOOK_Status_In(void)
uint8_t * PIOS_USB_CDC_SetLineCoding(uint16_t Length)
#define PIOS_USB_BOARD_CDC_MGMT_LENGTH
USER_STANDARD_REQUESTS User_Standard_Requests
static RESULT PIOS_USBHOOK_NoData_Setup(uint8_t RequestNo)
#define PIOS_USB_BOARD_EP_NUM
const uint8_t * PIOS_USB_CDC_GetLineCoding(uint16_t Length)
static RESULT PIOS_USBHOOK_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting)
static void PIOS_USBHOOK_Reset(void)
static RESULT PIOS_USBHOOK_Data_Setup(uint8_t RequestNo)
__IO uint32_t bDeviceState
static ONE_DESCRIPTOR Device_Descriptor
int32_t PIOS_USB_ChangeConnectionState(bool connected)
void PIOS_USBHOOK_RegisterConfig(uint8_t config_id, const uint8_t *desc, uint16_t desc_size)
USB HID layer functions header.
static const uint8_t * PIOS_USBHOOK_GetReportDescriptor(uint16_t Length)
static const uint8_t * PIOS_USBHOOK_GetDeviceDescriptor(uint16_t Length)
void PIOS_USBHOOK_RegisterString(enum usb_string_desc string_id, const uint8_t *desc, uint16_t desc_size)
DEVICE_PROP Device_Property
void PIOS_USBHOOK_RegisterDevice(const uint8_t *desc, uint16_t desc_size)
static RESULT PIOS_USBHOOK_SetProtocol(void)
#define PIOS_USB_BOARD_HID_DATA_LENGTH
#define PIOS_USB_BOARD_CDC_DATA_LENGTH
RESULT PIOS_USB_CDC_SetControlLineState(void)
USB COM CDC private definitions.
static void PIOS_USBHOOK_SetConfiguration(void)
static void PIOS_USBHOOK_Init(void)
static const uint8_t * PIOS_USBHOOK_GetProtocolValue(uint16_t Length)