![]() |
PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
|
Data Structures | |
| struct | stc_bmRequestType |
| struct | stc_usb_request |
| struct | stc_usb_setup_package |
| struct | stc_usbdevice_stringdescriptor |
| struct | stc_usbdevice_reportdescriptor |
| struct | stc_usb_sof_timeout_handler |
| struct | stc_usbn_endpoint_buffer |
| struct | stc_usbn_endpoint_data |
| struct | stc_usb_intern_data |
| struct | stc_usbn_instance_data |
| USB module internal data, storing internal information for each enabled USB instance. More... | |
| struct | stc_usb_config |
| Usb configuration. More... | |
Macros | |
| #define | OFF 0U |
| #define | ON 1U |
| #define | USB_USES_DMA OFF |
| #define | USB_USE_STANDALONE OFF |
| #define | USB0_DEVICE_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB0_DEVICE |
| #define | USB0_HOST_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB0_HOST |
| #define | USB1_DEVICE_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB1_DEVICE |
| #define | USB1_HOST_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB1_HOST |
| #define | FM_PERIPHERAL_ENABLE_USB0_HOST PDL_PERIPHERAL_ENABLE_USB0_HOST |
| #define | FM_PERIPHERAL_ENABLE_USB0_DEVICE PDL_PERIPHERAL_ENABLE_USB0_DEVICE |
| #define | FM_PERIPHERAL_ENABLE_USB1_HOST PDL_PERIPHERAL_ENABLE_USB1_HOST |
| #define | FM_PERIPHERAL_ENABLE_USB1_DEVICE PDL_PERIPHERAL_ENABLE_USB1_DEVICE |
| #define | USBDEVICECDCCOM_ENABLED PDL_USBDEVICECDCCOM_ENABLED |
| #define | USBDEVICEHIDCOM_ENABLED PDL_USBDEVICEHIDCOM_ENABLED |
| #define | USBDEVICEHIDJOYSTICK_ENABLED PDL_USBDEVICEHIDJOYSTICK_ENABLED |
| #define | USBDEVICEHIDKEYBOARD_ENABLED PDL_USBDEVICEHIDKEYBOARD_ENABLED |
| #define | USBDEVICEHIDMOUSE_ENABLED PDL_USBDEVICEHIDMOUSE_ENABLED |
| #define | USBDEVICELIBUSB_ENABLED PDL_USBDEVICELIBUSB_ENABLED |
| #define | USBDEVICEPRINTER_ENABLED PDL_USBDEVICEPRINTER_ENABLED |
| #define | USBHOSTHIDCOM_ENABLED PDL_USBHOSTHIDCOM_ENABLED |
| #define | USBHOSTHIDKEYBOARD_ENABLED PDL_USBHOSTHIDKEYBOARD_ENABLED |
| #define | USBHOSTHIDMOUSE_ENABLED PDL_USBHOSTHIDMOUSE_ENABLED |
| #define | USBHOSTMASSSTORAGE_ENABLED PDL_USBHOSTMASSSTORAGE_ENABLED |
| #define | FM_PERIPHERAL_ENABLE_USB0 OFF |
| #define | FM_PERIPHERAL_ENABLE_USB1 OFF |
| #define | FM_PERIPHERAL_USB_HOST_ENABLED OFF |
| #define | USB_DISBALE_HOST_FUNCTIONALITY OFF |
| #define | FM_PERIPHERAL_USB_DEVICE_ENABLED OFF |
| #define | USB_DISBALE_DEVICE_FUNCTIONALITY OFF |
| #define | USB_ENABLED ((FM_PERIPHERAL_ENABLE_USB0 == ON) || (FM_PERIPHERAL_ENABLE_USB1 == ON)) |
| #define | USB_INTERFACES_COUNT ((FM_PERIPHERAL_ENABLE_USB0) + (FM_PERIPHERAL_ENABLE_USB1)) |
| #define | USB_INSTANCE_COUNT ((FM_PERIPHERAL_ENABLE_USB0) + (FM_PERIPHERAL_ENABLE_USB1)) |
| #define | USB_DEVICE_INTERFACES_COUNT ((FM_PERIPHERAL_ENABLE_USB0_DEVICE) + (FM_PERIPHERAL_ENABLE_USB1_DEVICE)) |
| #define | USB_HOST_INTERFACES_COUNT ((FM_PERIPHERAL_ENABLE_USB0_HOST) + (FM_PERIPHERAL_ENABLE_USB1_HOST)) |
| #define | USBDBG(x) |
| #define | USBDBGVAL8(x, y) |
| #define | USBDBGVAL16(x, y) |
| #define | USBDBGVAL32(x, y) |
| #define | DBGPROCENTER(x) |
| #define | DBGPROCRETURN(x) |
| #define | DBGSPACES(x) |
| #define | SETACTIVEFLAG(x) while((x) == FALSE) (x) = TRUE; |
| #define | CLEARACTIVEFLAG(x) while((x) == TRUE) (x) = FALSE; |
| #define | USB_ZERO_STRUCT(x) memset(&x,0,sizeof(x)) |
| #define | ZERO_STRUCT(x) memset(&x,0,sizeof(x)) |
| #define | USBDESCR_DEVICE 1 |
| #define | USBDESCR_CONFIG 2 |
| #define | USBDESCR_STRING 3 |
| #define | USBDESCR_INTERFACE 4 |
| #define | USBDESCR_ENDPOINT 5 |
| #define | USB_DEVREQ_STDTYPE 0x00 |
| #define | USB_DEVREQ_CLSTYPE 0x20 |
| #define | USB_DEVREQ_VNDTYPE 0x40 |
| #define | USB_DEVREQ_GET_DESC 0x06 |
| #define | USB_DEVREQ_SET_DESC 0x07 |
| #define | USB_DEVREQ_SET_IDLE 0x0A |
| #define | USB_GET_STATUS 0x00 |
| #define | USB_CLEAR_FEATURE 0x01 |
| #define | USB_SET_FEATURE 0x03 |
| #define | USB_SET_ADDRESS 0x05 |
| #define | USB_GET_DESCRIPTOR 0x06 |
| #define | USB_SET_DESCRIPTOR 0x07 |
| #define | USB_GET_CONFIGURATION 0x08 |
| #define | USB_SET_CONFIGURATION 0x09 |
| #define | USB_GET_INTERFACE 0x0A |
| #define | USB_SET_INTERFACE 0x0B |
| #define | USB_SYNCH_FRAME 0x0C |
| #define | USBATTR_BUSPOWER 0x80 |
| #define | USBATTR_SELFPOWER 0xC0 |
| #define | USBATTR_REMOTEWAKE 0x20 |
| #define | USB_FUNC_INTR_IN 0xF000 |
| #define | USB_FUNC_INTR_OUT 0xE000 |
| #define | USB_FUNC_BULK_IN 0xD000 |
| #define | USB_FUNC_BULK_OUT 0xC000 |
| #define | USB_MASK_EPC_PKS 0x007F |
| #define | USB_MASK_EPC_PKS1 0x01FF |
| #define | USB_MASK_EPC_STAL 0x0200 |
| #define | USB_MASK_EPC_NULE 0x0400 |
| #define | USB_MASK_EPC_DMAE 0x0800 |
| #define | USB_MASK_EPC_DIR 0x1000 |
| #define | USB_MASK_EPC_TYPE 0x6000 |
| #define | USB_MASK_EPC_EPEN 0x8000 |
| #define | USB_MASK_EPS_DRQIIE 0x4000 |
| #define | USB_MASK_EPS_BFINI 0x8000 |
| #define | USB_MASK_EPS_BFINI 0x8000 |
| #define | USB_MASK_EPS_SIZE1 0x01FF |
| #define | USB_MASK_EPS_SIZE 0x007F |
| #define | USB_MASK_EPS_SPK 0x0200 |
| #define | USB_MASK_EPS_DRQI 0x0400 |
| #define | USB_MASK_EPS_DRQO 0x0400 |
| #define | USB_MASK_EPS_DRQ 0x0400 |
| #define | USB_MASK_EPS_BUSY 0x0800 |
| #define | USB_MASK_EPS_SPKIE 0x2000 |
| #define | USB_MASK_EPS_DRQIE 0x4000 |
| #define | USB_MASK_EPS_DRQOIE 0x4000 |
| #define | BITMASK_ISSET(x, y) ((x & y) > 0) |
| #define | BITMASK_ISCLEARED(x, y) ((x & y) == 0) |
| #define | BITMASK_SET(x, y) x |= y |
| #define | BITMASK_CLEAR(x, y) x &= ~y |
| #define | __USBBITDEFINITIONS_H__ |
| #define | _UDCC_RST (1 << 7) |
| Function reset bit. More... | |
| #define | _UDCC_RESUM (1 << 6) |
| Resume setting bit. More... | |
| #define | _UDCC_HCONX (1 << 5) |
| Host connection bit. More... | |
| #define | _UDCC_USTP (1 << 4) |
| USB operation clock stop bit. More... | |
| #define | _UDCC_RFBK (1 << 1) |
| Data toggle mode bit (Rate feedback mode) More... | |
| #define | _UDCC_PWC (1 << 0) |
| Power supply control bit. More... | |
| #define | _EP0C_PKS0 0x7F |
| EP0 packet size setting bits. More... | |
| #define | _EP0C_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EPNC_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EPNC_NULE (1 << 10) |
| NULL automatic transfer enable bit. More... | |
| #define | _EPNC_DMAE (1 << 11) |
| DMA automatic transfer enable bit. More... | |
| #define | _EPNC_DIR (1 << 12) |
| Endpoint direction selection bit. More... | |
| #define | _EPNC_TYPE 0x6000 |
| Endpoint transfer type bit. More... | |
| #define | _EPNC_EPEN (1 << 15) |
| Endpoint Enable bit. More... | |
| #define | _EP1C_PKS1 0x1FF |
| EP1 packet size setting bits. More... | |
| #define | _EP1C_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EP1C_NULE (1 << 10) |
| NULL automatic transfer enable bit. More... | |
| #define | _EP1C_DMAE (1 << 11) |
| DMA automatic transfer enable bit. More... | |
| #define | _EP1C_DIR (1 << 12) |
| Endpoint direction selection bit. More... | |
| #define | _EP1C_TYPE 0x6000 |
| Endpoint transfer type bit. More... | |
| #define | _EP1C_EPEN (1 << 15) |
| Endpoint Enable bit. More... | |
| #define | _EP2C_PKS2 0xFF |
| EP2 packet size setting bits. More... | |
| #define | _EP2C_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EP2C_NULE (1 << 10) |
| NULL automatic transfer enable bit. More... | |
| #define | _EP2C_DMAE (1 << 11) |
| DMA automatic transfer enable bit. More... | |
| #define | _EP2C_DIR (1 << 12) |
| Endpoint direction selection bit. More... | |
| #define | _EP2C_TYPE 0x6000 |
| Endpoint transfer type bit. More... | |
| #define | _EP2C_EPEN (1 << 15) |
| Endpoint Enable bit. More... | |
| #define | _EP3C_PKS3 0xFF |
| EP3 packet size setting bits. More... | |
| #define | _EP3C_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EP3C_NULE (1 << 10) |
| NULL automatic transfer enable bit. More... | |
| #define | _EP3C_DMAE (1 << 11) |
| DMA automatic transfer enable bit. More... | |
| #define | _EP3C_DIR (1 << 12) |
| Endpoint direction selection bit. More... | |
| #define | _EP3C_TYPE 0x6000 |
| Endpoint transfer type bit. More... | |
| #define | _EP3C_EPEN (1 << 15) |
| Endpoint Enable bit. More... | |
| #define | _EP4C_PKS4 0xFF |
| EP4 packet size setting bits. More... | |
| #define | _EP4C_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EP4C_NULE (1 << 10) |
| NULL automatic transfer enable bit. More... | |
| #define | _EP4C_DMAE (1 << 11) |
| DMA automatic transfer enable bit. More... | |
| #define | _EP4C_DIR (1 << 12) |
| Endpoint direction selection bit. More... | |
| #define | _EP4C_TYPE 0x6000 |
| Endpoint transfer type bit. More... | |
| #define | _EP4C_EPEN (1 << 15) |
| Endpoint Enable bit. More... | |
| #define | _EP5C_PKS5 0xFF |
| EP packet size setting bits. More... | |
| #define | _EP5C_STAL (1 << 9) |
| STALL set bit. More... | |
| #define | _EP5C_NULE (1 << 10) |
| NULL automatic transfer enable bit. More... | |
| #define | _EP5C_DMAE (1 << 11) |
| DMA automatic transfer enable bit. More... | |
| #define | _EP5C_DIR (1 << 12) |
| Endpoint direction selection bit. More... | |
| #define | _EP5C_TYPE 0x6000 |
| Endpoint transfer type bit. More... | |
| #define | _EP5C_EPEN (1 << 15) |
| Endpoint Enable bit. More... | |
| #define | _EPC_TYPE_BULK 0x4000 |
| #define | _EPC_TYPE_INTERRUPT 0x6000 |
| #define | _UDCS_CONF (1 << 0) |
| Configuration detection bit. More... | |
| #define | _UDCS_SETP (1 << 1) |
| Setup stage detection bit. More... | |
| #define | _UDCS_WKUP (1 << 2) |
| Wake-up detection bit. More... | |
| #define | _UDCS_BRST (1 << 3) |
| Bus reset detection bit. More... | |
| #define | _UDCS_SOF (1 << 4) |
| SOF reception detection bit. More... | |
| #define | _UDCS_SUSP (1 << 5) |
| Suspend detection bit. More... | |
| #define | _UDCIE_CONFIE (1 << 0) |
| Configuration interrupt enable bit. More... | |
| #define | _UDCIE_CONFN (1 << 1) |
| Configuration number bit. More... | |
| #define | _UDCIE_WKUPIE (1 << 2) |
| Wake-up interrupt enable bit. More... | |
| #define | _UDCIE_BRSTIE (1 << 3) |
| Bus reset interrupt enable bit. More... | |
| #define | _UDCIE_SOFIE (1 << 4) |
| SOF receive interrupt enable bit. More... | |
| #define | _UDCIE_SUSPIE (1 << 5) |
| Suspend interrupt enable bit. More... | |
| #define | _EPNS_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EPNS_DRQ (1 << 10) |
| Packet transfer interrupt flag bit. More... | |
| #define | _EPNS_BUSY (1 << 11) |
| Busy flag bit. More... | |
| #define | _EPNS_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EPNS_DRQIE (1 << 14) |
| DRQ Interrupt enable bit. More... | |
| #define | _EPNS_BFINI (1 << 15) |
| Transmission/Reception buffer initialization bit. More... | |
| #define | _EP0IS_DRQI (1 << 10) |
| Transmit Data interrupt request bit. More... | |
| #define | _EP0IS_DRQIIE (1 << 14) |
| Transmit Data Interrupt enable bit. More... | |
| #define | _EP0IS_BFINI (1 << 15) |
| Transmission buffer initialization bit. More... | |
| #define | _EP0OS_SIZE 0x7F |
| Packet size bits. More... | |
| #define | _EP0OS_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EP0OS_DRQO (1 << 10) |
| Received data interrupt flag bit. More... | |
| #define | _EP0OS_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EP0OS_DRQOIE (1 << 14) |
| Receive Data Interrupt enable bit. More... | |
| #define | _EP0OS_BFINI (1 << 15) |
| Receive buffer initialization bit. More... | |
| #define | _EP1S_SIZE 0x1FF |
| Packet size bits. More... | |
| #define | _EP1S_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EP1S_DRQ (1 << 10) |
| Packet transfer interrupt flag bit. More... | |
| #define | _EP1S_BUSY (1 << 11) |
| Busy flag bit. More... | |
| #define | _EP1S_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EP1S_DRQIE (1 << 14) |
| DRQ Interrupt enable bit. More... | |
| #define | _EP1S_BFINI (1 << 15) |
| Transmission/Reception buffer initialization bit. More... | |
| #define | _EP2S_SIZE 0xFF |
| Packet size bits. More... | |
| #define | _EP2S_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EP2S_DRQ (1 << 10) |
| Packet transfer interrupt flag bit. More... | |
| #define | _EP2S_BUSY (1 << 11) |
| Busy flag bit. More... | |
| #define | _EP2S_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EP2S_DRQIE (1 << 14) |
| DRQ Interrupt enable bit. More... | |
| #define | _EP2S_BFINI (1 << 15) |
| Transmission/Reception buffer initialization bit. More... | |
| #define | _EP3S_SIZE 0xFF |
| Packet size bits. More... | |
| #define | _EP3S_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EP3S_DRQ (1 << 10) |
| Packet transfer interrupt flag bit. More... | |
| #define | _EP3S_BUSY (1 << 11) |
| Busy flag bit. More... | |
| #define | _EP3S_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EP3S_DRQIE (1 << 14) |
| DRQ Interrupt enable bit. More... | |
| #define | _EP3S_BFINI (1 << 15) |
| Transmission/Reception buffer initialization bit. More... | |
| #define | _EP4S_SIZE 0xFF |
| Packet size bits. More... | |
| #define | _EP4S_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EP4S_DRQ (1 << 10) |
| Packet transfer interrupt flag bit. More... | |
| #define | _EP4S_BUSY (1 << 11) |
| Busy flag bit. More... | |
| #define | _EP4S_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EP4S_DRQIE (1 << 14) |
| DRQ Interrupt enable bit. More... | |
| #define | _EP4S_BFINI (1 << 15) |
| Transmission/Reception buffer initialization bit. More... | |
| #define | _EP5S_SIZE 0xFF |
| Packet size bits. More... | |
| #define | _EP5S_SPK (1 << 9) |
| Short Packet interrupt flag bit. More... | |
| #define | _EP5S_DRQ (1 << 10) |
| Packet transfer interrupt flag bit. More... | |
| #define | _EP5S_BUSY (1 << 11) |
| Busy flag bit. More... | |
| #define | _EP5S_SPKIE (1 << 13) |
| Short packet interrupt enable bit. More... | |
| #define | _EP5S_DRQIE (1 << 14) |
| DRQ Interrupt enable bit. More... | |
| #define | _EP5S_BFINI (1 << 15) |
| Transmission/Reception buffer initialization bit. More... | |
| #define | _HCNT_HOST (1 << 0) |
| HOST Mode bit. More... | |
| #define | _HCNT_URST (1 << 1) |
| USB Bus Reset bit. More... | |
| #define | _HCNT_SOFIRE (1 << 2) |
| SOF interrupt Enable bit. More... | |
| #define | _HCNT_DIRE (1 << 3) |
| Disconnection interrupt Enable bit. More... | |
| #define | _HCNT_CNNIRE (1 << 4) |
| Connection interrupt Enable bit. More... | |
| #define | _HCNT_CMPIRE (1 << 5) |
| Completion interrupt Enable bit. More... | |
| #define | _HCNT_URIRE (1 << 6) |
| USB bus Reset interrupt Enable bit. More... | |
| #define | _HCNT_RWKIRE (1 << 7) |
| Remote Wake-up interrupt Enable bit. More... | |
| #define | _HCNT_RETRY (1 << 8) |
| Retry enable bit. More... | |
| #define | _HCNT_CANCEL (1 << 9) |
| Token cancel enable bit. More... | |
| #define | _HCNT_SOFSTEP (1 << 10) |
| SOF interrupt trigger bit. More... | |
| #define | _HIRQ_SOFIRQ (1 << 0) |
| HOST Mode bit. More... | |
| #define | _HIRQ_DIRQ (1 << 1) |
| USB Bus Reset bit. More... | |
| #define | _HIRQ_CNNIRQ (1 << 2) |
| SOF interrupt Enable bit. More... | |
| #define | _HIRQ_CMPIRQ (1 << 3) |
| Disconnection interrupt Enable bit. More... | |
| #define | _HIRQ_URIRQ (1 << 4) |
| Connection interrupt Enable bit. More... | |
| #define | _HIRQ_RWKIRQ (1 << 5) |
| Completion interrupt Enable bit. More... | |
| #define | _HIRQ_TCAN (1 << 7) |
| Remote Wake-up interrupt Enable bit. More... | |
| #define | _HERR_HS 0x03 |
| Handshake Status. More... | |
| #define | _HERR_STUFF (1 << 2) |
| Stuffing Error bit. More... | |
| #define | _HERR_TGERR (1 << 3) |
| Toggle Error bit. More... | |
| #define | _HERR_CRC (1 << 4) |
| CRC Error bit. More... | |
| #define | _HERR_TOUT (1 << 5) |
| Time Out bit. More... | |
| #define | _HERR_RERR (1 << 6) |
| Receive Error bit. More... | |
| #define | _HERR_LSTSOF (1 << 7) |
| Lost SOF bit. More... | |
| #define | _HSTATE_CSTAT (1 << 0) |
| Connection status bit. More... | |
| #define | _HSTATE_TMODE (1 << 1) |
| Transfer Mode bit. More... | |
| #define | _HSTATE_SUSP (1 << 2) |
| Suspend bit. More... | |
| #define | _HSTATE_SOFBUSY (1 << 3) |
| SOF timer operation bit. More... | |
| #define | _HSTATE_CLKSEL (1 << 4) |
| Clock Selection bit (Full / Low Speed) More... | |
| #define | _HSTATE_ALIVE (1 << 5) |
| keep alive bit (for low speed) More... | |
| #define | __IO volatile |
| #define | __USBSPEC_H__ |
| #define | GET_DESCRIPTOR 0x06 |
| #define | USB_DEVICE_DESCRIPTOR_TYPE 0x01 |
| Usb Device Descriptor Type. More... | |
| #define | USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 |
| Usb Configuration Descriptor Type. More... | |
| #define | USB_STRING_DESCRIPTOR_TYPE 0x03 |
| Usb String Descriptor Type. More... | |
| #define | USB_INTERFACE_DESCRIPTOR_TYPE 0x04 |
| Usb Interface Descriptor Type. More... | |
| #define | USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 |
| Usb Endpoint Descriptor Type. More... | |
| #define | USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 0x06 |
| Usb Device Qualifier Descriptor Type. More... | |
| #define | USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07 |
| Usb Other Speed Configuratuion Descriptor Type. More... | |
| #define | USB_HID_DESCRIPTOR_TYPE 0x21 |
| Usb HID Descriptor Type. More... | |
| #define | USB_IN_DIRECTION 0x80 |
| Usb IN direction. More... | |
| #define | USB_OUT_DIRECTION 0x00 |
| Usb OUT direction. More... | |
| #define | USB_EP_TYPE_CONTROL 0x00 |
| Control Endpoint Type. More... | |
| #define | USB_EP_TYPE_ISO 0x01 |
| ISO Endpoint Type. More... | |
| #define | USB_EP_TYPE_BULK 0x02 |
| Bulk Endpoint Type. More... | |
| #define | USB_EP_TYPE_INT 0x03 |
| Interrupt Endpoint Type. More... | |
| #define | bL3_FM3_GPIO_EPFR00_USB0PE *((volatile unsigned int*)(0x4266C024UL)) |
| #define | bL3_FM3_GPIO_PFR6_P1 *((volatile unsigned int*)(0x42660304UL)) |
| #define | bL3_FM3_GPIO_SPSR_USB0C *((volatile unsigned int*)(0x4266B010UL)) |
| #define | bL3_FM3_GPIO_EPFR00_USB1PE *((volatile unsigned int*)(0x4266C034UL)) |
| #define | bL3_FM3_GPIO_PFR2_P0 *((volatile unsigned int*)(0x42660100UL)) |
| #define | bL3_FM3_GPIO_SPSR_USB1C *((volatile unsigned int*)(0x4266B014UL)) |
Functions | |
| en_result_t | Usb_Configure (stc_usbn_t *pstcUsb, stc_usb_config_t *pstcConfig) |
| Initialize USB in general. More... | |
| en_result_t | Usb_Init (void) |
| Initialize USB in general. More... | |
| en_result_t | Usb_SetupHalEndpoint (stc_usbn_t *pstcUsb, uint8_t u8EndpointAddress, uint16_t u16FifoSize, en_usb_ep_type_t enType, boolean_t bInterruptsEnabled) |
| Setup USB HAL endpoint. More... | |
| en_result_t | Usb_SwitchUsb (stc_usbn_t *pstcUsb, en_usb_switch_t enType, uint32_t u32SwitchDelay) |
| Switch "Task" between host / device mode. More... | |
| en_result_t | Usb_InitInstance (stc_usbn_t *pstcUsb) |
| Init USB instance. More... | |
| en_result_t | Usb_DeinitInstance (stc_usbn_t *pstcUsb) |
| Deinit USB instance. More... | |
| stc_usbn_endpoint_data_t * | Usb_GetEndpointPtr (stc_usbn_t *pstcUsb, uint8_t u8EndpointAddress) |
| Get endpoint pointer from endpointaddress. More... | |
| en_result_t | Usb_HalSend (stc_usbn_endpoint_data_t *pstcEpHandle, uint8_t *pu8Data, uint16_t u16Size, uint16_t *pu16ByteCount) |
| Send data via endpoint. More... | |
| en_result_t | Usb_HalReceive (stc_usbn_endpoint_data_t *pstcEpHandle, uint8_t *pu8Data, uint16_t *pu16ByteCount, boolean_t bClearDrq) |
| Read data via endpoint. More... | |
| en_result_t | Usb_HalClearDrq (stc_usbn_endpoint_data_t *pstcEpHandle) |
| Clear Drq flag of FIFO: FIFO ready for next data. More... | |
| en_result_t | Usb_HalStallEndpoint (stc_usbn_endpoint_data_t *pstcEpHandle) |
| Stall endpoint. More... | |
| en_result_t | Usb_HalUnstallEndpoint (stc_usbn_endpoint_data_t *pstcEpHandle) |
| Unstall endpoint. More... | |
| boolean_t | Usb_HalEpReady (stc_usbn_endpoint_data_t *pstcEpHandle) |
| Get information if the specified endpoint is ready. More... | |
| boolean_t | Usb_HalEndpointIsBusy (stc_usbn_endpoint_data_t *pstcEpHandle) |
| Unstall endpoint. More... | |
| uint8_t | Usb_GetConfiguration (stc_usbn_t *pstcUsb) |
| boolean_t | Usb_AddTimeOut (stc_usbn_t *pstcUsb, void(*Handler)(stc_usbn_t *pstcUsb), uint16_t u16TimeOut) |
| void | Usb_RemoveTimeOut (stc_usbn_t *pstcUsb, void(*Handler)(stc_usbn_t *pstcUsb)) |
| void | Usb_SetEndpointRxTxCallback (stc_usbn_endpoint_data_t *pstcEndpoint, usb_endpoint_datatransferred_func_ptr_t pfnRxTxCallback) |
| Set RxTx Callback of an endpoint. More... | |
| void | Usb_OsTickHandle (void) |
| void | UsbIrqHandler (stc_usbn_t *pstcUsb, stc_usb_intern_data_t *pstcUsbInternData) |
| void | UsbConfig_UsbInit (void) |
| void | UsbConfig_SwitchMode (void) |
Variables | |
| stc_usbn_instance_data_t | m_astcUsbInstanceDataLut [] |
| Look-up table for all enabled USB instances and their internal data. More... | |
| static boolean_t | UsbInitDone = FALSE |
| stc_usbn_instance_data_t | m_astcUsbInstanceDataLut [] |
| Macro to return the number of enabled USB instances. More... | |
| static stc_usb_intern_data_t * | UsbGetInternDataPtr (stc_usbn_t *pstcUsb) |
| Return the internal data for a certain USB instance. More... | |
| static en_result_t | Usb_InitIrq (stc_usbn_t *pstcUsb) |
| Device dependent initialization of interrupts according CMSIS with level defined in l3.h. More... | |
| static en_result_t | Usb_DeinitIrq (stc_usbn_t *pstcUsb) |
| Device dependent deinitialization of interrupts according CMSIS with level defined in l3.h. More... | |
| static void | Usb_TimeoutHandler (stc_usbn_t *pstcUsb) |
| void | UsbHost_DisconnectionCallback (stc_usbn_t *pstcUsb) |
| en_usb_endpoint_status_t | Usb_HalEndpointStatus (stc_usbn_endpoint_data_t *pstcEpHandle) |
| Get information about the specified endpoint status. More... | |
| void | Usb_Tick (void) |
| void | USB_Handler (void) |
| void | USB0_Handler (void) |
| void | USB0_HOST_IRQHandler (void) |
| void | USB1_Handler (void) |
Provided functions of USB module:
Used to initialize the HAL and using low level functionality. Usb_Configure() is used to setup the low level driver. Usb_SetupHalEndpoint() is used to setup an endpoint in hardware (for device mode). Usb_SwitchUsb() can be called, to switch USB on or off or between host and device functionality. Usb_SwitchUsb() is called cyclic or via external interrupt when VBUS state changes. Usb_InitInstance() initializes all neccesary registers. Usb_GetEndpointPtr() returns pointer of endpoint struct. Usb_HalSend() and Usb_HalReceive() can be used to transfer data to or from the endpoint FIFO. Usb_HalEpReady() gives an information wether the endpoint is ready to use while Usb_HalEndpointIsBusy() gives the information if the endpoint is transferring data. While endpoints having double buffers, the endpoint can be ready for next data, but is still busy. Usb_GetConfiguration() returns if the HAL in device mode is configured or not. Usb_AddTimeOut() adds timeout functionality via SOF interrupt. Usb_RemoveTimeOut() removes timeouts.
| #define __IO volatile |
Defines 'read / write' permissions
Definition at line 1202 of file usb.h.
Referenced by Usb_HalReceive(), and Usb_HalSend().
| #define _EP0IS_BFINI (1 << 15) |
| #define _EP0IS_DRQI (1 << 10) |
| #define _EP0IS_DRQIIE (1 << 14) |
| #define _EP0OS_BFINI (1 << 15) |
| #define _EP0OS_DRQO (1 << 10) |
| #define _EP0OS_DRQOIE (1 << 14) |
| #define _EP0OS_SPKIE (1 << 13) |
| #define _EP1C_DIR (1 << 12) |
| #define _EP1C_DMAE (1 << 11) |
| #define _EP1C_NULE (1 << 10) |
| #define _EP1S_BFINI (1 << 15) |
| #define _EP1S_DRQ (1 << 10) |
| #define _EP1S_SPKIE (1 << 13) |
| #define _EP2C_DIR (1 << 12) |
| #define _EP2C_DMAE (1 << 11) |
| #define _EP2C_NULE (1 << 10) |
| #define _EP2S_BFINI (1 << 15) |
| #define _EP2S_DRQ (1 << 10) |
| #define _EP2S_SPKIE (1 << 13) |
| #define _EP3C_DIR (1 << 12) |
| #define _EP3C_DMAE (1 << 11) |
| #define _EP3C_NULE (1 << 10) |
| #define _EP3S_BFINI (1 << 15) |
| #define _EP3S_DRQ (1 << 10) |
| #define _EP3S_SPKIE (1 << 13) |
| #define _EP4C_DIR (1 << 12) |
| #define _EP4C_DMAE (1 << 11) |
| #define _EP4C_NULE (1 << 10) |
| #define _EP4S_BFINI (1 << 15) |
| #define _EP4S_DRQ (1 << 10) |
| #define _EP4S_SPKIE (1 << 13) |
| #define _EP5C_DIR (1 << 12) |
| #define _EP5C_DMAE (1 << 11) |
| #define _EP5C_NULE (1 << 10) |
| #define _EP5S_BFINI (1 << 15) |
| #define _EP5S_DRQ (1 << 10) |
| #define _EP5S_SPKIE (1 << 13) |
| #define _EPNC_DIR (1 << 12) |
| #define _EPNC_DMAE (1 << 11) |
| #define _EPNC_EPEN (1 << 15) |
Endpoint Enable bit.
Definition at line 1048 of file usb.h.
Referenced by Usb_HalEndpointStatus(), Usb_HalEpReady(), and Usb_SetupHalEndpoint().
| #define _EPNC_NULE (1 << 10) |
| #define _EPNC_STAL (1 << 9) |
STALL set bit.
Definition at line 1043 of file usb.h.
Referenced by Usb_HalEndpointStatus(), Usb_HalStallEndpoint(), and Usb_HalUnstallEndpoint().
| #define _EPNS_BFINI (1 << 15) |
Transmission/Reception buffer initialization bit.
Definition at line 1112 of file usb.h.
Referenced by UsbIrqHandler().
| #define _EPNS_BUSY (1 << 11) |
| #define _EPNS_DRQ (1 << 10) |
Packet transfer interrupt flag bit.
Definition at line 1108 of file usb.h.
Referenced by Usb_HalClearDrq(), Usb_HalEndpointStatus(), Usb_HalEpReady(), Usb_HalReceive(), and Usb_HalSend().
| #define _EPNS_DRQIE (1 << 14) |
DRQ Interrupt enable bit.
Definition at line 1111 of file usb.h.
Referenced by Usb_SetEndpointRxTxCallback(), and Usb_SetupHalEndpoint().
| #define _EPNS_SPKIE (1 << 13) |
| #define _HCNT_CMPIRE (1 << 5) |
| #define _HCNT_CNNIRE (1 << 4) |
| #define _HCNT_DIRE (1 << 3) |
| #define _HCNT_RWKIRE (1 << 7) |
| #define _HCNT_URIRE (1 << 6) |
| #define _HIRQ_CMPIRQ (1 << 3) |
| #define _HIRQ_RWKIRQ (1 << 5) |
| #define _HIRQ_TCAN (1 << 7) |
| #define _HIRQ_URIRQ (1 << 4) |
| #define _HSTATE_ALIVE (1 << 5) |
| #define _HSTATE_CLKSEL (1 << 4) |
| #define _UDCC_RFBK (1 << 1) |
| #define _UDCIE_BRSTIE (1 << 3) |
| #define _UDCIE_CONFIE (1 << 0) |
| #define _UDCIE_SOFIE (1 << 4) |
| #define BITMASK_CLEAR | ( | x, | |
| y | |||
| ) | x &= ~y |
Definition at line 1027 of file usb.h.
Referenced by Usb_HalClearDrq(), Usb_HalReceive(), Usb_HalSend(), Usb_HalUnstallEndpoint(), Usb_SetEndpointRxTxCallback(), Usb_SetupHalEndpoint(), and UsbIrqHandler().
| #define BITMASK_ISCLEARED | ( | x, | |
| y | |||
| ) | ((x & y) == 0) |
Definition at line 1019 of file usb.h.
Referenced by Usb_HalClearDrq(), Usb_HalEndpointStatus(), Usb_HalEpReady(), Usb_HalReceive(), and Usb_HalSend().
| #define BITMASK_ISSET | ( | x, | |
| y | |||
| ) | ((x & y) > 0) |
Definition at line 1015 of file usb.h.
Referenced by Usb_HalEndpointIsBusy(), and Usb_HalEndpointStatus().
| #define BITMASK_SET | ( | x, | |
| y | |||
| ) | x |= y |
Definition at line 1023 of file usb.h.
Referenced by Usb_HalStallEndpoint(), Usb_SetEndpointRxTxCallback(), Usb_SetupHalEndpoint(), and UsbIrqHandler().
| #define bL3_FM3_GPIO_EPFR00_USB0PE *((volatile unsigned int*)(0x4266C024UL)) |
Definition at line 1228 of file usb.h.
Referenced by Usb_Init().
| #define bL3_FM3_GPIO_EPFR00_USB1PE *((volatile unsigned int*)(0x4266C034UL)) |
Definition at line 1231 of file usb.h.
Referenced by Usb_Init().
| #define bL3_FM3_GPIO_PFR2_P0 *((volatile unsigned int*)(0x42660100UL)) |
Definition at line 1232 of file usb.h.
Referenced by Usb_Init().
| #define bL3_FM3_GPIO_PFR6_P1 *((volatile unsigned int*)(0x42660304UL)) |
Definition at line 1229 of file usb.h.
Referenced by Usb_Init().
| #define bL3_FM3_GPIO_SPSR_USB0C *((volatile unsigned int*)(0x4266B010UL)) |
Definition at line 1230 of file usb.h.
Referenced by Usb_Init().
| #define bL3_FM3_GPIO_SPSR_USB1C *((volatile unsigned int*)(0x4266B014UL)) |
Definition at line 1233 of file usb.h.
Referenced by Usb_Init().
| #define FM_PERIPHERAL_ENABLE_USB0_DEVICE PDL_PERIPHERAL_ENABLE_USB0_DEVICE |
| #define FM_PERIPHERAL_ENABLE_USB0_HOST PDL_PERIPHERAL_ENABLE_USB0_HOST |
| #define FM_PERIPHERAL_ENABLE_USB1_DEVICE PDL_PERIPHERAL_ENABLE_USB1_DEVICE |
| #define FM_PERIPHERAL_ENABLE_USB1_HOST PDL_PERIPHERAL_ENABLE_USB1_HOST |
| #define USB0_DEVICE_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB0_DEVICE |
| #define USB0_HOST_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB0_HOST |
| #define USB1_DEVICE_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB1_DEVICE |
| #define USB1_HOST_IRQ_ENABLED PDL_INTERRUPT_ENABLE_USB1_HOST |
| #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 |
Usb Configuration Descriptor Type.
Definition at line 1211 of file usb.h.
Referenced by ReturnedConfigurationDescriptor().
| #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 |
| #define USB_DEVICE_INTERFACES_COUNT ((FM_PERIPHERAL_ENABLE_USB0_DEVICE) + (FM_PERIPHERAL_ENABLE_USB1_DEVICE)) |
| #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 0x06 |
| #define USB_ENABLED ((FM_PERIPHERAL_ENABLE_USB0 == ON) || (FM_PERIPHERAL_ENABLE_USB1 == ON)) |
| #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 |
| #define USB_HID_DESCRIPTOR_TYPE 0x21 |
| #define USB_HOST_INTERFACES_COUNT ((FM_PERIPHERAL_ENABLE_USB0_HOST) + (FM_PERIPHERAL_ENABLE_USB1_HOST)) |
| #define USB_IN_DIRECTION 0x80 |
Usb IN direction.
Definition at line 1219 of file usb.h.
Referenced by UsbHostHidCom_InitHandler(), UsbHostHidKeyboard_InitHandler(), UsbHostHidMouse_InitHandler(), and UsbHostMassStorage_InitHandler().
| #define USB_INSTANCE_COUNT ((FM_PERIPHERAL_ENABLE_USB0) + (FM_PERIPHERAL_ENABLE_USB1)) |
Definition at line 372 of file usb.h.
Referenced by Usb_Init(), and UsbGetInternDataPtr().
| #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 |
| #define USB_INTERFACES_COUNT ((FM_PERIPHERAL_ENABLE_USB0) + (FM_PERIPHERAL_ENABLE_USB1)) |
| #define USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07 |
| #define USB_STRING_DESCRIPTOR_TYPE 0x03 |
| #define USBDBG | ( | x | ) |
Definition at line 389 of file usb.h.
Referenced by ReturnedConfigurationDescriptor(), ReturnedDeviceDescriptor(), Usb_InitIrq(), UsbClassSupervisor_SysTickHandler(), UsbHostHidKeyboard_InitHandler(), UsbHostHidMouse_InitHandler(), and UsbIrqHandler().
| #define USBDBGVAL8 | ( | x, | |
| y | |||
| ) |
Definition at line 390 of file usb.h.
Referenced by Usb_HalSend(), UsbHostHidKeyboard_InitHandler(), and UsbHostHidMouse_InitHandler().
| #define USBDESCR_ENDPOINT 5 |
Definition at line 960 of file usb.h.
Referenced by UsbDeviceCdcCom_Init(), UsbDeviceCmsisDap_Init(), UsbDeviceHidCom_Init(), UsbDeviceHidJoystick_Init(), UsbDeviceHidKeyboard_Init(), UsbDeviceHidMouse_Init(), and UsbDevicePrinter_Init().
| #define USBDEVICECDCCOM_ENABLED PDL_USBDEVICECDCCOM_ENABLED |
| #define USBDEVICEHIDCOM_ENABLED PDL_USBDEVICEHIDCOM_ENABLED |
| #define USBDEVICEHIDJOYSTICK_ENABLED PDL_USBDEVICEHIDJOYSTICK_ENABLED |
| #define USBDEVICEHIDKEYBOARD_ENABLED PDL_USBDEVICEHIDKEYBOARD_ENABLED |
| #define USBDEVICEHIDMOUSE_ENABLED PDL_USBDEVICEHIDMOUSE_ENABLED |
| #define USBDEVICELIBUSB_ENABLED PDL_USBDEVICELIBUSB_ENABLED |
| #define USBDEVICEPRINTER_ENABLED PDL_USBDEVICEPRINTER_ENABLED |
| #define USBHOSTHIDCOM_ENABLED PDL_USBHOSTHIDCOM_ENABLED |
| #define USBHOSTHIDKEYBOARD_ENABLED PDL_USBHOSTHIDKEYBOARD_ENABLED |
| #define USBHOSTHIDMOUSE_ENABLED PDL_USBHOSTHIDMOUSE_ENABLED |
| #define USBHOSTMASSSTORAGE_ENABLED PDL_USBHOSTMASSSTORAGE_ENABLED |
| #define ZERO_STRUCT | ( | x | ) | memset(&x,0,sizeof(x)) |
Definition at line 402 of file usb.h.
Referenced by UsbHostMassStorage_BulkOnlyMSReset(), UsbHostMassStorage_GetCSW(), UsbHostMassStorage_SendCBW(), UsbHostMassStorage_StorageApiInit(), UsbHostMassStorage_StorageApiModeSense(), UsbHostMassStorage_StorageApiRead(), UsbHostMassStorage_StorageApiReadCapacity(), UsbHostMassStorage_StorageApiWrite(), and UsbHostMassStorage_TestUnitReady().
| typedef enum en_usb_control_stage en_usb_control_stage_t |
USB control stage.
| typedef enum en_usb_dma_instance_index en_usb_dma_instance_index_t |
Enumeration to define an index for each enabled USB DMA instance.
| typedef enum en_usb_endpoint_status en_usb_endpoint_status_t |
USB control stage.
| typedef enum en_usb_ep_type en_usb_ep_type_t |
| typedef enum en_usb_extint_param en_usb_extint_param_t |
| typedef enum en_usb_gpio_param en_usb_gpio_param_t |
| typedef enum en_usb_instance_index en_usb_instance_index_t |
Enumeration to define an index for each enabled USB instance.
| typedef enum en_usb_mode en_usb_mode_t |
Usb mode.
To select between device and host
| typedef enum en_usb_status en_usb_status_t |
Usb Status.
| typedef enum en_usb_switch en_usb_switch_t |
Usb force switch to.
| typedef struct stc_bmRequestType stc_bmRequestType_t |
| typedef struct stc_usb_config stc_usb_config_t |
Usb configuration.
Contains all parameter for configuratin an USB channel.
| typedef struct stc_usb_intern_data stc_usb_intern_data_t |
| typedef struct stc_usb_request stc_usb_request_t |
| typedef struct stc_usb_setup_package stc_usb_setup_package_t |
| typedef struct stc_usb_sof_timeout_handler stc_usb_sof_timeout_handler_t |
| typedef struct stc_usbdevice_reportdescriptor stc_usbdevice_reportdescriptor_t |
| typedef struct stc_usbdevice_stringdescriptor stc_usbdevice_stringdescriptor_t |
USB_MODULE End USB Module
| typedef struct stc_usbn_endpoint_buffer stc_usbn_endpoint_buffer_t |
| typedef struct stc_usbn_endpoint_data stc_usbn_endpoint_data_t |
| typedef struct stc_usbn_instance_data stc_usbn_instance_data_t |
USB module internal data, storing internal information for each enabled USB instance.
| typedef void(* usb_cmpirq_isr_func_ptr_t)(stc_usbn_t *pstcUsb) |
| typedef void(* usb_cnnirq_isr_func_ptr_t)(stc_usbn_t *pstcUsb) |
| typedef boolean_t(* usb_device_alternative_hconx_t)(en_usb_gpio_param_t enType) |
| typedef void(* usb_device_init_t)(stc_usbn_t *pstcUsb, struct stc_usb_config *pstcConfig) |
| typedef boolean_t(* usb_device_vbus_t)(en_usb_extint_param_t enType) |
| typedef void(* usb_disconnect_func_ptr_t)(stc_usbn_t *pstcUsb) |
| typedef void(* usb_endpoint_datatransferred_func_ptr_t)(stc_usbn_t *pstcUsb, struct stc_usbn_endpoint_data *pstcEndpoint) |
| typedef void(* usb_host_init_t)(stc_usbn_t *pstcUsb, struct stc_usb_config *pstcConfig) |
| typedef boolean_t(* usb_host_overcurrent_t)(en_usb_extint_param_t enType) |
| typedef boolean_t(* usb_host_pulldown_t)(en_usb_gpio_param_t enType) |
| typedef boolean_t(* usb_host_vbus_t)(en_usb_gpio_param_t enType) |
| typedef void(* usb_rwkirq_isr_func_ptr_t)(stc_usbn_t *pstcUsb) |
| typedef void(* usb_urirq_isr_func_ptr_t)(stc_usbn_t *pstcUsb) |
| enum en_usb_control_stage |
| enum en_usb_ep_type |
| enum en_usb_extint_param |
| enum en_usb_gpio_param |
| enum en_usb_mode |
| enum en_usb_status |
| enum en_usb_switch |
| void USB0_Handler | ( | void | ) |
USB 0 interrupt handler (only used in standalone mode)
Definition at line 1888 of file usb.c.
References UsbInstanceIndexUsb0, and UsbIrqHandler().

| void USB0_HOST_IRQHandler | ( | void | ) |
Definition at line 1924 of file usb.c.
References UsbInstanceIndexUsb0, and UsbIrqHandler().

| void USB1_Handler | ( | void | ) |
USB 1 interrupt handler (only used in standalone mode)
Definition at line 1949 of file usb.c.
References UsbInstanceIndexUsb1, and UsbIrqHandler().

| boolean_t Usb_AddTimeOut | ( | stc_usbn_t * | pstcUsb, |
| void(*)(stc_usbn_t *pstcUsb) | Handler, | ||
| uint16_t | u16TimeOut | ||
| ) |
Add a timeout handler
| pstcUsb | USB handle |
| Handler | handler executed after timeout |
| u16TimeOut | timeout in ms |
Definition at line 1768 of file usb.c.
References stc_usb_intern_data::bSofTimeoutEnabled, ErrorUninitialized, FALSE, stc_usb_sof_timeout_handler::Handler, stc_usb_intern_data::pstcUsbTimeOutHandler, TRUE, stc_usb_sof_timeout_handler::u16TimeOut, and UsbGetInternDataPtr().
Referenced by ReturnedConfigurationDescriptor(), ReturnedDeviceDescriptor(), UsbClassSupervisor_Init(), and UsbClassSupervisor_SysTickHandler().


| en_result_t Usb_Configure | ( | stc_usbn_t * | pstcUsb, |
| stc_usb_config_t * | pstcConfig | ||
| ) |
Initialize USB in general.
| pstcUsb | USB handle |
| pstcConfig | USB configuration |
Definition at line 393 of file usb.c.
References stc_usb_intern_data::bDeviceEnabled, stc_usb_intern_data::bHostEnabled, stc_usb_intern_data::bUsbInstanceSet, stc_usb_config::bUseInterrupts, ErrorUninitialized, FALSE, Ok, stc_usb_intern_data::pfnConfCallback, stc_usb_config::pfnConfCallback, stc_usb_intern_data::pfnDeviceInit, stc_usb_config::pfnDeviceInit, stc_usb_intern_data::pfnDeviceVbus, stc_usb_config::pfnDeviceVbus, stc_usb_intern_data::pfnHostInit, stc_usb_config::pfnHostInit, stc_usb_intern_data::pfnHostOvercurrent, stc_usb_config::pfnHostOvercurrent, stc_usb_intern_data::pfnHostPullDownHostEnable, stc_usb_config::pfnHostPullDownHostEnable, stc_usb_intern_data::pfnHostVbus, stc_usb_config::pfnHostVbus, stc_usb_intern_data::pfnSetpCallback, stc_usb_config::pfnSetpCallback, stc_usb_intern_data::pfnSofCallback, stc_usb_config::pfnSofCallback, TRUE, Usb_DeinitIrq(), Usb_Init(), Usb_InitInstance(), Usb_InitIrq(), UsbExtIntEnableIsr, UsbExtIntGetLevel, UsbExtIntInit, UsbExtIntSetHighDetect, UsbExtIntSetLowDetect, UsbGetInternDataPtr(), UsbGpioClear, UsbGpioInit, and UsbInitDone.

| en_result_t Usb_DeinitInstance | ( | stc_usbn_t * | pstcUsb | ) |
|
static |
Device dependent deinitialization of interrupts according CMSIS with level defined in l3.h.
| pstcUsb | Pointer to USB instance |
Definition at line 330 of file usb.c.
References Ok.
Referenced by Usb_Configure().

| uint8_t Usb_GetConfiguration | ( | stc_usbn_t * | pstcUsb | ) |
| stc_usbn_endpoint_data_t* Usb_GetEndpointPtr | ( | stc_usbn_t * | pstcUsb, |
| uint8_t | u8EndpointAddress | ||
| ) |
Get endpoint pointer from endpointaddress.
| pstcUsb | Pointer to USB instance |
| u8EndpointAddress | u8EndpointAddress |
Definition at line 1261 of file usb.c.
References stc_usb_intern_data::astcEndpoints, stc_usbn_endpoint_data::u8EndpointAddress, stc_usb_intern_data::u8NumberOfEndpoints, and UsbGetInternDataPtr().

| en_result_t Usb_HalClearDrq | ( | stc_usbn_endpoint_data_t * | pstcEpHandle | ) |
Clear Drq flag of FIFO: FIFO ready for next data.
| pstcEpHandle | Pointer to endpoint instance |
Definition at line 1611 of file usb.c.
References _EPNS_DRQ, BITMASK_CLEAR, BITMASK_ISCLEARED, ErrorInvalidParameter, ErrorNotReady, Ok, and stc_usbn_endpoint_data::pstcEpStatusRegister.
| boolean_t Usb_HalEndpointIsBusy | ( | stc_usbn_endpoint_data_t * | pstcEpHandle | ) |
Unstall endpoint.
| pstcEpHandle | Pointer to endpoint instance |
Definition at line 1332 of file usb.c.
References _EPNS_BUSY, BITMASK_ISSET, FALSE, stc_usbn_endpoint_data::pstcEpStatusRegister, and TRUE.
| en_usb_endpoint_status_t Usb_HalEndpointStatus | ( | stc_usbn_endpoint_data_t * | pstcEpHandle | ) |
Get information about the specified endpoint status.
| pstcEpHandle | Endpoint handle |
Definition at line 1635 of file usb.c.
References _EPNC_EPEN, _EPNC_STAL, _EPNS_DRQ, BITMASK_ISCLEARED, BITMASK_ISSET, stc_usbn_endpoint_data::pstcEpControlRegister, stc_usbn_endpoint_data::pstcEpStatusRegister, UsbEndpointStatusIdle, UsbEndpointStatusNotReady, UsbEndpointStatusStall, and UsbEndpointStatusTransfer.
| boolean_t Usb_HalEpReady | ( | stc_usbn_endpoint_data_t * | pstcEpHandle | ) |
Get information if the specified endpoint is ready.
| pstcEpHandle | Endpoint handle |
Definition at line 1675 of file usb.c.
References _EPNC_EPEN, _EPNS_DRQ, BITMASK_ISCLEARED, FALSE, stc_usbn_endpoint_data::pstcEpControlRegister, stc_usbn_endpoint_data::pstcEpStatusRegister, and TRUE.
| en_result_t Usb_HalReceive | ( | stc_usbn_endpoint_data_t * | pstcEpHandle, |
| uint8_t * | pu8Data, | ||
| uint16_t * | pu16ByteCount, | ||
| boolean_t | bClearDrq | ||
| ) |
Read data via endpoint.
| pstcEpHandle | Pointer to endpoint instance |
| pu8Data | Databuffer to write in |
| pu16ByteCount | Pointer to data read |
| bClearDrq | Set FIFO ready for next data |
< Defines 'read / write' permissions
Definition at line 1553 of file usb.c.
References __IO, _EPNS_DRQ, BITMASK_CLEAR, BITMASK_ISCLEARED, ErrorInvalidParameter, ErrorNotReady, Ok, stc_usbn_endpoint_data::pstcEpDataRegister, stc_usbn_endpoint_data::pstcEpStatusRegister, and TRUE.
| en_result_t Usb_HalSend | ( | stc_usbn_endpoint_data_t * | pstcEpHandle, |
| uint8_t * | pu8Data, | ||
| uint16_t | u16Size, | ||
| uint16_t * | pu16ByteCount | ||
| ) |
Send data via endpoint.
| pstcEpHandle | Pointer to endpoint instance |
| pu8Data | Data to write |
| u16Size | Data size |
| pu16ByteCount | Pointer to data written |
< Defines 'read / write' permissions
Definition at line 1359 of file usb.c.
References __IO, _EPNS_DRQ, BITMASK_CLEAR, BITMASK_ISCLEARED, ErrorInvalidParameter, ErrorNotReady, Ok, stc_usbn_endpoint_data::pstcEpDataRegister, stc_usbn_endpoint_data::pstcEpStatusRegister, TRUE, stc_usbn_endpoint_data::u16EndpointSize, stc_usbn_endpoint_data::u8EndpointAddress, and USBDBGVAL8.
| en_result_t Usb_HalStallEndpoint | ( | stc_usbn_endpoint_data_t * | pstcEpHandle | ) |
Stall endpoint.
| pstcEpHandle | Pointer to endpoint instance |
Definition at line 1302 of file usb.c.
References _EPNC_STAL, BITMASK_SET, Ok, and stc_usbn_endpoint_data::pstcEpControlRegister.
| en_result_t Usb_HalUnstallEndpoint | ( | stc_usbn_endpoint_data_t * | pstcEpHandle | ) |
Unstall endpoint.
| pstcEpHandle | Pointer to endpoint instance |
Definition at line 1317 of file usb.c.
References _EPNC_STAL, BITMASK_CLEAR, Ok, and stc_usbn_endpoint_data::pstcEpControlRegister.
| void USB_Handler | ( | void | ) |
USB 0 interrupt handler (only used in standalone mode)
Definition at line 1866 of file usb.c.
References UsbInstanceIndexUsb0, and UsbIrqHandler().

| en_result_t Usb_Init | ( | void | ) |
Initialize USB in general.
Definition at line 474 of file usb.c.
References bL3_FM3_GPIO_EPFR00_USB0PE, bL3_FM3_GPIO_EPFR00_USB1PE, bL3_FM3_GPIO_PFR2_P0, bL3_FM3_GPIO_PFR6_P1, bL3_FM3_GPIO_SPSR_USB0C, bL3_FM3_GPIO_SPSR_USB1C, Ok, TRUE, Usb_InitInstance(), USB_INSTANCE_COUNT, UsbEthernetClock_Init(), and UsbInitDone.
Referenced by Usb_Configure().


| en_result_t Usb_InitInstance | ( | stc_usbn_t * | pstcUsb | ) |
Init USB instance.
| pstcUsb | Pointer to USB instance |
Definition at line 1063 of file usb.c.
References stc_usb_intern_data::astcEndpoints, stc_usbn_endpoint_data::bAutomaticNullTermination, stc_usb_intern_data::bSofTimeoutEnabled, stc_usb_intern_data::bUsbInstanceSet, ErrorUninitialized, FALSE, stc_usb_sof_timeout_handler::Handler, Ok, stc_usbn_endpoint_data::pfnRxTxCallback, stc_usbn_endpoint_data::pstcEpControlRegister, stc_usbn_endpoint_data::pstcEpDataRegister, stc_usbn_endpoint_data::pstcEpStatusRegister, stc_usbn_endpoint_data::pstcUsbInstance, stc_usb_intern_data::pstcUsbTimeOutHandler, TRUE, stc_usbn_endpoint_data::u16EndpointSize, stc_usb_sof_timeout_handler::u16TimeOut, stc_usbn_endpoint_data::u8EndpointAddress, stc_usb_intern_data::u8NumberOfEndpoints, and UsbGetInternDataPtr().
Referenced by Usb_Configure(), and Usb_Init().


|
static |
Device dependent initialization of interrupts according CMSIS with level defined in l3.h.
| pstcUsb | Pointer to USB instance |
Definition at line 269 of file usb.c.
Referenced by Usb_Configure().

| void Usb_OsTickHandle | ( | void | ) |
Operation System Tick Handle
Definition at line 2091 of file usb.c.
References UsbInstanceIndexUsb0, UsbInstanceIndexUsb1, and UsbIrqHandler().

| void Usb_RemoveTimeOut | ( | stc_usbn_t * | pstcUsb, |
| void(*)(stc_usbn_t *pstcUsb) | Handler | ||
| ) |
Remove a timeout handler
| pstcUsb | USB handle |
| Handler | handler executed after timeout |
Definition at line 1805 of file usb.c.
References stc_usb_sof_timeout_handler::Handler, stc_usb_intern_data::pstcUsbTimeOutHandler, stc_usb_sof_timeout_handler::u16TimeOut, and UsbGetInternDataPtr().
Referenced by ReturnedConfigurationDescriptor(), ReturnedDeviceDescriptor(), and UsbClassSupervisor_Init().


| void Usb_SetEndpointRxTxCallback | ( | stc_usbn_endpoint_data_t * | pstcEndpoint, |
| usb_endpoint_datatransferred_func_ptr_t | pfnRxTxCallback | ||
| ) |
Set RxTx Callback of an endpoint.
| pstcEndpoint | Pointer to endpoint instance |
| pfnRxTxCallback | Callback routine |
Definition at line 1240 of file usb.c.
References _EPNS_DRQIE, BITMASK_CLEAR, BITMASK_SET, stc_usbn_endpoint_data::pfnRxTxCallback, stc_usbn_endpoint_data::pstcEpStatusRegister, and stc_usbn_endpoint_data::u8EndpointAddress.
| en_result_t Usb_SetupHalEndpoint | ( | stc_usbn_t * | pstcUsb, |
| uint8_t | u8EndpointAddress, | ||
| uint16_t | u16FifoSize, | ||
| en_usb_ep_type_t | enType, | ||
| boolean_t | bInterruptsEnabled | ||
| ) |
Setup USB HAL endpoint.
| pstcUsb | Pointer to USB instance |
| u8EndpointAddress | Endpoint address |
| u16FifoSize | Endpoint FIFO size |
| enType | Type of endpoint, see also en_usb_ep_type_t |
| bInterruptsEnabled | Use interrupts |
Definition at line 579 of file usb.c.
References _EPNC_EPEN, _EPNS_DRQIE, stc_usb_intern_data::astcEndpoints, BITMASK_CLEAR, BITMASK_SET, ErrorUninitialized, Ok, stc_usbn_endpoint_data::pstcEpControlRegister, stc_usbn_endpoint_data::pstcEpStatusRegister, TRUE, stc_usbn_endpoint_data::u16EndpointSize, stc_usbn_endpoint_data::u8EndpointAddress, and UsbGetInternDataPtr().

| en_result_t Usb_SwitchUsb | ( | stc_usbn_t * | pstcUsb, |
| en_usb_switch_t | enType, | ||
| uint32_t | u32SwitchDelay | ||
| ) |
Switch "Task" between host / device mode.
| pstcUsb | Pointer to USB instance |
| enType | Type of switching, see also en_usb_switch_t |
| u32SwitchDelay | optional delay |
Definition at line 620 of file usb.c.
References stc_usb_intern_data::bDeviceActive, stc_usb_intern_data::bDeviceEnabled, stc_usb_intern_data::bHostActive, stc_usb_intern_data::bHostEnabled, ErrorNotReady, ErrorUninitialized, FALSE, Ok, stc_usb_intern_data::pfnDeviceVbus, TRUE, UsbExtIntGetLevel, UsbGetInternDataPtr(), UsbSwitchAllOff, UsbSwitchDependingDeviceVbus, UsbSwitchToDevice, and UsbSwitchToHost.

| void Usb_Tick | ( | void | ) |
Definition at line 1829 of file usb.c.
References UsbInstanceIndexUsb0, UsbInstanceIndexUsb1, and UsbIrqHandler().

|
static |
SOF callback - Realize Timeouts
| pstcUsb | USB handle |
Definition at line 1722 of file usb.c.
References stc_usb_intern_data::bSofTimeoutEnabled, FALSE, stc_usb_sof_timeout_handler::Handler, stc_usb_intern_data::pstcUsbTimeOutHandler, TRUE, stc_usb_sof_timeout_handler::u16TimeOut, and UsbGetInternDataPtr().
Referenced by UsbIrqHandler().


| void UsbConfig_SwitchMode | ( | void | ) |
| void UsbConfig_UsbInit | ( | void | ) |
|
static |
Return the internal data for a certain USB instance.
| pstcUsb | Pointer to USB instance |
Definition at line 244 of file usb.c.
References stc_usbn_instance_data::stcInternData, and USB_INSTANCE_COUNT.
Referenced by Usb_AddTimeOut(), Usb_Configure(), Usb_GetEndpointPtr(), Usb_InitInstance(), Usb_RemoveTimeOut(), Usb_SetupHalEndpoint(), Usb_SwitchUsb(), and Usb_TimeoutHandler().

| void UsbHost_DisconnectionCallback | ( | stc_usbn_t * | pstcUsb | ) |
| void UsbIrqHandler | ( | stc_usbn_t * | pstcUsb, |
| stc_usb_intern_data_t * | pstcUsbInternData | ||
| ) |
USB interrupt handler
| pstcUsb | USB handle |
| pstcUsbInternData | Internal data USB handle |
Definition at line 2118 of file usb.c.
References _EPNS_BFINI, stc_usb_intern_data::astcEndpoints, stc_usb_intern_data::bDeviceActive, stc_usb_intern_data::bHostActive, BITMASK_CLEAR, BITMASK_SET, stc_usb_intern_data::bSofTimeoutEnabled, stc_usb_intern_data::pfnBrstCallback, stc_usb_intern_data::pfnCmpirqCallback, stc_usb_intern_data::pfnCnnirqCallback, stc_usb_intern_data::pfnConfCallback, stc_usb_intern_data::pfnDirqCallback, stc_usb_intern_data::pfnRwkirqCallback, stc_usbn_endpoint_data::pfnRxTxCallback, stc_usb_intern_data::pfnSetpCallback, stc_usb_intern_data::pfnSofCallback, stc_usb_intern_data::pfnSuspCallback, stc_usb_intern_data::pfnTcanCallback, stc_usb_intern_data::pfnUrirqCallback, stc_usb_intern_data::pfnWkupCallback, stc_usbn_endpoint_data::pstcEpStatusRegister, TRUE, stc_usb_intern_data::u8NumberOfEndpoints, Usb_TimeoutHandler(), and USBDBG.
Referenced by USB0_Handler(), USB0_HOST_IRQHandler(), USB1_Handler(), USB_Handler(), Usb_OsTickHandle(), and Usb_Tick().


| stc_usbn_instance_data_t m_astcUsbInstanceDataLut[] |
| stc_usbn_instance_data_t m_astcUsbInstanceDataLut[] |
Definition at line 98 of file usb.c.
Referenced by Usb_Configure(), and Usb_Init().