#include <dev/usb_stm32/otgd_fs_cal.h>
#include <dev/usb_stm32/usb_conf.h>
#include <dev/usb_stm32/otgd_fs_regs.h>
#include <sys/timer.h>
uint32_t STM32_USBH_OTG_ISR_Handler | ( | void | ) |
uint32_t STM32_PCD_OTG_ISR_Handler | ( | void | ) |
References _USB_OTG_int_sts_data::b, bIntPackSOF, _USB_OTG_int_sts_data::d32, _USB_OTG_int_sts_data::enumdone, _USB_OTG_int_sts_data::eopframe, _USB_OTG_int_sts_data::epmismatch, _USB_OTG_int_sts_data::erlysuspend, fSuspendEnabled, _USB_OTG_int_sts_data::ginnakeff, _USB_OTG_int_sts_data::goutnakeff, _USB_OTG_int_sts_data::incomplisoin, _USB_OTG_int_sts_data::inepint, IsDeviceMode(), _USB_OTG_int_sts_data::isooutdrop, _USB_OTG_int_sts_data::modemismatch, _USB_OTG_int_sts_data::nptxfempty, OTGD_FS_Handle_EarlySuspend_ISR(), OTGD_FS_Handle_EnumDone_ISR(), OTGD_FS_Handle_EOPF_ISR(), OTGD_FS_Handle_EPMismatch_ISR(), OTGD_FS_Handle_GInNakEff_ISR(), OTGD_FS_Handle_GOutNakEff_ISR(), OTGD_FS_Handle_IncomplIsoIn_ISR(), OTGD_FS_Handle_IncomplIsoOut_ISR(), OTGD_FS_Handle_InEP_ISR(), OTGD_FS_Handle_IsoOutDrop_ISR(), OTGD_FS_Handle_ModeMismatch_ISR(), OTGD_FS_Handle_NPTxFE_ISR(), OTGD_FS_Handle_OutEP_ISR(), OTGD_FS_Handle_RxStatusQueueLevel_ISR(), OTGD_FS_Handle_Sof_ISR(), OTGD_FS_Handle_UsbReset_ISR(), OTGD_FS_Handle_USBSuspend_ISR(), OTGD_FS_Handle_Wakeup_ISR(), OTGD_FS_ReadCoreItr(), _USB_OTG_int_sts_data::outepintr, Resume(), RESUME_LATER, _USB_OTG_int_sts_data::rxstsqlvl, _USB_OTG_int_sts_data::sofintr, Suspend(), _USB_OTG_int_sts_data::usbreset, _USB_OTG_int_sts_data::usbsuspend, and _USB_OTG_int_sts_data::wkupintr.
uint32_t STM32_USBO_OTG_ISR_Handler | ( | void | ) |
USB_OTG_Status OTGD_FS_PhyInit | ( | void | ) |
References _USB_OTG_usb_cfg_data::b, _USB_OTG_gpio_data::b, USB_OTG_core_regs::common_regs, _USB_OTG_usb_cfg_data::d32, _USB_OTG_gpio_data::d32, _USB_OTG_common_regs::gpio, _USB_OTG_gpio_data::i2cifen, NutSleep(), _USB_OTG_usb_cfg_data::otgutmifssel, _USB_OTG_gpio_data::pwdn, READ_REG32, _USB_OTG_common_regs::usb_cfg, USB_OTG_OK, _USB_OTG_gpio_data::vbussensingB, and WRITE_REG32.
Referenced by OTGD_FS_CoreInit().
USB_OTG_Status OTGD_FS_WritePacket | ( | uint8_t * | src, |
uint8_t | ch_ep_num, | ||
uint16_t | bytes | ||
) |
References __IO, __packed, USB_OTG_core_regs::data_fifo, USB_OTG_OK, and WRITE_REG32.
References __IO, USB_OTG_core_regs::data_fifo, and READ_REG32.
Referenced by OTGD_FS_Handle_RxStatusQueueLevel_ISR().
USB_OTG_Status OTGD_FS_SetAddress | ( | uint32_t | BaseAddress | ) |
References USB_OTG_core_regs::common_regs, USB_OTG_core_regs::data_fifo, USB_OTG_core_regs::dev_regs, USB_OTG_core_regs::hc_regs, USB_OTG_core_regs::host_regs, USB_OTG_core_regs::hprt0, USB_OTG_core_regs::inep_regs, MAX_EPS_CHANNELS, USB_OTG_core_regs::outep_regs, USB_OTG_core_regs::pcgcctl, USB_OTG_CHAN_REGS_OFFSET, USB_OTG_CORE_GLOBAL_REGS_OFFSET, USB_OTG_DATA_FIFO_OFFSET, USB_OTG_DATA_FIFO_SIZE, USB_OTG_DEV_GLOBAL_REG_OFFSET, USB_OTG_DEV_IN_EP_REG_OFFSET, USB_OTG_DEV_OUT_EP_REG_OFFSET, USB_OTG_EP_REG_OFFSET, USB_OTG_HOST_CHAN_REGS_OFFSET, USB_OTG_HOST_GLOBAL_REG_OFFSET, USB_OTG_HOST_PORT_REGS_OFFSET, USB_OTG_OK, and USB_OTG_PCGCCTL_OFFSET.
Referenced by OTG_DEV_Init().
USB_OTG_Status OTGD_FS_CoreInit | ( | void | ) |
References _USB_OTG_usb_cfg_data::b, USB_OTG_core_regs::common_regs, _USB_OTG_usb_cfg_data::d32, OTGD_FS_PhyInit(), _USB_OTG_usb_cfg_data::physel, READ_REG32, _USB_OTG_common_regs::usb_cfg, USB_OTG_OK, and WRITE_REG32.
Referenced by OTG_DEV_Init().
USB_OTG_Status OTGD_FS_EnableGlobalInt | ( | void | ) |
USB_OTG_Status OTGD_FS_DisableGlobalInt | ( | void | ) |
USB_OTG_Status OTGD_FS_FlushTxFifo | ( | uint32_t | num | ) |
References __IO, USB_OTG_core_regs::common_regs, _USB_OTG_rst_ctl_data::d32, NutMicroDelay(), READ_REG32, _USB_OTG_common_regs::rst_ctl, USB_OTG_OK, and WRITE_REG32.
Referenced by OTGD_FS_CoreInitDev(), OTGD_FS_Handle_UsbReset_ISR(), and OTGD_FS_PCD_EP_Flush().
USB_OTG_Status OTGD_FS_FlushRxFifo | ( | void | ) |
References __IO, USB_OTG_core_regs::common_regs, _USB_OTG_rst_ctl_data::d32, NutMicroDelay(), READ_REG32, _USB_OTG_common_regs::rst_ctl, USB_OTG_OK, and WRITE_REG32.
Referenced by OTGD_FS_CoreInitDev(), and OTGD_FS_PCD_EP_Flush().
uint8_t IsDeviceMode | ( | void | ) |
References HOST_MODE.
Referenced by STM32_PCD_OTG_ISR_Handler().
uint32_t OTGD_FS_ReadCoreItr | ( | void | ) |
References USB_OTG_core_regs::common_regs, _USB_OTG_common_regs::int_msk, _USB_OTG_common_regs::int_sts, and READ_REG32.
Referenced by STM32_PCD_OTG_ISR_Handler().
uint32_t OTGD_FS_ReadOtgItr | ( | void | ) |
References USB_OTG_core_regs::common_regs, _USB_OTG_common_regs::otg_int, and READ_REG32.
USB_OTG_Status OTGD_FS_CoreInitDev | ( | void | ) |
References _USB_OTG_fifo_size_data::b, _USB_OTG_dev_cfg_data::b, _USB_OTG_dev_in_ep_int_data::b, _USB_OTG_dev_ep_ctl_data::b, USB_OTG_core_regs::common_regs, _USB_OTG_fifo_size_data::d32, _USB_OTG_dev_cfg_data::d32, _USB_OTG_dev_in_ep_int_data::d32, _USB_OTG_dev_ep_ctl_data::d32, DCFG_FRAME_INTERVAL_80, _USB_OTG_fifo_size_data::depth, _USB_OTG_dev_regs::dev_all_int, _USB_OTG_dev_regs::dev_all_int_msk, _USB_OTG_dev_regs::dev_cfg, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_in_ep_regs::dev_in_ep_int, _USB_OTG_dev_regs::dev_in_ep_msk, _USB_OTG_dev_in_ep_regs::dev_in_ep_txfer_siz, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_int, _USB_OTG_dev_regs::dev_out_ep_msk, _USB_OTG_dev_out_ep_regs::dev_out_ep_txfer_siz, _USB_OTG_common_regs::dev_p_tx_fsiz_dieptxf, USB_OTG_core_regs::dev_regs, _USB_OTG_dev_ep_ctl_data::epdis, _USB_OTG_dev_ep_ctl_data::epena, USB_OTG_core_regs::inep_regs, MAX_TX_FIFOS, MODIFY_REG32, _USB_OTG_common_regs::np_tx_fifo_siz, OTGD_FS_EnableDevInt(), OTGD_FS_FlushRxFifo(), OTGD_FS_FlushTxFifo(), USB_OTG_core_regs::outep_regs, USB_OTG_core_regs::pcgcctl, _USB_OTG_dev_cfg_data::perfrint, READ_REG32, _USB_OTG_common_regs::rx_fifo_siz, RX_FIFO_SIZE, _USB_OTG_dev_ep_ctl_data::snak, _USB_OTG_fifo_size_data::startaddr, TX0_FIFO_SIZE, TX1_FIFO_SIZE, TX3_FIFO_SIZE, _USB_OTG_dev_in_ep_int_data::txfifoundrn, USB_OTG_OK, and WRITE_REG32.
Referenced by OTG_DEV_Init().
USB_OTG_Status OTGD_FS_EnableDevInt | ( | void | ) |
References _USB_OTG_int_msk_data::b, USB_OTG_core_regs::common_regs, _USB_OTG_int_msk_data::d32, _USB_OTG_int_msk_data::disconnect, _USB_OTG_int_msk_data::enumdone, _USB_OTG_int_msk_data::eopframe, _USB_OTG_int_msk_data::epmismatch, _USB_OTG_int_msk_data::erlysuspend, _USB_OTG_int_msk_data::ginnakeff, _USB_OTG_int_msk_data::goutnakeff, _USB_OTG_int_msk_data::incomplisoin, _USB_OTG_int_msk_data::incomplisoout, _USB_OTG_int_msk_data::inepintr, _USB_OTG_common_regs::int_msk, _USB_OTG_common_regs::int_sts, _USB_OTG_int_msk_data::isooutdrop, _USB_OTG_int_msk_data::modemismatch, MODIFY_REG32, _USB_OTG_int_msk_data::nptxfempty, _USB_OTG_int_msk_data::outepintr, _USB_OTG_int_msk_data::rxstsqlvl, _USB_OTG_int_msk_data::sofintr, USB_OTG_OK, _USB_OTG_int_msk_data::usbreset, _USB_OTG_int_msk_data::usbsuspend, _USB_OTG_int_msk_data::wkupintr, and WRITE_REG32.
Referenced by OTGD_FS_CoreInitDev().
USB_OTG_Status OTGD_FS_EP0Activate | ( | void | ) |
References _USB_OTG_dev_ctl_data::b, _USB_OTG_dev_sts_data::b, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_ctl_data::cgnpinnak, _USB_OTG_dev_ctl_data::d32, _USB_OTG_dev_sts_data::d32, _USB_OTG_dev_ep_ctl_data::d32, DEP0CTL_MPS_64, DEP0CTL_MPS_8, _USB_OTG_dev_regs::dev_ctl, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, USB_OTG_core_regs::dev_regs, _USB_OTG_dev_regs::dev_sts, DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ, DSTS_ENUMSPD_FS_PHY_48MHZ, DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ, DSTS_ENUMSPD_LS_PHY_6MHZ, _USB_OTG_dev_sts_data::enumspd, USB_OTG_core_regs::inep_regs, MODIFY_REG32, _USB_OTG_dev_ep_ctl_data::mps, READ_REG32, USB_OTG_OK, and WRITE_REG32.
Referenced by OTGD_FS_Handle_EnumDone_ISR().
USB_OTG_Status OTGD_FS_EPActivate | ( | USB_OTG_EP * | ep | ) |
References __IO, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_all_int_data::d32, _USB_OTG_dev_ep_ctl_data::d32, _USB_OTG_dev_regs::dev_all_int_msk, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, USB_OTG_core_regs::dev_regs, _USB_OTG_dev_all_int_data::ep, _USB_OTG_dev_ep_ctl_data::eptype, _USB_OTG_dev_all_int_data::in, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, USB_OTG_ep::maxpacket, MODIFY_REG32, _USB_OTG_dev_ep_ctl_data::mps, USB_OTG_ep::num, _USB_OTG_dev_all_int_data::out, USB_OTG_core_regs::outep_regs, READ_REG32, _USB_OTG_dev_ep_ctl_data::setd0pid, USB_OTG_ep::tx_fifo_num, _USB_OTG_dev_ep_ctl_data::txfnum, USB_OTG_ep::type, USB_OTG_OK, _USB_OTG_dev_ep_ctl_data::usbactep, and WRITE_REG32.
Referenced by OTGD_FS_PCD_EP_Open().
USB_OTG_Status OTGD_FS_EPDeactivate | ( | USB_OTG_EP * | ep | ) |
References __IO, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_all_int_data::d32, _USB_OTG_dev_ep_ctl_data::d32, _USB_OTG_dev_regs::dev_all_int_msk, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, USB_OTG_core_regs::dev_regs, _USB_OTG_dev_all_int_data::ep, _USB_OTG_dev_all_int_data::in, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, MODIFY_REG32, USB_OTG_ep::num, _USB_OTG_dev_all_int_data::out, USB_OTG_core_regs::outep_regs, USB_OTG_OK, _USB_OTG_dev_ep_ctl_data::usbactep, and WRITE_REG32.
Referenced by OTGD_FS_PCD_EP_Close().
USB_OTG_Status OTGD_FS_EPStartXfer | ( | USB_OTG_EP * | ep | ) |
References __IO, _USB_OTG_dev_ep_txfer_siz_data::b, _USB_OTG_dev_ep_txfer_siz_data::d32, _USB_OTG_dev_regs::dev_fifo_empty_msk, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_in_ep_regs::dev_in_ep_txfer_siz, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_txfer_siz, USB_OTG_core_regs::dev_regs, EP_TYPE_ISOC, USB_OTG_ep::even_odd_frame, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, USB_OTG_ep::maxpacket, MODIFY_REG32, USB_OTG_ep::num, USB_OTG_core_regs::outep_regs, _USB_OTG_dev_ep_txfer_siz_data::pktcnt, READ_REG32, USB_OTG_ep::type, USB_OTG_OK, WRITE_REG32, USB_OTG_ep::xfer_len, and _USB_OTG_dev_ep_txfer_siz_data::xfersize.
Referenced by OTG_DEV_EP_Init(), OTG_DEV_Init(), OTGD_FS_PCD_EP_Read(), and OTGD_FS_PCD_EP_Write().
USB_OTG_Status OTGD_FS_EP0StartXfer | ( | USB_OTG_EP * | ep | ) |
References _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_ep_txfer_size0_data::b, _USB_OTG_dev_ep_ctl_data::cnak, _USB_OTG_dev_ep_ctl_data::d32, _USB_OTG_dev_ep_txfer_size0_data::d32, _USB_OTG_dev_regs::dev_fifo_empty_msk, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_in_ep_regs::dev_in_ep_txfer_siz, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_txfer_siz, USB_OTG_core_regs::dev_regs, _USB_OTG_dev_ep_ctl_data::epena, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, USB_OTG_ep::maxpacket, MODIFY_REG32, USB_OTG_ep::num, USB_OTG_core_regs::outep_regs, _USB_OTG_dev_ep_txfer_size0_data::pktcnt, READ_REG32, USB_OTG_OK, WRITE_REG32, USB_OTG_ep::xfer_len, and _USB_OTG_dev_ep_txfer_size0_data::xfersize.
Referenced by OTGD_FS_PCD_EP_Read(), OTGD_FS_PCD_EP_Write(), Post0_Process(), and Setup0_Process().
USB_OTG_Status OTGD_FS_EPSetStall | ( | USB_OTG_EP * | ep | ) |
References __IO, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_ep_ctl_data::d32, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, _USB_OTG_dev_ep_ctl_data::epdis, _USB_OTG_dev_ep_ctl_data::epena, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, USB_OTG_ep::num, USB_OTG_core_regs::outep_regs, READ_REG32, _USB_OTG_dev_ep_ctl_data::stall, USB_OTG_OK, and WRITE_REG32.
Referenced by OTGD_FS_Dev_SetEPStatus(), and OTGD_FS_PCD_EP_Stall().
USB_OTG_Status OTGD_FS_EPClearStall | ( | USB_OTG_EP * | ep | ) |
References __IO, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_ep_ctl_data::d32, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, EP_TYPE_BULK, EP_TYPE_INTR, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, USB_OTG_ep::num, USB_OTG_core_regs::outep_regs, READ_REG32, _USB_OTG_dev_ep_ctl_data::setd0pid, _USB_OTG_dev_ep_ctl_data::stall, USB_OTG_ep::type, USB_OTG_OK, and WRITE_REG32.
Referenced by OTGD_FS_Dev_SetEPStatus(), and OTGD_FS_PCD_EP_ClrStall().
uint32_t OTGD_FS_ReadDevAllOutEp_itr | ( | void | ) |
References _USB_OTG_dev_regs::dev_all_int, _USB_OTG_dev_regs::dev_all_int_msk, USB_OTG_core_regs::dev_regs, and READ_REG32.
Referenced by OTGD_FS_Handle_OutEP_ISR().
uint32_t OTGD_FS_ReadDevOutEP_itr | ( | USB_OTG_EP * | ep | ) |
uint32_t OTGD_FS_ReadDevAllInEPItr | ( | void | ) |
References _USB_OTG_dev_regs::dev_all_int, _USB_OTG_dev_regs::dev_all_int_msk, USB_OTG_core_regs::dev_regs, and READ_REG32.
Referenced by OTGD_FS_Handle_InEP_ISR().
uint32_t OTGD_FS_Dev_GetEPStatus | ( | USB_OTG_EP * | ep | ) |
References __IO, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_ep_ctl_data::d32, DEV_EP_RX_NAK, DEV_EP_RX_STALL, DEV_EP_RX_VALID, DEV_EP_TX_NAK, DEV_EP_TX_STALL, DEV_EP_TX_VALID, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, _USB_OTG_dev_ep_ctl_data::naksts, USB_OTG_ep::num, USB_OTG_core_regs::outep_regs, READ_REG32, and _USB_OTG_dev_ep_ctl_data::stall.
Referenced by OTG_DEV_GetEPRxStatus(), and OTG_DEV_GetEPTxStatus().
void OTGD_FS_Dev_SetEPStatus | ( | USB_OTG_EP * | ep, |
uint32_t | Status | ||
) |
References __IO, _USB_OTG_dev_ep_ctl_data::b, _USB_OTG_dev_ep_ctl_data::cnak, _USB_OTG_dev_ep_ctl_data::d32, DEV_EP_RX_DIS, DEV_EP_RX_NAK, DEV_EP_RX_STALL, DEV_EP_RX_VALID, DEV_EP_TX_DIS, DEV_EP_TX_NAK, DEV_EP_TX_STALL, DEV_EP_TX_VALID, _USB_OTG_dev_in_ep_regs::dev_in_ep_ctl, _USB_OTG_dev_out_ep_regs::dev_out_ep_ctl, EP_TYPE_BULK, EP_TYPE_INTR, _USB_OTG_dev_ep_ctl_data::epena, USB_OTG_ep::even_odd_frame, USB_OTG_core_regs::inep_regs, USB_OTG_ep::is_in, USB_OTG_ep::num, OTGD_FS_EPClearStall(), OTGD_FS_EPSetStall(), USB_OTG_core_regs::outep_regs, READ_REG32, _USB_OTG_dev_ep_ctl_data::setd0pid, _USB_OTG_dev_ep_ctl_data::snak, _USB_OTG_dev_ep_ctl_data::stall, USB_OTG_ep::type, _USB_OTG_dev_ep_ctl_data::usbactep, and WRITE_REG32.
Referenced by OTG_DEV_SetEPRxStatus(), and OTG_DEV_SetEPTxStatus().
void OTGD_FS_Dev_SetRemoteWakeup | ( | void | ) |
References __IO, _USB_OTG_dev_ctl_data::b, _USB_OTG_dev_ctl_data::d32, _USB_OTG_dev_regs::dev_ctl, USB_OTG_core_regs::dev_regs, READ_REG32, _USB_OTG_dev_ctl_data::rmtwkupsig, and WRITE_REG32.
Referenced by Resume().
void OTGD_FS_Dev_ResetRemoteWakeup | ( | void | ) |
References __IO, _USB_OTG_dev_ctl_data::b, _USB_OTG_dev_ctl_data::d32, _USB_OTG_dev_regs::dev_ctl, USB_OTG_core_regs::dev_regs, READ_REG32, _USB_OTG_dev_ctl_data::rmtwkupsig, and WRITE_REG32.
Referenced by Resume().