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 /* \cond */
81 /* The control of the peripherals are split between multiple groups.
82  * These defines are used to differentiate between the groups.
83  * The bits in the PowerCC23X0_PERIPH_GROUP_M mask is used to store the group id,
84  * and the bits in the PowerCC23X0_PERIPH_BIT_INDEX_M mask is used to store the
85  * bit index shift value in the register for the given group.
86  */
87 #define PowerCC23X0_PERIPH_GROUP_M 0xFF00
88 #define PowerCC23X0_PERIPH_GROUP_CLKCTL0 0x0000
89 #define PowerCC23X0_PERIPH_GROUP_LRFD 0x0100
90 #define PowerCC23X0_PERIPH_BIT_INDEX_M 0x00FF
91 
92 /* \endcond */
93 /* Resource IDs */
94 
96 #define PowerLPF3_PERIPH_GPIO (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
97 
99 #define PowerLPF3_PERIPH_UART0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
100 
102 #define PowerLPF3_PERIPH_I2C0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
103 
105 #define PowerLPF3_PERIPH_SPI0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
106 
108 #define PowerLPF3_PERIPH_ADC0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
109 
111 #define PowerLPF3_PERIPH_AES (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
112 
114 #define PowerLPF3_PERIPH_DMA (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
115 
117 #define PowerLPF3_PERIPH_LGPT0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
118 
120 #define PowerLPF3_PERIPH_LGPT1 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
121 
122 /* The peripherals below are not available on CC23X0R2 devices */
123 #if !defined(DeviceFamily_CC23X0R2)
124 
125  #define PowerLPF3_PERIPH_LGPT2 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
126 
128  #define PowerLPF3_PERIPH_LGPT3 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
129 #endif
130 
132 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
133 
135 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
136 
137 /* \cond */
138 /* Number of resources in the different resource groups. This is possibly larger
139  * than the peripheral instance count on various device variants. This is
140  * because some indexes might not be used for a given variant, resulting in a
141  * sparse table.
142  */
143 #if defined(DeviceFamily_CC23X0R2)
144  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 29
145 #elif defined(DeviceFamily_CC23X0R5)
146  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 31
147 #else
148  #error "Unsupported DeviceFamily specified!"
149 #endif
150 #define PowerCC23X0_NUMRESOURCES_LRFD 12
151 /* \endcond */
152 
153 #define PowerLPF3_STANDBY 0x1
154 /* \cond */
155 /* Internal flags for enabling/disabling resources */
156 #define PowerLPF3_ENABLE 1
157 #define PowerLPF3_DISABLE 0
158 /* \endcond */
159 
160 /* Constraints
161  *
162  * Constraints restrict a specific system behavior from occurring or guarantee
163  * a specified effect until released.
164  */
165 
167 #define PowerLPF3_DISALLOW_SHUTDOWN 0
168 
170 #define PowerLPF3_DISALLOW_STANDBY 1
171 
173 #define PowerLPF3_DISALLOW_IDLE 2
174 
176 #define PowerLPF3_NEED_FLASH_IN_IDLE 3
177 
178 /* \cond */
179 #define PowerCC23X0_NUMCONSTRAINTS 4 /* Number of constraints supported */
180 /* \endcond */
181 
182 /*
183  * Events
184  *
185  * Each event must be a power of two and must be sequential
186  * without any gaps.
187  */
188 
190 #define PowerLPF3_ENTERING_STANDBY (1 << 0)
191 
193 #define PowerLPF3_ENTERING_SHUTDOWN (1 << 1)
194 
196 #define PowerLPF3_AWAKE_STANDBY (1 << 2)
197 
201 #define PowerLPF3_HFXT_AVAILABLE (1 << 3)
202 
206 #define PowerLPF3_LFCLK_SWITCHED (1 << 4)
207 
208 /* \cond */
209 #define PowerCC23X0_NUMEVENTS 5 /* Number of events supported */
210 /* \endcond */
211 
213 typedef struct
214 {
252 
256 typedef enum
257 {
259  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
261  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
263  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
265  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
267  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
269  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
271  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
273  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
275  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
277  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
279  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
281  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
283  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
285 
296 void PowerCC23X0_doWFI(void);
297 
305 static inline PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
306 {
307  return (PowerLPF3_ResetReason)PMCTLGetResetReason();
308 }
309 
324 static inline void PowerLPF3_releaseLatches(void)
325 {
326  HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
327 }
328 
352 void PowerCC23X0_standbyPolicy(void);
353 
368 void PowerLPF3_selectLFOSC(void);
369 
384 void PowerLPF3_selectLFXT(void);
385 
388 
389 #define Power_getPerformanceLevel(void) 0
390 #define Power_setPerformanceLevel(level) Power_EFAIL
391 
392 #ifdef __cplusplus
393 }
394 #endif
395 
396 #endif /* POWER_CC23X0_ */
Definition: PowerCC23X0.h:281
void PowerCC23X0_schedulerRestore(void)
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC23X0.h:256
void PowerCC23X0_doWFI(void)
The wait for interrupt (WFI) policy.
Definition: PowerCC23X0.h:279
Definition: PowerCC23X0.h:269
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:405
Global configuration structure.
Definition: PowerCC23X0.h:213
Power Manager.
Definition: PowerCC23X0.h:273
Definition: PowerCC23X0.h:271
Definition: PowerCC23X0.h:275
void PowerCC23X0_standbyPolicy(void)
The STANDBY Power Policy.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:410
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC23X0.h:221
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC23X0.h:250
Definition: PowerCC23X0.h:263
void PowerCC23X0_schedulerDisable(void)
void PowerLPF3_selectLFXT(void)
Select LFOSC as LFCLK source.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
Definition: PowerCC23X0.h:259
Definition: PowerCC23X0.h:265
Definition: PowerCC23X0.h:277
Definition: PowerCC23X0.h:267
static PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
Definition: PowerCC23X0.h:305
static void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC23X0.h:324
Definition: PowerCC23X0.h:261
Definition: PowerCC23X0.h:283
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale