Nut/OS  5.0.5
API Reference
otgd_fs_cal.h File Reference
Include dependency graph for otgd_fs_cal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  USB_OTG_hc
struct  USB_OTG_ep

Defines

#define __packed   __attribute__ ((__packed__))
#define DEVICE_MODE_ENABLED
#define DEV_EP_TX_DIS   0x0000
#define DEV_EP_TX_STALL   0x0010
#define DEV_EP_TX_NAK   0x0020
#define DEV_EP_TX_VALID   0x0030
#define DEV_EP_RX_DIS   0x0000
#define DEV_EP_RX_STALL   0x1000
#define DEV_EP_RX_NAK   0x2000
#define DEV_EP_RX_VALID   0x3000
#define GAHBCFG_TXFEMPTYLVL_EMPTY   1
#define GAHBCFG_TXFEMPTYLVL_HALFEMPTY   0
#define GAHBCFG_GLBINT_ENABLE   1
#define GAHBCFG_INT_DMA_BURST_SINGLE   0
#define GAHBCFG_INT_DMA_BURST_INCR   1
#define GAHBCFG_INT_DMA_BURST_INCR4   3
#define GAHBCFG_INT_DMA_BURST_INCR8   5
#define GAHBCFG_INT_DMA_BURST_INCR16   7
#define GAHBCFG_DMAENABLE   1
#define GAHBCFG_TXFEMPTYLVL_EMPTY   1
#define GAHBCFG_TXFEMPTYLVL_HALFEMPTY   0
#define GRXSTS_PKTSTS_IN   2
#define GRXSTS_PKTSTS_IN_XFER_COMP   3
#define GRXSTS_PKTSTS_DATA_TOGGLE_ERR   5
#define GRXSTS_PKTSTS_CH_HALTED   7
#define DEVICE_MODE   0
#define HOST_MODE   1
#define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ   0
#define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ   1
#define DSTS_ENUMSPD_LS_PHY_6MHZ   2
#define DSTS_ENUMSPD_FS_PHY_48MHZ   3
#define DCFG_FRAME_INTERVAL_80   0
#define DCFG_FRAME_INTERVAL_85   1
#define DCFG_FRAME_INTERVAL_90   2
#define DCFG_FRAME_INTERVAL_95   3
#define DEP0CTL_MPS_64   0
#define DEP0CTL_MPS_32   1
#define DEP0CTL_MPS_16   2
#define DEP0CTL_MPS_8   3
#define EP_SPEED_LOW   0
#define EP_SPEED_FULL   1
#define EP_SPEED_HIGH   2
#define EP_TYPE_CTRL   0
#define EP_TYPE_ISOC   1
#define EP_TYPE_BULK   2
#define EP_TYPE_INTR   3
#define STS_GOUT_NAK   1
#define STS_DATA_UPDT   2
#define STS_XFER_COMP   3
#define STS_SETUP_COMP   4
#define STS_SETUP_UPDT   6
#define CLEAR_IN_EP_INTR(epnum, intr)
#define CLEAR_OUT_EP_INTR(epnum, intr)
#define READ_REG32(reg)   (*(__IO uint32_t *)reg)
#define WRITE_REG32(reg, value)   (*(__IO uint32_t *)reg = value)
#define MODIFY_REG32(reg, clear_mask, set_mask)   WRITE_REG32(reg, (((READ_REG32(reg)) & ~clear_mask) | set_mask ) )
#define _OTGD_FS_GATE_PHYCLK   *(__IO uint32_t*)(0x50000E00) = 0x03
#define _OTGD_FS_UNGATE_PHYCLK   *(__IO uint32_t*)(0x50000E00) = 0x00

Typedefs

typedef struct USB_OTG_hc USB_OTG_HC
typedef struct USB_OTG_hcPUSB_OTG_HC
typedef struct USB_OTG_ep USB_OTG_EP
typedef struct USB_OTG_epPUSB_OTG_EP

Enumerations

enum  USB_OTG_Status { USB_OTG_OK, USB_OTG_FAIL }

Functions

USB_OTG_Status OTGD_FS_CoreInit (void)
USB_OTG_Status OTGD_FS_SetAddress (uint32_t BaseAddress)
USB_OTG_Status OTGD_FS_EnableGlobalInt (void)
USB_OTG_Status OTGD_FS_DisableGlobalInt (void)
USB_OTG_Status USB_OTG_CoreInitHost (void)
USB_OTG_Status USB_OTG_EnableHostInt (void)
USB_OTG_Status USB_OTG_DisableHostInt (void)
void * OTGD_FS_ReadPacket (uint8_t *dest, uint16_t bytes)
USB_OTG_Status OTGD_FS_WritePacket (uint8_t *src, uint8_t ch_ep_num, uint16_t bytes)
USB_OTG_Status USB_OTG_HcInit (USB_OTG_HC *hc)
USB_OTG_Status USB_OTG_StartXfer (USB_OTG_HC *hc)
uint32_t USB_OTG_ResetPort (void)
uint32_t USB_OTG_ReadHPRT0 (void)
uint32_t OTGD_FS_ReadDevAllInEPItr (void)
uint32_t OTGD_FS_ReadCoreItr (void)
uint32_t OTGD_FS_ReadOtgItr (void)
uint32_t USB_OTG_ReadHostAllChannels_intr (void)
uint8_t IsHostMode (void)
uint8_t IsDeviceMode (void)
USB_OTG_Status USB_OTG_HcHalt (uint8_t hc_num)
USB_OTG_Status OTGD_FS_FlushTxFifo (uint32_t num)
USB_OTG_Status OTGD_FS_FlushRxFifo (void)
USB_OTG_Status OTGD_FS_SetHostMode (void)
USB_OTG_Status OTGD_FS_PhyInit (void)
USB_OTG_Status USB_OTG_HcStartXfer (USB_OTG_HC *hc)
USB_OTG_Status OTGD_FS_CoreInitDev (void)
USB_OTG_Status OTGD_FS_EnableDevInt (void)
USB_OTG_Status OTGD_FS_EP0Activate (void)
USB_OTG_Status OTGD_FS_EPActivate (USB_OTG_EP *ep)
USB_OTG_Status OTGD_FS_EPDeactivate (USB_OTG_EP *ep)
USB_OTG_Status OTGD_FS_EPStartXfer (USB_OTG_EP *ep)
USB_OTG_Status OTGD_FS_EP0StartXfer (USB_OTG_EP *ep)
USB_OTG_Status OTGD_FS_EPSetStall (USB_OTG_EP *ep)
USB_OTG_Status OTGD_FS_EPClearStall (USB_OTG_EP *ep)
uint32_t OTGD_FS_ReadDevAllOutEp_itr (void)
uint32_t OTGD_FS_ReadDevOutEP_itr (USB_OTG_EP *ep)
uint32_t OTGD_FS_Dev_GetEPStatus (USB_OTG_EP *ep)
void OTGD_FS_Dev_SetEPStatus (USB_OTG_EP *ep, uint32_t Status)
void OTGD_FS_Dev_SetRemoteWakeup (void)
void OTGD_FS_Dev_ResetRemoteWakeup (void)

Define Documentation

#define __packed   __attribute__ ((__packed__))

packing keyword for GNU Compiler

Referenced by OTGD_FS_WritePacket().

#define DEVICE_MODE_ENABLED
#define DEV_EP_TX_DIS   0x0000

Referenced by OTGD_FS_Dev_SetEPStatus().

#define DEV_EP_TX_STALL   0x0010
#define DEV_EP_TX_VALID   0x0030
#define DEV_EP_RX_DIS   0x0000

Referenced by OTGD_FS_Dev_SetEPStatus().

#define DEV_EP_RX_STALL   0x1000
#define DEV_EP_RX_NAK   0x2000
#define DEV_EP_RX_VALID   0x3000
#define GAHBCFG_TXFEMPTYLVL_EMPTY   1
#define GAHBCFG_TXFEMPTYLVL_HALFEMPTY   0
#define GAHBCFG_GLBINT_ENABLE   1
#define GAHBCFG_INT_DMA_BURST_SINGLE   0
#define GAHBCFG_INT_DMA_BURST_INCR   1
#define GAHBCFG_INT_DMA_BURST_INCR4   3
#define GAHBCFG_INT_DMA_BURST_INCR8   5
#define GAHBCFG_INT_DMA_BURST_INCR16   7
#define GAHBCFG_DMAENABLE   1
#define GAHBCFG_TXFEMPTYLVL_EMPTY   1
#define GAHBCFG_TXFEMPTYLVL_HALFEMPTY   0
#define GRXSTS_PKTSTS_IN   2
#define GRXSTS_PKTSTS_IN_XFER_COMP   3
#define GRXSTS_PKTSTS_DATA_TOGGLE_ERR   5
#define GRXSTS_PKTSTS_CH_HALTED   7
#define DEVICE_MODE   0
#define HOST_MODE   1

Referenced by IsDeviceMode(), and IsHostMode().

#define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ   0

Referenced by OTGD_FS_EP0Activate().

#define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ   1

Referenced by OTGD_FS_EP0Activate().

#define DSTS_ENUMSPD_LS_PHY_6MHZ   2

Referenced by OTGD_FS_EP0Activate().

#define DSTS_ENUMSPD_FS_PHY_48MHZ   3

Referenced by OTGD_FS_EP0Activate().

#define DCFG_FRAME_INTERVAL_80   0

Referenced by OTGD_FS_CoreInitDev().

#define DCFG_FRAME_INTERVAL_85   1
#define DCFG_FRAME_INTERVAL_90   2
#define DCFG_FRAME_INTERVAL_95   3
#define DEP0CTL_MPS_64   0

Referenced by OTGD_FS_EP0Activate().

#define DEP0CTL_MPS_32   1
#define DEP0CTL_MPS_16   2
#define DEP0CTL_MPS_8   3

Referenced by OTGD_FS_EP0Activate().

#define EP_SPEED_LOW   0
#define EP_SPEED_FULL   1
#define EP_SPEED_HIGH   2
#define EP_TYPE_CTRL   0

Referenced by OTGD_FS_PCD_Init().

#define EP_TYPE_ISOC   1
#define EP_TYPE_BULK   2
#define EP_TYPE_INTR   3
#define STS_GOUT_NAK   1
#define STS_DATA_UPDT   2
#define STS_XFER_COMP   3
#define STS_SETUP_COMP   4
#define STS_SETUP_UPDT   6
#define CLEAR_IN_EP_INTR (   epnum,
  intr 
)
Value:
diepint.d32=0; \
  diepint.b.intr = 1; \
  WRITE_REG32(&core_regs.inep_regs[epnum]->dev_in_ep_int,diepint.d32);

Referenced by OTGD_FS_Handle_InEP_ISR().

#define CLEAR_OUT_EP_INTR (   epnum,
  intr 
)
Value:
doepint.d32=0; \
  doepint.b.intr = 1; \
  WRITE_REG32(&core_regs.outep_regs[epnum]->dev_out_ep_int,doepint.d32);

Referenced by OTGD_FS_Handle_OutEP_ISR().

#define _OTGD_FS_GATE_PHYCLK   *(__IO uint32_t*)(0x50000E00) = 0x03
#define _OTGD_FS_UNGATE_PHYCLK   *(__IO uint32_t*)(0x50000E00) = 0x00

Typedef Documentation

typedef struct USB_OTG_hc USB_OTG_HC
typedef struct USB_OTG_hc * PUSB_OTG_HC
typedef struct USB_OTG_ep USB_OTG_EP
typedef struct USB_OTG_ep * PUSB_OTG_EP

Enumeration Type Documentation

Enumerator:
USB_OTG_OK 
USB_OTG_FAIL 

Function Documentation

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().

Here is the call graph for this function:

USB_OTG_Status USB_OTG_CoreInitHost ( void  )
USB_OTG_Status USB_OTG_EnableHostInt ( void  )
USB_OTG_Status USB_OTG_DisableHostInt ( void  )
void* OTGD_FS_ReadPacket ( uint8_t dest,
uint16_t  bytes 
)
USB_OTG_Status OTGD_FS_WritePacket ( uint8_t src,
uint8_t  ch_ep_num,
uint16_t  bytes 
)
USB_OTG_Status USB_OTG_HcInit ( USB_OTG_HC hc)
USB_OTG_Status USB_OTG_StartXfer ( USB_OTG_HC hc)
uint32_t USB_OTG_ResetPort ( void  )
uint32_t USB_OTG_ReadHPRT0 ( void  )
uint32_t OTGD_FS_ReadOtgItr ( void  )
uint32_t USB_OTG_ReadHostAllChannels_intr ( void  )
uint8_t IsHostMode ( void  )

References HOST_MODE.

uint8_t IsDeviceMode ( void  )

References HOST_MODE.

Referenced by STM32_PCD_OTG_ISR_Handler().

USB_OTG_Status USB_OTG_HcHalt ( uint8_t  hc_num)
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

USB_OTG_Status OTGD_FS_SetHostMode ( void  )
USB_OTG_Status USB_OTG_HcStartXfer ( USB_OTG_HC hc)
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().

Here is the call graph for this function: