| M480 BSP V3.05.001 The Board Support Package for M480 Series

hsotg.h
Go to the documentation of this file.
1 /**************************************************************************/
9 #ifndef __HSOTG_H__
10 #define __HSOTG_H__
11
12 #ifdef __cplusplus
13 extern "C"
14 {
15 #endif
16
17
33 /*---------------------------------------------------------------------------------------------------------*/
34 /* HSOTG constant definitions */
35 /*---------------------------------------------------------------------------------------------------------*/
36 #define HSOTG_VBUS_EN_ACTIVE_HIGH (0UL)
37 #define HSOTG_VBUS_EN_ACTIVE_LOW (1UL)
38 #define HSOTG_VBUS_ST_VALID_HIGH (0UL)
39 #define HSOTG_VBUS_ST_VALID_LOW (1UL)
42 /* end of group HSOTG_EXPORTED_CONSTANTS */
43
44
49 /*---------------------------------------------------------------------------------------------------------*/
50 /* Define Macros and functions */
51 /*---------------------------------------------------------------------------------------------------------*/
52
53
61 #define HSOTG_ENABLE() (HSOTG->CTL |= HSOTG_CTL_OTGEN_Msk)
62
70 #define HSOTG_DISABLE() (HSOTG->CTL &= ~HSOTG_CTL_OTGEN_Msk)
71
80 #define HSOTG_ENABLE_PHY() (HSOTG->PHYCTL |= HSOTG_PHYCTL_OTGPHYEN_Msk)
81
89 #define HSOTG_DISABLE_PHY() (HSOTG->PHYCTL &= ~HSOTG_PHYCTL_OTGPHYEN_Msk)
90
98 #define HSOTG_ENABLE_ID_DETECT() (HSOTG->PHYCTL |= HSOTG_PHYCTL_IDDETEN_Msk)
99
107 #define HSOTG_DISABLE_ID_DETECT() (HSOTG->PHYCTL &= ~HSOTG_PHYCTL_IDDETEN_Msk)
108
116 #define HSOTG_ENABLE_WAKEUP() (HSOTG->CTL |= HSOTG_CTL_WKEN_Msk)
117
125 #define HSOTG_DISABLE_WAKEUP() (HSOTG->CTL &= ~HSOTG_CTL_WKEN_Msk)
126
136 #define HSOTG_SET_VBUS_EN_POL(u32Pol) (HSOTG->PHYCTL = (HSOTG->PHYCTL & (~HSOTG_PHYCTL_VBENPOL_Msk)) | ((u32Pol)<<HSOTG_PHYCTL_VBENPOL_Pos))
137
147 #define HSOTG_SET_VBUS_STS_POL(u32Pol) (HSOTG->PHYCTL = (HSOTG->PHYCTL & (~HSOTG_PHYCTL_VBSTSPOL_Msk)) | ((u32Pol)<<HSOTG_PHYCTL_VBSTSPOL_Pos))
148
169 #define HSOTG_ENABLE_INT(u32Mask) (HSOTG->INTEN |= (u32Mask))
170
191 #define HSOTG_DISABLE_INT(u32Mask) (HSOTG->INTEN &= ~(u32Mask))
192
213 #define HSOTG_GET_INT_FLAG(u32Mask) (HSOTG->INTSTS & (u32Mask))
214
235 #define HSOTG_CLR_INT_FLAG(u32Mask) (HSOTG->INTSTS = (u32Mask))
236
250 #define HSOTG_GET_STATUS(u32Mask) (HSOTG->STATUS & (u32Mask))
251
252
253 /* end of group HSOTG_EXPORTED_FUNCTIONS */
255 /* end of group HSOTG_Driver */
257 /* end of group Standard_Driver */
259
260
261 #ifdef __cplusplus
262 }
263 #endif
264
265
266 #endif /* __HSOTG_H__ */
267
268 /*** (C) COPYRIGHT 2017 Nuvoton Technology Corp. ***/