PowerCC27XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2025, 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  */
111 #ifndef ti_drivers_power_PowerCC27XX_
112 #define ti_drivers_power_PowerCC27XX_
113 
114 #include <ti/drivers/dpl/HwiP.h>
115 #include <ti/drivers/dpl/ClockP.h>
116 #include <ti/drivers/Power.h>
117 
118 #include <ti/devices/DeviceFamily.h>
119 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
120 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
121 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
122 #include DeviceFamily_constructPath(inc/hw_memmap.h)
123 #include DeviceFamily_constructPath(inc/hw_types.h)
124 #include DeviceFamily_constructPath(driverlib/pmctl.h)
125 
126 #ifdef __cplusplus
127 extern "C" {
128 #endif
129 
131 #define PowerCC27XX_RESUMETIMESTANDBY (400U)
132 
134 #define PowerCC27XX_TOTALTIMESTANDBY (500U)
135 
137 #define PowerCC27XX_WAKEDELAYSTANDBY (150U)
138 
139 /* Default lower threshold for when HFXT compensation is enabled */
140 #define PowerCC27XX_HFXT_THRESHOLD_TEMP_DEFAULT (-40)
141 
142 /* \cond */
143 /* The control of the peripherals are split between multiple groups.
144  * These defines are used to differentiate between the groups.
145  * The bits in the PowerCC27XX_PERIPH_GROUP_M mask is used to store the group id,
146  * and the bits in the PowerCC27XX_PERIPH_BIT_INDEX_M mask is used to store the
147  * bit index shift value in the register for the given group.
148  */
149 #define PowerCC27XX_PERIPH_GROUP_M (0xFF00U)
150 #define PowerCC27XX_PERIPH_GROUP_CLKCTL0 (0x0000U)
151 #define PowerCC27XX_PERIPH_GROUP_CLKCTL1 (0x0100U)
152 #define PowerCC27XX_PERIPH_GROUP_LRFD (0x0200U)
153 #define PowerCC27XX_PERIPH_BIT_INDEX_M (0x00FFU)
154 
155 /* \endcond */
156 
157 /* \cond */
158 typedef uint16_t PowerLPF3_Resource; /* Power resource identifier */
159 /* \endcond */
160 
161 /* Resource IDs */
162 
164 #define PowerLPF3_PERIPH_GPIO (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
165 
167 #define PowerLPF3_PERIPH_UART0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
168 
170 #define PowerLPF3_PERIPH_UART1 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART1_S)
171 
173 #define PowerLPF3_PERIPH_I2C0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
174 
176 #define PowerLPF3_PERIPH_SPI0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
177 
179 #define PowerLPF3_PERIPH_SPI1 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI1_S)
180 
182 #define PowerLPF3_PERIPH_ADC0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
183 
185 #define PowerLPF3_PERIPH_AES (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
186 
188 #define PowerLPF3_PERIPH_DMA (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
189 
191 #define PowerLPF3_PERIPH_I2S (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2S_S)
192 
194 #define PowerLPF3_PERIPH_LGPT0 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
195 
197 #define PowerLPF3_PERIPH_LGPT1 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
198 
200 #define PowerLPF3_PERIPH_LGPT2 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
201 
203 #define PowerLPF3_PERIPH_LGPT3 (PowerCC27XX_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
204 
206 #define PowerLPF3_PERIPH_HSM (PowerCC27XX_PERIPH_GROUP_CLKCTL1 | CLKCTL_DESCEX1_HSM_S)
207 
209 #define PowerLPF3_PERIPH_APU (PowerCC27XX_PERIPH_GROUP_CLKCTL1 | CLKCTL_DESCEX1_APU_S)
210 
212 #define PowerLPF3_PERIPH_MCAN (PowerCC27XX_PERIPH_GROUP_CLKCTL1 | CLKCTL_DESCEX1_MCAN_S)
213 
215 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC27XX_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
216 
218 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC27XX_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
219 
220 /* \cond */
221 /* Number of resources in the different resource groups. This is possibly larger
222  * than the peripheral instance count on various device variants. This is
223  * because some indexes might not be used for a given variant, resulting in a
224  * sparse table.
225  */
226 #define PowerCC27XX_NUMRESOURCES_CLKCTL0 (31U)
227 #define PowerCC27XX_NUMRESOURCES_CLKCTL1 (7U)
228 #define PowerCC27XX_NUMRESOURCES_LRFD (12U)
229 
230 /* \endcond */
231 
232 #define PowerLPF3_STANDBY (0x1U)
233 /* \cond */
234 
235 /* Constraints
236  *
237  * Constraints restrict a specific system behavior from occurring or guarantee
238  * a specified effect until released.
239  */
240 
242 #define PowerLPF3_DISALLOW_SHUTDOWN (0U)
243 
245 #define PowerLPF3_DISALLOW_STANDBY (1U)
246 
248 #define PowerLPF3_DISALLOW_IDLE (2U)
249 
251 #define PowerLPF3_NEED_FLASH_IN_IDLE (3U)
252 
254 #define PowerLPF3_DISALLOW_SWTCXO (4U)
255 
256 /* \cond */
257 #define PowerCC27XX_NUMCONSTRAINTS (5U) /* Number of constraints supported */
258 /* \endcond */
259 
260 /*
261  * Events
262  *
263  * Each event must be a power of two and must be sequential
264  * without any gaps.
265  */
266 
268 #define PowerLPF3_ENTERING_STANDBY ((uint_fast16_t)((uint_fast16_t)1U << 0))
269 
271 #define PowerLPF3_ENTERING_SHUTDOWN ((uint_fast16_t)((uint_fast16_t)1U << 1))
272 
274 #define PowerLPF3_AWAKE_STANDBY ((uint_fast16_t)((uint_fast16_t)1U << 2))
275 
279 #define PowerLPF3_HFXT_AVAILABLE ((uint_fast16_t)((uint_fast16_t)1U << 3))
280 
284 #define PowerLPF3_LFCLK_SWITCHED ((uint_fast16_t)((uint_fast16_t)1U << 4))
285 
286 /* \cond */
287 #define PowerCC27XX_NUMEVENTS (5U) /* Number of events supported */
288 /* \endcond */
289 
297 
299 typedef struct
300 {
337 
354 
358 typedef enum
359 {
361  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
363  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
365  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
367  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
369  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
371  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
373  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
375  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
377  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
379  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
381  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
383  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
385  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
389 
395 typedef enum
396 {
401 
405 typedef enum
406 {
410 
420 typedef struct
421 {
427 
429  PowerLPF3_LfoscCompensationPpmRequirement ppmRequirement;
430 
433 
438 
440 
457 void PowerCC27XX_doWFI(void);
458 
466 PowerLPF3_ResetReason PowerLPF3_getResetReason(void);
467 
482 void PowerLPF3_releaseLatches(void);
483 
507 void PowerCC27XX_standbyPolicy(void);
508 
524 void PowerLPF3_selectLFOSC(void);
525 
541 void PowerLPF3_selectLFXT(void);
542 
563 void PowerLPF3_selectEXTLF(void);
564 
585 void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion);
586 
609 void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta);
610 
622 
632 
644 
665 int_fast16_t PowerLPF3_startAFOSC(PowerLPF3_AfoscFreq frequency);
666 
674 void PowerLPF3_stopAFOSC(void);
675 
683 
702 int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void);
703 
723 void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment);
724 
735 
755 
769 
780 
831 int_fast16_t PowerLPF3_sleep(uint32_t nextEventTimeUs);
832 
842 
845 
846 #ifdef __cplusplus
847 }
848 #endif
849 
850 #endif /* POWER_CC27XX_ */
bool PowerLPF3_isLfincFilterAllowingStandby(void)
Checks if the LFINC filter is ready to go to standby or not.
Definition: PowerCC27XX.h:363
Definition: PowerCC27XX.h:367
Definition: PowerCC27XX.h:397
Definition: PowerCC27XX.h:385
void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion)
Initialize HFXT temperature compensation coefficients.
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:352
Definition: PowerCC27XX.h:379
uint32_t systemWakeupIntervalUsec
The expected interval in us between system wakeups.
Definition: PowerCC27XX.h:426
Definition: PowerCC27XX.h:398
void PowerLPF3_stopAFOSC(void)
Stop the AFOSC.
void PowerLPF3_selectEXTLF(void)
Select EXTLF as LFCLK source.
Definition: PowerCC27XX.h:377
int_fast16_t PowerLPF3_sleep(uint32_t nextEventTimeUs)
Transition the device into standby and configure RTC to wakeup the device ahead of a specified time...
void PowerCC27XX_standbyPolicy(void)
The STANDBY Power Policy.
Definition: PowerCC27XX.h:369
Definition: PowerCC27XX.h:383
Definition: PowerCC27XX.h:373
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:406
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC27XX.h:358
void PowerLPF3_startInitialHfxtAmpComp(void)
Start initial compensation of the HFXT amplitude.
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC27XX.h:336
Global configuration structure.
Definition: PowerCC27XX.h:299
PowerLPF3_LfoscCompensationPpmRequirement ppmRequirement
The PPM requirements.
Definition: PowerCC27XX.h:429
void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment)
Adjust the HFXT amplitude.
void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta)
Enable HFXT temperature compensation.
PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
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:395
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC27XX.h:307
Definition: PowerCC27XX.h:365
Definition: PowerCC27XX.h:381
uint16_t maxAllowedJitterUsec
The maximum additional jitter allowed per wakeup beyond the ppm requirement in us.
Definition: PowerCC27XX.h:432
Definition: PowerCC27XX.h:361
Definition: PowerCC27XX.h:387
Definition: PowerCC27XX.h:399
void PowerLPF3_setLfoscCompensationProfile(const PowerLPF3_LfoscCompensationProfile *profile)
Set LFOSC Compensation Profile.
500 PPM
Definition: PowerCC27XX.h:408
void PowerLPF3_disableLfoscCompensation(void)
Disable LFOSC Compensation.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
uint32_t PowerLPF3_getHFXTCompensationRatio(void)
Get the current HFXT compensation ratio.
void(* PowerLPF3_StartInitialHfxtAmpCompFxn)(void)
Function pointer to PowerLPF3_startInitialHfxtAmpComp() or NULL.
Definition: PowerCC27XX.h:296
int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void)
Check if HFXT amplitude needs to be adjusted.
LFOSC Compensation Profile structure.
Definition: PowerCC27XX.h:420
void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC27XX.h:371
Definition: PowerCC27XX.h:375
void PowerLPF3_disableHFXTCompensation(void)
Disable HFXT temperature compensation.
PowerLPF3_LfoscCompensationPpmRequirement
Possible LFOSC PPM requirements to be used by the LFOSC compensation.
Definition: PowerCC27XX.h:405
void PowerLPF3_initLfoscCompensation(void)
Initialize LFOSC Compensation.
void PowerLPF3_forceHFXTCompensationUpdate(void)
Force HFXT temperature compensation update.
uint16_t temperatureGradientMilliCelsiusPerSec
The absolute value of the worst case expected temperature gradient in mC/s.
Definition: PowerCC27XX.h:437
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-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale