PowerCC23X0.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2023, 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  */
52 #ifndef ti_drivers_power_PowerCC23X0_
53 #define ti_drivers_power_PowerCC23X0_
54 
55 #include <ti/drivers/dpl/HwiP.h>
56 #include <ti/drivers/dpl/ClockP.h>
57 #include <ti/drivers/Power.h>
58 
59 #include <ti/devices/DeviceFamily.h>
60 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
61 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
62 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
63 #include DeviceFamily_constructPath(inc/hw_memmap.h)
64 #include DeviceFamily_constructPath(inc/hw_types.h)
65 #include DeviceFamily_constructPath(driverlib/pmctl.h)
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
72 #define PowerCC23X0_RESUMETIMESTANDBY 400
73 
75 #define PowerCC23X0_TOTALTIMESTANDBY 500
76 
78 #define PowerCC23X0_WAKEDELAYSTANDBY 185
79 
80 /* Default lower threshold for when HFXT compensation is enabled */
81 #define PowerCC23X0_HFXT_THRESHOLD_TEMP_DEFAULT (-40)
82 
83 /* \cond */
84 /* The control of the peripherals are split between multiple groups.
85  * These defines are used to differentiate between the groups.
86  * The bits in the PowerCC23X0_PERIPH_GROUP_M mask is used to store the group id,
87  * and the bits in the PowerCC23X0_PERIPH_BIT_INDEX_M mask is used to store the
88  * bit index shift value in the register for the given group.
89  */
90 #define PowerCC23X0_PERIPH_GROUP_M 0xFF00
91 #define PowerCC23X0_PERIPH_GROUP_CLKCTL0 0x0000
92 #define PowerCC23X0_PERIPH_GROUP_LRFD 0x0100
93 #define PowerCC23X0_PERIPH_BIT_INDEX_M 0x00FF
94 
95 /* \endcond */
96 
97 /* \cond */
98 typedef uint16_t PowerLPF3_Resource; /* Power resource identifier */
99 /* \endcond */
100 
101 /* Resource IDs */
102 
104 #define PowerLPF3_PERIPH_GPIO (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
105 
107 #define PowerLPF3_PERIPH_UART0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
108 
110 #define PowerLPF3_PERIPH_I2C0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
111 
113 #define PowerLPF3_PERIPH_SPI0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
114 
116 #define PowerLPF3_PERIPH_ADC0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
117 
119 #define PowerLPF3_PERIPH_AES (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
120 
122 #define PowerLPF3_PERIPH_DMA (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
123 
125 #define PowerLPF3_PERIPH_LGPT0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
126 
128 #define PowerLPF3_PERIPH_LGPT1 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
129 
130 /* The peripherals below are not available on CC23X0R2 devices */
131 #if !defined(DeviceFamily_CC23X0R2)
132 
133  #define PowerLPF3_PERIPH_LGPT2 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
134 
136  #define PowerLPF3_PERIPH_LGPT3 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
137 #endif
138 
140 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
141 
143 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
144 
145 /* \cond */
146 /* Number of resources in the different resource groups. This is possibly larger
147  * than the peripheral instance count on various device variants. This is
148  * because some indexes might not be used for a given variant, resulting in a
149  * sparse table.
150  */
151 #if defined(DeviceFamily_CC23X0R2)
152  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 29
153 #elif defined(DeviceFamily_CC23X0R5)
154  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 31
155 #else
156  #error "Unsupported DeviceFamily specified!"
157 #endif
158 #define PowerCC23X0_NUMRESOURCES_LRFD 12
159 /* \endcond */
160 
161 #define PowerLPF3_STANDBY 0x1
162 /* \cond */
163 /* Internal flags for enabling/disabling resources */
164 #define PowerLPF3_ENABLE 1
165 #define PowerLPF3_DISABLE 0
166 /* \endcond */
167 
168 /* Constraints
169  *
170  * Constraints restrict a specific system behavior from occurring or guarantee
171  * a specified effect until released.
172  */
173 
175 #define PowerLPF3_DISALLOW_SHUTDOWN 0
176 
178 #define PowerLPF3_DISALLOW_STANDBY 1
179 
181 #define PowerLPF3_DISALLOW_IDLE 2
182 
184 #define PowerLPF3_NEED_FLASH_IN_IDLE 3
185 
186 /* \cond */
187 #define PowerCC23X0_NUMCONSTRAINTS 4 /* Number of constraints supported */
188 /* \endcond */
189 
190 /*
191  * Events
192  *
193  * Each event must be a power of two and must be sequential
194  * without any gaps.
195  */
196 
198 #define PowerLPF3_ENTERING_STANDBY (1 << 0)
199 
201 #define PowerLPF3_ENTERING_SHUTDOWN (1 << 1)
202 
204 #define PowerLPF3_AWAKE_STANDBY (1 << 2)
205 
209 #define PowerLPF3_HFXT_AVAILABLE (1 << 3)
210 
214 #define PowerLPF3_LFCLK_SWITCHED (1 << 4)
215 
216 /* \cond */
217 #define PowerCC23X0_NUMEVENTS 5 /* Number of events supported */
218 /* \endcond */
219 
221 typedef struct
222 {
260 
264 typedef enum
265 {
267  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
269  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
271  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
273  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
275  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
277  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
279  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
281  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
283  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
285  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
287  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
289  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
291  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
293 
304 void PowerCC23X0_doWFI(void);
305 
313 static inline PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
314 {
315  return (PowerLPF3_ResetReason)PMCTLGetResetReason();
316 }
317 
332 static inline void PowerLPF3_releaseLatches(void)
333 {
334  HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
335 }
336 
360 void PowerCC23X0_standbyPolicy(void);
361 
376 void PowerLPF3_selectLFOSC(void);
377 
392 void PowerLPF3_selectLFXT(void);
393 
411 void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion);
412 
435 void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta);
436 
448 
451 
452 #ifdef __cplusplus
453 }
454 #endif
455 
456 #endif /* POWER_CC23X0_ */
Definition: PowerCC23X0.h:289
void PowerCC23X0_schedulerRestore(void)
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC23X0.h:264
void PowerLPF3_disableHFXTCompensation(void)
Disable HFXT temperature compensation.
void PowerCC23X0_doWFI(void)
The wait for interrupt (WFI) policy.
Definition: PowerCC23X0.h:287
Clock interface for the RTOS Porting Interface.
Definition: PowerCC23X0.h:277
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:401
Global configuration structure.
Definition: PowerCC23X0.h:221
Power Manager.
void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta)
Enable HFXT temperature compensation.
Definition: PowerCC23X0.h:281
Definition: PowerCC23X0.h:279
Definition: PowerCC23X0.h:283
void PowerCC23X0_standbyPolicy(void)
The STANDBY Power Policy.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:406
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC23X0.h:229
void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion)
Initialise HFXT temperature compensation coefficients.
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC23X0.h:258
Definition: PowerCC23X0.h:271
void PowerCC23X0_schedulerDisable(void)
void PowerLPF3_selectLFXT(void)
Select LFXT as LFCLK source.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
Definition: PowerCC23X0.h:267
Definition: PowerCC23X0.h:273
Definition: PowerCC23X0.h:285
Definition: PowerCC23X0.h:275
static PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
Definition: PowerCC23X0.h:313
static void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC23X0.h:332
Hardware Interrupt module for the RTOS Porting Interface.
Definition: PowerCC23X0.h:269
Definition: PowerCC23X0.h:291
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale