From 81bff0ff66fd6ce87810af6f5ff37a6dc969cc19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 6 Mar 2012 16:23:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4027 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/OTGv1/stm32_otg.h | 396 ++++++++++++------------------- 1 file changed, 158 insertions(+), 238 deletions(-) (limited to 'os') diff --git a/os/hal/platforms/STM32/OTGv1/stm32_otg.h b/os/hal/platforms/STM32/OTGv1/stm32_otg.h index 45b1497d1..4b6d9fde3 100644 --- a/os/hal/platforms/STM32/OTGv1/stm32_otg.h +++ b/os/hal/platforms/STM32/OTGv1/stm32_otg.h @@ -56,8 +56,8 @@ typedef struct { * @brief Device input endpoint registers group. */ typedef struct { - volatile uint32_t DIEPCTL; /**< @brief Device control IN endpoint control - register. */ + volatile uint32_t DIEPCTL; /**< @brief Device control IN endpoint + control register. */ volatile uint32_t resvd4; volatile uint32_t DIEPINT; /**< @brief Device IN endpoint interrupt register. */ @@ -74,14 +74,14 @@ typedef struct { * @brief Device output endpoint registers group. */ typedef struct { - volatile uint32_t DOEPCTL; /**< @brief Device control OUT endpoint control - register. */ + volatile uint32_t DOEPCTL; /**< @brief Device control OUT endpoint + control register. */ volatile uint32_t resvd4; volatile uint32_t DOEPINT; /**< @brief Device OUT endpoint interrupt register. */ volatile uint32_t resvdC; - volatile uint32_t DOEPTSIZ; /**< @brief Device OUT endpoint transfer size - register. */ + volatile uint32_t DOEPTSIZ; /**< @brief Device OUT endpoint transfer + size register. */ volatile uint32_t resvd14; volatile uint32_t resvd18; volatile uint32_t resvd1C; @@ -103,9 +103,9 @@ typedef struct { volatile uint32_t GRXSTSP; /**< @brief Receive status read/pop register. */ volatile uint32_t GRXFSIZ; /**< @brief Receive FIFO size register. */ - volatile uint32_t DIEPTXF0; /**< @brief endpoint 0 transmit FIFO size + volatile uint32_t DIEPTXF0; /**< @brief Endpoint 0 transmit FIFO size register. */ - volatile uint32_t HNPTXSTS; /**< @brief non-periodic transmit FIFO/queue + volatile uint32_t HNPTXSTS; /**< @brief Non-periodic transmit FIFO/queue status register. */ volatile uint32_t resvd30; volatile uint32_t resvd34; @@ -114,7 +114,7 @@ typedef struct { volatile uint32_t resvd58[48]; volatile uint32_t HPTXFSIZ; /**< @brief Host periodic transmit FIFO size register. */ - volatile uint32_t DIEPTXF[15];/**< @brief Ddevice IN endpoint transmit FIFO + volatile uint32_t DIEPTXF[15];/**< @brief Device IN endpoint transmit FIFO size registers. */ volatile uint32_t resvd140[176]; volatile uint32_t HCFG; /**< @brief Host configuration register. */ @@ -148,9 +148,9 @@ typedef struct { mask register. */ volatile uint32_t resvd820; volatile uint32_t resvd824; - volatile uint32_t DVBUSDIS; /**< @brief Device VBUS Discharge time + volatile uint32_t DVBUSDIS; /**< @brief Device VBUS discharge time register. */ - volatile uint32_t DVBUSPULSE; /**< @brief Device VBUS Pulsing time + volatile uint32_t DVBUSPULSE; /**< @brief Device VBUS pulsing time register. */ volatile uint32_t resvd830; volatile uint32_t DIEPEMPMSK; /**< @brief Device IN endpoint FIFO empty @@ -387,286 +387,206 @@ typedef struct { /** @} */ /** - * @name GNPTXFSIZ register bit definitions - * @{ - */ -#define GNPTXFSIZ_NPTXFD_MASK (0xFFFFU<<16)/**< Non-periodic TxFIFO depth - mask. */ -#define GNPTXFSIZ_NPTXFD(n) ((n##U)<<16)/**< Non-periodic TxFIFO depth - value. */ -#define GNPTXFSIZ_NPTXFSA_MASK (0xFFFFU<<0)/**< Non-periodic transmit RAM - start address mask. */ -#define GNPTXFSIZ_NPTXFSA(n) ((n##U)<<0) /**< Non-periodic transmit RAM - start address value. */ -/** @} */ - -/** - * @name GNPTXSTS register bit definitions + * @name GCCFG register bit definitions * @{ */ -#define GNPTXSTS_NPTxQTop_MASK (0x7F<<24) /**< Top of the non-periodic - transmit request queue - mask. */ -#define GNPTXSTS_NPTxQTop(n) ((n)<<24) /**< Top of the non-periodic - transmit request queue - value. */ -#define GNPTXSTS_NPTxQSpcAvail_MASK (0xFF<<16) /**< non-periodic transmit - request queue Space - Available mask. */ -#define GNPTXSTS_NPTxQSpcAvail(n) ((n)<<16) /**< non-periodic transmit - request queue Space - Available value. */ -#define GNPTXSTS_NPTxFSpcAvail_MASK (0xFFFF<<0) /**< non-periodic TxFIFO - Space Available mask. */ -#define GNPTXSTS_NPTxFSpcAvail(n) ((n)<<0) /**< non-periodic TxFIFO - Space Available value. */ +#define GCCFG_SOFOUTEN (1U<<20) /**< SOF output enable. */ +#define GCCFG_VBUSBSEN (1U<<19) /**< Enable the VBUS sensing "B" + device. */ +#define GCCFG_VBUSASEN (1U<<18) /**< Enable the VBUS sensing "A" + device. */ +#define GCCFG_PWRDWN (1U<<16) /**< Power down. */ /** @} */ /** * @name HPTXFSIZ register bit definitions * @{ */ -#define HPTXFSIZ_PTxFsize_MASK (0xFFFF<<16)/**< Host periodic TxFIFO - Depth mask. */ -#define HPTXFSIZ_PTxFsize(n) ((n)<<16) /**< Host periodic TxFIFO - Depth value. */ -#define HPTXFSIZ_PTxFStAddr_MASK (0xFFFF<<0) /**< Host periodic TxFIFO - Start Address mask. */ -#define HPTXFSIZ_PTxFStAddr(n) ((n)<<0) /**< Host periodic TxFIFO - Start Address value. */ -/** @} */ - -/** - * @name DPTXFSIZ register bit definitions - * @{ - */ -#define DPTXFSIZ_DPTxFsize_MASK (0xFFFF<<16 /**< Device periodic TxFIFO - size mask. */ -#define DPTXFSIZ_DPTxFsize(n) ((n)<<16) /**< Device periodic TxFIFO - size value. */ -#define DPTXFSIZ_DPTxFStAddr_MASK (0xFFFF<<0) /**< Device periodic TxFIFO - RAM Start Address mask.*/ -#define DPTXFSIZ_DPTxFStAddr(n) ((n)<<0) /**< Device periodic TxFIFO - RAM Start Address - value. */ +#define HPTXFSIZ_PTXFD_MASK (0xFFFFU<<16)/**< Host periodic TxFIFO + depth mask. */ +#define HPTXFSIZ_PTXFD(n) ((n##U)<<16)/**< Host periodic TxFIFO + depth value. */ +#define HPTXFSIZ_PTXSA_MASK (0xFFFFU<<0)/**< Host periodic TxFIFO + Start address mask. */ +#define HPTXFSIZ_PTXSA(n) ((n##U)<<0) /**< Host periodic TxFIFO + start address value. */ /** @} */ /** * @name HCFG register bit definitions * @{ */ -#define HCFG_ResValid_MASK (0xFF<<8) /**< Resume Validation - Period mask. */ -#define HCFG_ResValid(n) ((n)<<8) /**< Resume Validation - Period value. */ -#define HCFG_Ena32KHzS (1U<<7) /**< enable 32-KHz suspend - Mode. */ -#define HCFG_FSLSSupp (1U<<2) /**< FS- and LS-Only - Support. */ -#define HCFG_FSLSPclkSel_MASK (3<<0) /**< FS/LS PHY clock Select - mask. */ -#define HCFG_FSLSPclkSel_30_60 (0<<0) /**< PHY clock is running at - 30/60 MHz. */ -#define HCFG_FSLSPclkSel_48 (1U<<0) /**< PHY clock is running at - 48 MHz. */ +#define HCFG_FSLSS (1U<<2) /**< FS- and LS-only support. */ +#define HCFG_FSLSPCS_MASK (3U<<0) /**< FS/LS PHY clock select + mask. */ +#define HCFG_FSLSPCS_48 (1U<<0) /**< PHY clock is running at + 48 MHz. */ +#define HCFG_FSLSPCS_6 (2U<<0) /**< PHY clock is running at + 6 MHz. */ /** @} */ /** * @name HFIR register bit definitions * @{ */ -#define HFIR_FrInt_MASK (0xFFFF<<0) /**< frame interval mask. */ -#define HFIR_FrInt(n) ((n)<<0) /**< frame interval value. */ +#define HFIR_FRIVL_MASK (0xFFFFU<<0)/**< Frame interval mask. */ +#define HFIR_FRIVL(n) ((n##U)<<0) /**< Frame interval value. */ /** @} */ /** * @name HFNUM register bit definitions * @{ */ -#define HFNUM_FrRem_MASK (0xFFFF<<16)/**< frame time Remaining - mask. */ -#define HFNUM_FrRem(n) ((n)<<16) /**< frame time Remaining - value. */ -#define HFNUM_FrNum_MASK (0xFFFF<<0) /**< frame number mask. */ -#define HFNUM_FrNum(n) ((n)<<0) /**< frame number value. */ +#define HFNUM_FTREM_MASK (0xFFFFU<<16)/**< Frame time Remaining mask.*/ +#define HFNUM_FTREM(n) ((n##U)<<16)/**< Frame time Remaining value.*/ +#define HFNUM_FRNUM_MASK (0xFFFFU<<0)/**< Frame number mask. */ +#define HFNUM_FRNUM(n) ((n##U)<<0) /**< Frame number value. */ /** @} */ /** * @name HPTXSTS register bit definitions * @{ */ -#define HPTXSTS_PTxQTop_MASK (0xFF<<24) /**< Top of the periodic - transmit request queue - mask. */ -#define HPTXSTS_PTxQTop(n) ((n)<<24) /**< Top of the periodic - transmit request queue - value. */ -#define HPTXSTS_PTxQSpcAvail_MASK (0xFF<<16) /**< periodic transmit request - queue Space Available - mask. */ -#define HPTXSTS_PTxQSpcAvail(n) ((n)<<16) /**< periodic transmit request - queue Space Available - value. */ -#define HPTXSTS_PTxFSpcAvail_MASK (0xFFFF<<0) /**< periodic transmit Data - FIFO Space Available - mask. */ -#define HPTXSTS_PTxFSpcAvail(n) ((n)<<0) /**< periodic transmit Data - FIFO Space Available - value. */ +#define HPTXSTS_PTXQTOP_MASK (0xFFU<<24) /**< Top of the periodic + transmit request queue + mask. */ +#define HPTXSTS_PTXQTOP(n) ((n##U)<<24)/**< Top of the periodic + transmit request queue + value. */ +#define HPTXSTS_PTXQSAV_MASK (0xFF<<16) /**< Periodic transmit request + queue Space Available + mask. */ +#define HPTXSTS_PTXQSAV(n) ((n##U)<<16)/**< Periodic transmit request + queue Space Available + value. */ +#define HPTXSTS_PTXFSAVL_MASK (0xFFFF<<0) /**< Periodic transmit Data + FIFO Space Available + mask. */ +#define HPTXSTS_PTXFSAVL(n) ((n##U)<<0) /**< Periodic transmit Data + FIFO Space Available + value. */ /** @} */ /** * @name HAINT register bit definitions * @{ */ -#define HAINT_HAINT_MASK (0xFFFF<<0) /**< channel interrupts - mask. */ -#define HAINT_HAINT(n) ((n)<<0) /**< channel interrupts - value. */ +#define HAINT_HAINT_MASK (0xFFFFU<<0)/**< Channel interrupts mask. */ +#define HAINT_HAINT(n) ((n##U)<<0) /**< Channel interrupts value. */ /** @} */ /** * @name HAINTMSK register bit definitions * @{ */ -#define HAINTMSK_HAINTMsk_MASK (0xFFFF<<0) /**< channel interrupt mask - mask. */ -#define HAINTMSK_HAINTMsk(n) ((n)<<0) /**< channel interrupt mask - value. */ +#define HAINTMSK_HAINTM_MASK (0xFFFFU<<0)/**< Channel interrupt mask + mask. */ +#define HAINTMSK_HAINTM(n) ((n##U)<<0) /**< Channel interrupt mask + value. */ /** @} */ /** * @name HPRT register bit definitions * @{ */ -#define HPRT_PrtSpd_MASK (3<<17) /**< port Speed mask. */ -#define HPRT_PrtSpd_HS (0<<17) /**< High Speed value. */ -#define HPRT_PrtSpd_FS (1U<<17) /**< Full Speed value. */ -#define HPRT_PrtSpd_LS (2<<17) /**< Low Speed value. */ -#define HPRT_PrtTstCtl_MASK (15<<13) /**< port Test control mask.*/ -#define HPRT_PrtTstCtl(n) ((n)<<13) /**< port Test control - value. */ -#define HPRT_PrtPwr (1U<<12) /**< port power. */ -#define HPRT_PrtLnSts_MASK (3<<11) /**< port Line status mask. */ -#define HPRT_PrtLnSts_DM (1U<<11) /**< Logic level of D-. */ -#define HPRT_PrtLnSts_DP (1U<<10) /**< Logic level of D+. */ -#define HPRT_PrtRst (1U<<8) /**< port reset. */ -#define HPRT_PrtSusp (1U<<7) /**< port suspend. */ -#define HPRT_PrtRes (1U<<6) /**< port Resume. */ -#define HPRT_PrtOvrCurrChng (1U<<5) /**< port Overcurrent - change. */ -#define HPRT_PrtOvrCurrAct (1U<<4) /**< port Overcurrent - Active. */ -#define HPRT_PrtEnChng (1U<<3) /**< port enable/Disable - change. */ -#define HPRT_PrtEna (1U<<2) /**< port enable. */ -#define HPRT_PrtConnDet (1U<<1) /**< port Connect detected. */ -#define HPRT_PrtConnSts (1U<<0) /**< .*/ +#define HPRT_PSPD_MASK (3U<<17) /**< Port speed mask. */ +#define HPRT_PSPD_FS (1U<<17) /**< Full speed value. */ +#define HPRT_PSPD_LS (2U<<17) /**< Low speed value. */ +#define HPRT_PTCTL_MASK (15<<13) /**< Port Test control mask. */ +#define HPRT_PTCTL(n) ((n##U)<<13)/**< Port Test control value. */ +#define HPRT_PPWR (1U<<12) /**< Port power. */ +#define HPRT_PLSTS_MASK (3U<<11) /**< Port Line status mask. */ +#define HPRT_PLSTS_DM (1U<<11) /**< Logic level of D-. */ +#define HPRT_PLSTS_DP (1U<<10) /**< Logic level of D+. */ +#define HPRT_PRST (1U<<8) /**< Port reset. */ +#define HPRT_PSUSP (1U<<7) /**< Port suspend. */ +#define HPRT_PRES (1U<<6) /**< Port Resume. */ +#define HPRT_POCCHNG (1U<<5) /**< Port overcurrent change. */ +#define HPRT_POCA (1U<<4) /**< Port overcurrent active. */ +#define HPRT_PENCHNG (1U<<3) /**< Port enable/disable change.*/ +#define HPRT_PENA (1U<<2) /**< Port enable. */ +#define HPRT_PCDET (1U<<1) /**< Port Connect detected. */ +#define HPRT_PCSTS (1U<<0) /**< Port connect status. */ /** @} */ /** * @name HCCHAR register bit definitions * @{ */ -#define HCCHAR_ChEna (1u<<31) /**< channel enable. */ -#define HCCHAR_ChDis (1U<<30) /**< channel Disable. */ -#define HCCHAR_OddFrm (1U<<29) /**< Odd frame. */ -#define HCCHAR_DevAddr_MASK (0x7F<<22) /**< Device Address mask. */ -#define HCCHAR_DevAddr(n) ((n)<<22) /**< Device Address value. */ -#define HCCHAR_MC_EC_MASK (3<<20) /**< Multi count (MC) / Error - count mask. */ -#define HCCHAR_MC_EC(n) ((n)<<20) /**< Multi count (MC) / Error - count value. */ -#define HCCHAR_EPType_MASK (3<<18) /**< .*/ -#define HCCHAR_EPType(n) ((n)<<18) /**< endpoint Type mask. */ -#define HCCHAR_EPType_control (0<<18) /**< control endpoint value.*/ -#define HCCHAR_EPType_isochronous (1U<<18) /**< isochronous endpoint - value. */ -#define HCCHAR_EPType_Bulk (2<<18) /**< Bulk endpoint value. */ -#define HCCHAR_EPType_interrupt (3<<18) /**< interrupt endpoint - value. */ -#define HCCHAR_LSpdDev (1U<<17) /**< Low-Speed Device. */ -#define HCCHAR_EPDir (1U<<15) /**< endpoint Direction. */ -#define HCCHAR_EPNum_MASK (15<<11) /**< endpoint number mask. */ -#define HCCHAR_EPNum(n) ((n)<<11) /**< endpoint number value. */ -#define HCCHAR_MPS_MASK (11<<0) /**< Maximum Packet size - mask. */ -#define HCCHAR_MPS(n) (11<<0) /**< Maximum Packet size - value. */ -/** @} */ - -/** - * @name HCSPLT register bit definitions - * @{ - */ -#define HCSPLT_SpltEna (1u<<31) /**< Split enable. */ -#define HCSPLT_CompSplt (1U<<16) /**< Do Complete Split. */ -#define HCSPLT_XactPos_MASK (3<<14) /**< Transaction Position. */ -#define HCSPLT_XactPos_Mid (0<<14) /**< Middle. */ -#define HCSPLT_XactPos_end (1U<<14) /**< End. */ -#define HCSPLT_XactPos_Begin (2<<14) /**< Begin. */ -#define HCSPLT_XactPos_all (3<<14) /**< All. */ -#define HCSPLT_HubAddr_MASK (0x7F<<6) /**< Hub Address mask. */ -#define HCSPLT_HubAddr(n) ((n)<