PowerCC27XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2024, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
84 #ifndef ti_drivers_power_PowerCC27XX_
85 #define ti_drivers_power_PowerCC27XX_
86 
87 #include <ti/drivers/dpl/HwiP.h>
88 #include <ti/drivers/dpl/ClockP.h>
89 #include <ti/drivers/Power.h>
90 
91 #include <ti/devices/DeviceFamily.h>
92 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
93 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
94 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
95 #include DeviceFamily_constructPath(inc/hw_memmap.h)
96 #include DeviceFamily_constructPath(inc/hw_types.h)
97 #include DeviceFamily_constructPath(driverlib/pmctl.h)
98 
99 #ifdef __cplusplus
100 extern "C" {
101 #endif
102 
104 #define PowerCC27XX_RESUMETIMESTANDBY 400
105 
107 #define PowerCC27XX_TOTALTIMESTANDBY 1000
108 
110 #define PowerCC27XX_WAKEDELAYSTANDBY 500
111 
112 /* \cond */
113 /* The control of the peripherals are split between multiple groups.
114  * These defines are used to differentiate between the groups.
115  * The bits in the PowerCC27XX_PERIPH_GROUP_M mask is used to store the group id,
116  * and the bits in the PowerCC27XX_PERIPH_BIT_INDEX_M mask is used to store the
117  * bit index shift value in the register for the given group.
118  */
119 #define PowerCC27XX_PERIPH_GROUP_M 0xFF00
120 #define PowerCC27XX_PERIPH_GROUP_CLKCTL0 0x0000
121 #define PowerCC27XX_PERIPH_GROUP_CLKCTL1 0x0100
122 #define PowerCC27XX_PERIPH_GROUP_LRFD 0x0200
123 #define PowerCC27XX_PERIPH_BIT_INDEX_M 0x00FF
124 
125 /* \endcond */
126 
127 /* \cond */
128 typedef uint16_t PowerLPF3_Resource; /* Power resource identifier */
129 /* \endcond */
130 
131 /* Resource IDs */
132 
134 #define PowerLPF3_PERIPH_GPIO (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
135 
137 #define PowerLPF3_PERIPH_UART0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
138 
140 #define PowerLPF3_PERIPH_UART1 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART1_S)
141 
143 #define PowerLPF3_PERIPH_I2C0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
144 
146 #define PowerLPF3_PERIPH_SPI0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
147 
149 #define PowerLPF3_PERIPH_SPI1 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI1_S)
150 
152 #define PowerLPF3_PERIPH_ADC0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
153 
155 #define PowerLPF3_PERIPH_AES (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
156 
158 #define PowerLPF3_PERIPH_DMA (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
159 
161 #define PowerLPF3_PERIPH_I2S (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2S_S)
162 
164 #define PowerLPF3_PERIPH_LGPT0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
165 
167 #define PowerLPF3_PERIPH_LGPT1 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
168 
170 #define PowerLPF3_PERIPH_LGPT2 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
171 
173 #define PowerLPF3_PERIPH_LGPT3 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
174 
176 #define PowerLPF3_PERIPH_HSM (PowerCC27XX_PERIPH_GROUP_CLKCTL1 | CLKCTL_DESCEX1_HSM_S)
177 
179 #define PowerLPF3_PERIPH_VCE (PowerCC27XX_PERIPH_GROUP_CLKCTL1 | CLKCTL_DESCEX1_VCE_S)
180 
182 #define PowerLPF3_PERIPH_MCAN (PowerCC27XX_PERIPH_GROUP_CLKCTL1 | CLKCTL_DESCEX1_MCAN_S)
183 
185 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC27XX_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
186 
188 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC27XX_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
189 
190 /* \cond */
191 /* Number of resources in the different resource groups. This is possibly larger
192  * than the peripheral instance count on various device variants. This is
193  * because some indexes might not be used for a given variant, resulting in a
194  * sparse table.
195  */
196 #define PowerCC27XX_NUMRESOURCES_CLKCTL0 31
197 #define PowerCC27XX_NUMRESOURCES_CLKCTL1 7
198 #define PowerCC27XX_NUMRESOURCES_LRFD 12
199 
200 /* \endcond */
201 
202 #define PowerLPF3_STANDBY 0x1
203 /* \cond */
204 /* Internal flags for enabling/disabling resources */
205 #define PowerLPF3_ENABLE 1
206 #define PowerLPF3_DISABLE 0
207 /* \endcond */
208 
209 /* Constraints
210  *
211  * Constraints restrict a specific system behavior from occurring or guarantee
212  * a specified effect until released.
213  */
214 
216 #define PowerLPF3_DISALLOW_SHUTDOWN 0
217 
219 #define PowerLPF3_DISALLOW_STANDBY 1
220 
222 #define PowerLPF3_DISALLOW_IDLE 2
223 
225 #define PowerLPF3_NEED_FLASH_IN_IDLE 3
226 
227 /* \cond */
228 #define PowerCC27XX_NUMCONSTRAINTS 4 /* Number of constraints supported */
229 /* \endcond */
230 
231 /*
232  * Events
233  *
234  * Each event must be a power of two and must be sequential
235  * without any gaps.
236  */
237 
239 #define PowerLPF3_ENTERING_STANDBY (1 << 0)
240 
242 #define PowerLPF3_ENTERING_SHUTDOWN (1 << 1)
243 
245 #define PowerLPF3_AWAKE_STANDBY (1 << 2)
246 
250 #define PowerLPF3_HFXT_AVAILABLE (1 << 3)
251 
255 #define PowerLPF3_LFCLK_SWITCHED (1 << 4)
256 
257 /* \cond */
258 #define PowerCC27XX_NUMEVENTS 5 /* Number of events supported */
259 /* \endcond */
260 
268 
270 typedef struct
271 {
308 
325 
329 typedef enum
330 {
332  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
334  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
336  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
338  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
340  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
342  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
344  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
346  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
348  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
350  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
352  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
354  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
356  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
358 
364 typedef enum
365 {
370 
374 typedef enum
375 {
379 
389 typedef struct
390 {
396 
399 
404 
406 
417 void PowerCC27XX_doWFI(void);
418 
426 static inline PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
427 {
428  return (PowerLPF3_ResetReason)PMCTLGetResetReason();
429 }
430 
445 static inline void PowerLPF3_releaseLatches(void)
446 {
447  HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
448 }
449 
473 void PowerCC27XX_standbyPolicy(void);
474 
490 void PowerLPF3_selectLFOSC(void);
491 
507 void PowerLPF3_selectLFXT(void);
508 
529 void PowerLPF3_selectEXTLF(void);
530 
551 int_fast16_t PowerLPF3_startAFOSC(PowerLPF3_AfoscFreq frequency);
552 
560 void PowerLPF3_stopAFOSC(void);
561 
569 
588 int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void);
589 
609 void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment);
610 
621 
641 
655 
666 
669 
670 #ifdef __cplusplus
671 }
672 #endif
673 
674 #endif /* POWER_CC27XX_ */
static void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC27XX.h:445
Definition: PowerCC27XX.h:334
Definition: PowerCC27XX.h:338
Definition: PowerCC27XX.h:366
Definition: PowerCC27XX.h:356
Clock interface for the RTOS Porting Interface.
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:401
Power Manager.
PowerLPF3_StartInitialHfxtAmpCompFxn startInitialHfxtAmpCompFxn
Pointer to the function to start the initial HFXT amplitude compensation.
Definition: PowerCC27XX.h:323
Definition: PowerCC27XX.h:350
uint32_t systemWakeupIntervalUsec
The expected interval in us between system wakeups.
Definition: PowerCC27XX.h:395
Definition: PowerCC27XX.h:367
void PowerLPF3_stopAFOSC(void)
Stop the AFOSC.
void PowerLPF3_selectEXTLF(void)
Select EXTLF as LFCLK source.
Definition: PowerCC27XX.h:348
void PowerCC27XX_standbyPolicy(void)
The STANDBY Power Policy.
Definition: PowerCC27XX.h:340
Definition: PowerCC27XX.h:354
Definition: PowerCC27XX.h:344
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:406
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC27XX.h:329
void PowerLPF3_startInitialHfxtAmpComp(void)
Start initial compensation of the HFXT amplitude.
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC27XX.h:307
Global configuration structure.
Definition: PowerCC27XX.h:270
PowerLPF3_LfoscCompensationPpmRequirement ppmRequirement
The PPM requirements.
Definition: PowerCC27XX.h:398
void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment)
Adjust the HFXT amplitude.
void PowerCC27XX_schedulerDisable(void)
void PowerLPF3_selectLFXT(void)
Select LFXT as LFCLK source.
PowerLPF3_AfoscFreq
The possible frequencies to configure the AFOSC to.
Definition: PowerCC27XX.h:364
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC27XX.h:278
Definition: PowerCC27XX.h:336
Definition: PowerCC27XX.h:352
Definition: PowerCC27XX.h:332
Definition: PowerCC27XX.h:368
void PowerLPF3_setLfoscCompensationProfile(const PowerLPF3_LfoscCompensationProfile *profile)
Set LFOSC Compensation Profile.
500 PPM
Definition: PowerCC27XX.h:377
void PowerLPF3_disableLfoscCompensation(void)
Disable LFOSC Compensation.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
void(* PowerLPF3_StartInitialHfxtAmpCompFxn)(void)
Function pointer to PowerLPF3_startInitialHfxtAmpComp() or NULL.
Definition: PowerCC27XX.h:267
static PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
Definition: PowerCC27XX.h:426
int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void)
Check if HFXT amplitude needs to be adjusted.
LFOSC Compensation Profile structure.
Definition: PowerCC27XX.h:389
Definition: PowerCC27XX.h:342
Definition: PowerCC27XX.h:346
PowerLPF3_LfoscCompensationPpmRequirement
Possible LFOSC PPM requirements to be used by the LFOSC compensation.
Definition: PowerCC27XX.h:374
void PowerLPF3_initLfoscCompensation(void)
Initialize LFOSC Compensation.
uint16_t temperatureGradientMilliCelsiusPerSec
The absolute value of the worst case expected temperature gradient in mC/s.
Definition: PowerCC27XX.h:403
Hardware Interrupt module for the RTOS Porting Interface.
void PowerCC27XX_doWFI(void)
The wait for interrupt (WFI) policy.
void PowerCC27XX_schedulerRestore(void)
void PowerLPF3_enableLfoscCompensation(void)
Enable LFOSC Compensation.
int_fast16_t PowerLPF3_startAFOSC(PowerLPF3_AfoscFreq frequency)
Start the AFOSC.
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale