1 /******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
\r
3 * Author : MCD Application Team
\r
4 * Date First Issued : 30/05/2003
\r
5 * Description : This file contains all the functions prototypes for the
\r
6 * PCU software library.
\r
7 ********************************************************************************
\r
12 *******************************************************************************
\r
13 THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
\r
14 CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
\r
15 AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
\r
16 OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
\r
17 OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
\r
18 CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
19 *******************************************************************************/
\r
23 #include "71x_map.h"
\r
57 // VR_OK : Voltage Regulator OK
\r
58 #define PCU_VROK_Mask 0x1000
\r
60 // Main Voltage Regulator
\r
61 #define PCU_MVR_Mask 0x0008
\r
63 // Low Power Voltage Regulator
\r
64 #define PCU_LPR_Mask 0x0020
\r
66 // PCU register Write Enable Bit
\r
67 #define PCU_WREN_Mask 0x8000
\r
69 // Low Voltage Detector
\r
70 #define PCU_LVD_Mask 0x0100
\r
73 #define PCU_PWRDWN_Mask 0x0040
\r
75 // WFI Mode Clock Selection Bit
\r
76 #define PCU_WFI_CKSEL_Mask 0x00000002
\r
78 // Halt Mode Enable Bit
\r
79 #define PCU_EN_HALT_Mask 0x00000800
\r
82 #define PCU_HALT_Mask 0x0002
\r
84 // Stop Mode Enable Bit
\r
85 #define PCU_STOP_EN_Mask 0x00000400
\r
87 // Low Power Regulator in Wait For interrupt Mode
\r
88 #define PCU_LPRWFI_Mask 0x0020
\r
90 // Low Power Mode in Wait For interrupt Mode
\r
91 #define PCU_LPOWFI_Mask 0x00000001
\r
93 // Software Reset Enable
\r
94 #define PCU_SRESEN_Mask 0x00000001
\r
97 /*******************************************************************************
\r
98 * Function Name : PCU_MVRStatus
\r
99 * Description : This routine is used to check the Main Voltage Regulator
\r
102 * Return : STABLE, UNSTABLE
\r
103 *******************************************************************************/
\r
104 inline PCU_VR_Status PCU_MVRStatus ( void )
\r
106 return (PCU->PWRCR & PCU_VROK_Mask) == 0x00 ? PCU_UNSTABLE : PCU_STABLE;
\r
109 /*******************************************************************************
\r
110 * Function Name : PCU_FlagStatus
\r
111 * Description : This routine is used to return the PCU register flag
\r
112 * Input 1 : The flag to get
\r
113 * Return : RESET, SET
\r
114 *******************************************************************************/
\r
115 inline FlagStatus PCU_FlagStatus ( PCU_Flags Xflag )
\r
117 return ( PCU->PWRCR & Xflag ) == 0x00 ? RESET : SET;
\r
120 /*******************************************************************************
\r
121 * Function Name : PCU_VRConfig
\r
122 * Description : This routine is used to configure PCU voltage regultors
\r
123 * Input 1 : MVR : Main voltage Regulator
\r
124 LPR : Low Power Regulator
\r
125 * Input 2 : ENABLE : Enable the Voltage Regulator
\r
126 DISABLE: Disable ( ByPass ) the VR
\r
128 *******************************************************************************/
\r
129 void PCU_VRConfig ( PCU_VR xVR, FunctionalState NewState );
\r
131 /*******************************************************************************
\r
132 * Function Name : PCU_VRStatus
\r
133 * Description : This routine is used to get the PCU voltage regultors status
\r
134 * Input : MVR : Main voltage Regulator
\r
135 LPR : Low Power Regulator
\r
136 * Return : ENABLE : Enable the Voltage Regulator
\r
137 DISABLE: Disable ( ByPass ) the VR
\r
138 *******************************************************************************/
\r
139 inline FunctionalState PCU_VRStatus ( PCU_VR xVR )
\r
141 return ( PCU->PWRCR & xVR ) == 0 ? ENABLE : DISABLE;
\r
144 /*******************************************************************************
\r
145 * Function Name : PCU_LVDDisable
\r
146 * Description : This routine is used to disable the Low Voltage Detector.
\r
149 *******************************************************************************/
\r
150 inline void PCU_LVDDisable ( void )
\r
152 PCU->PWRCR |= PCU_WREN_Mask; // Unlock Power Control Register
\r
153 PCU->PWRCR |= PCU_LVD_Mask; // Set the LVD DIS Flag
\r
156 /*******************************************************************************
\r
157 * Function Name : PCU_LVDStatus
\r
158 * Description : This routine is used to get the LVD NewState.
\r
160 * Return : ENABLE, DISABLE
\r
161 *******************************************************************************/
\r
162 inline FunctionalState PCU_LVDStatus ( void )
\r
164 return ( PCU->PWRCR & PCU_LVD_Mask ) == 0 ? ENABLE : DISABLE;
\r
167 /*******************************************************************************
\r
168 * Function Name : PCU_WFIEnter
\r
169 * Description : This routine is used to force the Device to enter in WFI mode
\r
170 * Input 1 : CLOCK2_16 : Clock2_16 as system clock for WFI mode
\r
171 * EXTERNAL : external clock as system clock for WFI mode
\r
172 * Input 2 : ENABLE : Enable Low Power Regulator during Wait For Interrupt Mode
\r
173 * DISABLE: Disable Low Power Regulator during Wait For Interrupt Mode
\r
174 * Input 3 : ENABLE : Enable Low Power Mode during Wait For Interrupt Mode
\r
175 * DISABLE: Disable Low Power Mode during Wait For Interrupt Mode
\r
177 *******************************************************************************/
\r
178 void PCU_WFIEnter ( WFI_CLOCKS Xclock, FunctionalState Xlpr, FunctionalState Xlpm );
\r
180 /*******************************************************************************
\r
181 * Function Name : PCU_LPMEnter
\r
182 * Description : This routine is used to force the Device to enter low
\r
184 * Input : SLOW : Slow Mode
\r
188 *******************************************************************************/
\r
189 void PCU_LPMEnter ( LPM_MODES Xmode);
\r
193 /******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/
\r