xWRL1432 MMWAVE-L-SDK  05.03.00
power_xwrLx4xx.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * 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
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
59 #ifndef POWER_XWRLX4XX_H
60 #define POWER_XWRLX4XX_H
61 
62 #include <stdint.h>
63 #include <drivers/utils/List.h>
64 #include <drivers/hw_include/hw_types.h>
65 #include <drivers/pinmux.h>
66 #include <drivers/power.h>
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
74 /* Power resources */
75 #define POWER_PERIPH_CAN 0
76 
78 #define POWER_PERIPH_SPI 1
79 
81 #define POWER_PERIPH_QSPI 2
82 
84 #define POWER_PERIPH_TOPSS 3
85 
87 #define POWER_PERIPH_APP_RTI 4
88 
90 #define POWER_PERIPH_WD 5
91 
93 #define POWER_PERIPH_UART0 6
94 
96 #define POWER_PERIPH_UART1 7
97 
99 #define POWER_PERIPH_I2C 8
100 
102 #define POWER_PERIPH_LIN 9
103 
105 #define POWER_PERIPH_ESM 10
106 
108 #define POWER_PERIPH_EDMA 11
109 
111 #define POWER_PERIPH_CRC 12
112 
114 #define POWER_PERIPH_PWM 13
115 
117 #define POWER_PERIPH_GIO 14
118 
120 #define POWER_PERIPH_HWASS 15
121 
123 /* \cond */
124 #define POWER_NUMRESOURCES 16 /* Number of resources in database */
125 /* \endcond */
126 
127 
128 /*
129  * Power constraints on the 64XX device
130  */
131 #define POWER_DISALLOW_LPDS 0
132 
134 #define POWER_DISALLOW_SLEEP 1
135 
137 #define POWER_DISALLOW_IDLE 2
138 
140 /* \cond */
141 #define POWER_NUMCONSTRAINTS 3
142 /* \endcond */
143 
144 /*
145  * Power events on the 64XX device
146  *
147  * Each event must be a power of two, and the event IDs must be sequential
148  * without any gaps.
149  */
150 #define POWER_ENTERING_LPDS 0x1
151 
153 #define POWER_ENTERING_SLEEP 0x2
154 
156 #define POWER_ENTERING_IDLE 0x4
157 
159 #define POWER_AWAKE_LPDS 0x8
160 
162 #define POWER_AWAKE_SLEEP 0x10
163 
165 #define POWER_AWAKE_IDLE 0x20
166 
168 /* \cond */
169 #define POWER_NUMEVENTS 6
170 /* \endcond */
171 
172 /* \cond */
173 /* Use by NVIC Register structure */
174 #define POWER_numNVICSetEnableRegs 6
175 #define POWER_numNVICIntPriority 49
176 /* \endcond */
177 
178 /* \cond */
179 /* Number of pins that can be parked in LPDS */
180 #define POWER_NUMPINS 24
181 /* \endcond */
182 
184 typedef struct {
185  uint32_t pin;
187  uint32_t parkState;
190 
192 typedef enum {
196 
198 typedef struct {
209  void (*enterLPDSHookFxn)(void);
216  void (*resumeLPDSHookFxn)(void);
217 
220 
223 
226 
229 
232 
235 
238 
255 
272 
282  uint32_t numPins;
286  uint32_t LPDSThreshold;
291 
296  uint32_t sleepThreshold;
301 
306  uint32_t idleThreshold;
311 
313 
315 
320 typedef struct {
321  uint32_t vectorTable;
322  uint32_t auxCtrl;
323  uint32_t intCtrlState;
324  uint32_t appInt;
325  uint32_t sysCtrl;
326  uint32_t configCtrl;
327  uint32_t sysPri1;
328  uint32_t sysPri2;
329  uint32_t sysPri3;
330  uint32_t sysHcrs;
331  uint32_t systickCtrl;
332  uint32_t systickReload;
333  uint32_t systickCalib;
334  uint32_t intSetEn[POWER_numNVICSetEnableRegs];
335  uint32_t intPriority[POWER_numNVICIntPriority];
336 } Power_NVICRegisters;
343 typedef struct {
344  uint32_t msp;
345  uint32_t psp;
346  uint32_t psr;
347  uint32_t primask;
348  uint32_t faultmask;
349  uint32_t basepri;
350  uint32_t control;
351 } Power_MCURegisters;
358 typedef struct {
359  Power_MCURegisters m4Regs;
360  Power_NVICRegisters nvicRegs;
361 } Power_SaveRegisters;
365 typedef enum {
371 
375 typedef enum {
377  POWER_PIN_PAD_AA = PIN_PAD_AA,
379  POWER_PIN_PAD_AB = PIN_PAD_AB,
381  POWER_PIN_PAD_AC = PIN_PAD_AC,
383  POWER_PIN_PAD_AD = PIN_PAD_AD,
385  POWER_PIN_PAD_AE = PIN_PAD_AE,
387  POWER_PIN_PAD_AF = PIN_PAD_AF,
389  POWER_PIN_PAD_AG = PIN_PAD_AG,
391  POWER_PIN_PAD_AH = PIN_PAD_AH,
393  POWER_PIN_PAD_AI = PIN_PAD_AI,
395  POWER_PIN_PAD_AJ = PIN_PAD_AJ,
397  POWER_PIN_PAD_AK = PIN_PAD_AK,
399  POWER_PIN_PAD_AL = PIN_PAD_AL,
401  POWER_PIN_PAD_AM = PIN_PAD_AM,
403  POWER_PIN_PAD_AN = PIN_PAD_AN,
405  POWER_PIN_PAD_AO = PIN_PAD_AO,
407  POWER_PIN_PAD_AP = PIN_PAD_AP,
409  POWER_PIN_PAD_AQ = PIN_PAD_AQ,
411  POWER_PIN_PAD_AR = PIN_PAD_AR,
413  POWER_PIN_PAD_AS = PIN_PAD_AS,
415  POWER_PIN_PAD_AT = PIN_PAD_AT,
417  POWER_PIN_PAD_AU = PIN_PAD_AU,
419  POWER_PIN_PAD_AV = PIN_PAD_AV,
421  POWER_PIN_PAD_AW = PIN_PAD_AW,
423  POWER_PIN_PAD_AX = PIN_PAD_AX,
424 } Power_Pin;
435 typedef struct {
436 
465 
466 } Power_Wakeup;
467 
472 typedef struct {
473  List_List notifyList;
474  uint32_t constraintMask;
475  uint32_t state;
476  uint16_t dbRecords[POWER_NUMRESOURCES];
477  bool enablePolicy;
478  bool initialized;
479  uint8_t refCount[POWER_NUMRESOURCES];
480  uint8_t constraintCounts[POWER_NUMCONSTRAINTS];
481  Power_PolicyFxn policyFxn;
482  uint32_t pinMode[POWER_NUMPINS];
483  uint32_t pinLockMask;
484  Power_Wakeup wakeupConfig;
485 } Power_ModuleState;
497 
499 void Power_initPolicy(void);
500 
510 
521 void Power_sleepPolicy(unsigned long long sleepTimeus);
522 
539 int_fast16_t Power_reset(uint_fast16_t resourceId);
553  void Power_Idle3();
554 
555 /* \cond */
556 #define Power_getPerformanceLevel(void) 0
557 #define Power_setPerformanceLevel(level) Power_EFAIL
558 /* \endcond */
559 
560 #ifdef __cplusplus
561 }
562 #endif
563 
564 #endif /* POWER_XWRLX4XX_H */
565 
Power_PolicyFxn
void(* Power_PolicyFxn)(unsigned long long sleepTimeus)
Power policy function pointer.
Definition: power.h:423
Power_ConfigV1
Power global configuration.
Definition: power_xwrLx4xx.h:198
Power_ConfigV1::totalLatencyForSleep
uint32_t totalLatencyForSleep
Latency for entry to and exit from Sleep in microseconds.
Definition: power_xwrLx4xx.h:300
Power_Wakeup::enableGPIOSyncIOWakeupLPDS
bool enableGPIOSyncIOWakeupLPDS
Definition: power_xwrLx4xx.h:438
Power_ConfigV1::wakeupGPIOEdgeLPDS
uint32_t wakeupGPIOEdgeLPDS
The GPIO (WU_REQIN) trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:247
POWER_GPIO_WAKEUP_LPDS
@ POWER_GPIO_WAKEUP_LPDS
Definition: power_xwrLx4xx.h:193
POWER_DONT_PARK
@ POWER_DONT_PARK
Definition: power_xwrLx4xx.h:369
Power_Wakeup::enableSleepCounterWakeupLPDS
bool enableSleepCounterWakeupLPDS
Definition: power_xwrLx4xx.h:442
Power_ConfigV1::selectGpioSyncIOLpds
Power_GPIO_SYNCIO_Wakeup_Enable selectGpioSyncIOLpds
Definition: power_xwrLx4xx.h:240
PIN_PAD_AI
#define PIN_PAD_AI
Definition: pinmux/v0/pinmux.h:109
PIN_PAD_AX
#define PIN_PAD_AX
Definition: pinmux/v0/pinmux.h:124
PIN_PAD_AE
#define PIN_PAD_AE
Definition: pinmux/v0/pinmux.h:105
PIN_PAD_AL
#define PIN_PAD_AL
Definition: pinmux/v0/pinmux.h:112
Power_ConfigV1::sleepThreshold
uint32_t sleepThreshold
Threshold for entry to Sleep in microseconds.
Definition: power_xwrLx4xx.h:296
PIN_PAD_AC
#define PIN_PAD_AC
Definition: pinmux/v0/pinmux.h:103
Power_ConfigV1::ramRetentionMaskLPDS
uint32_t ramRetentionMaskLPDS
SRAM retention mask for LPDS.
Definition: power_xwrLx4xx.h:261
Power_ConfigV1::idleThreshold
uint32_t idleThreshold
Threshold for entry to Idle in microseconds.
Definition: power_xwrLx4xx.h:306
Power_ConfigV1::enableUARTWakeupLPDS
bool enableUARTWakeupLPDS
Definition: power_xwrLx4xx.h:228
PIN_PAD_AK
#define PIN_PAD_AK
Definition: pinmux/v0/pinmux.h:111
Power_ConfigV1::totalLatencyForIdle
uint32_t totalLatencyForIdle
Latency for entry to and exit from Idle in microseconds.
Definition: power_xwrLx4xx.h:310
PIN_PAD_AV
#define PIN_PAD_AV
Definition: pinmux/v0/pinmux.h:122
power.h
Power_Idle3
void Power_Idle3()
Device Idle mode.
Power_Wakeup::wakeupGPIOEdgeLPDS
uint32_t wakeupGPIOEdgeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:457
Power_Wakeup::enableRTCWakeupLPDS
bool enableRTCWakeupLPDS
Definition: power_xwrLx4xx.h:448
Power_Wakeup
Specify the wakeup sources for LPDS and Shutdown.
Definition: power_xwrLx4xx.h:435
PIN_PAD_AR
#define PIN_PAD_AR
Definition: pinmux/v0/pinmux.h:118
Power_Wakeup::selectGpioSyncIOLpds
Power_GPIO_SYNCIO_Wakeup_Enable selectGpioSyncIOLpds
Definition: power_xwrLx4xx.h:440
PIN_PAD_AA
#define PIN_PAD_AA
Definition: pinmux/v0/pinmux.h:101
Power_ConfigV1::pinParkDefs
Power_ParkInfo * pinParkDefs
Pointer to an array of pins to be parked during LPDS.
Definition: power_xwrLx4xx.h:278
PIN_PAD_AM
#define PIN_PAD_AM
Definition: pinmux/v0/pinmux.h:113
Power_ConfigV1::enableSleepCounterWakeupLPDS
bool enableSleepCounterWakeupLPDS
Definition: power_xwrLx4xx.h:225
PIN_PAD_AB
#define PIN_PAD_AB
Definition: pinmux/v0/pinmux.h:102
PIN_PAD_AN
#define PIN_PAD_AN
Definition: pinmux/v0/pinmux.h:114
Power_ConfigV1::enableRTCWakeupLPDS
bool enableRTCWakeupLPDS
Definition: power_xwrLx4xx.h:234
PIN_PAD_AG
#define PIN_PAD_AG
Definition: pinmux/v0/pinmux.h:107
PIN_PAD_AH
#define PIN_PAD_AH
Definition: pinmux/v0/pinmux.h:108
PIN_PAD_AT
#define PIN_PAD_AT
Definition: pinmux/v0/pinmux.h:120
Power_ConfigV1::keepDebugActiveDuringLPDS
bool keepDebugActiveDuringLPDS
Keep debug interface active during LPDS.
Definition: power_xwrLx4xx.h:271
Power_ParkInfo::pin
uint32_t pin
Definition: power_xwrLx4xx.h:185
PIN_PAD_AQ
#define PIN_PAD_AQ
Definition: pinmux/v0/pinmux.h:117
Power_ConfigV1::numPins
uint32_t numPins
Number of pins to be parked during LPDS.
Definition: power_xwrLx4xx.h:282
PIN_PAD_AW
#define PIN_PAD_AW
Definition: pinmux/v0/pinmux.h:123
PIN_PAD_AP
#define PIN_PAD_AP
Definition: pinmux/v0/pinmux.h:116
Power_ParkInfo::parkState
uint32_t parkState
Definition: power_xwrLx4xx.h:187
PIN_PAD_AJ
#define PIN_PAD_AJ
Definition: pinmux/v0/pinmux.h:110
Power_Wakeup::enableFRCWakeupLPDS
bool enableFRCWakeupLPDS
Definition: power_xwrLx4xx.h:450
Power_configureWakeup
void Power_configureWakeup(Power_Wakeup *wakeup)
Function configures wakeup for LPDS and shutdown.
Power_Wakeup::wakeupSyncIOEdgeLPDS
uint32_t wakeupSyncIOEdgeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:464
Power_ConfigV1::LPDSThreshold
uint32_t LPDSThreshold
Threshold for entry to LPDS in microseconds.
Definition: power_xwrLx4xx.h:286
Power_ConfigV1::resumeLatencyForLPDS
uint32_t resumeLatencyForLPDS
Definition: power_xwrLx4xx.h:292
PIN_PAD_AU
#define PIN_PAD_AU
Definition: pinmux/v0/pinmux.h:121
Power_ConfigV1::policyFxn
Power_PolicyFxn policyFxn
Definition: power_xwrLx4xx.h:202
pinmux.h
Power_ParkState
Power_ParkState
Enumeration of states a pin can be parked in.
Definition: power_xwrLx4xx.h:365
Power_Wakeup::enableSPICSWakeupLPDS
bool enableSPICSWakeupLPDS
Definition: power_xwrLx4xx.h:446
Power_initPolicy
void Power_initPolicy(void)
Power_ConfigV1::enableFRCWakeupLPDS
bool enableFRCWakeupLPDS
Definition: power_xwrLx4xx.h:237
Power_GPIO_SYNCIO_Wakeup_Enable
Power_GPIO_SYNCIO_Wakeup_Enable
Source of Wake-up can be either GPIO (WU_REQIN) or SYNC_IN.
Definition: power_xwrLx4xx.h:192
Power_ConfigV1::policyInitFxn
Power_PolicyInitFxn policyInitFxn
Definition: power_xwrLx4xx.h:200
Power_PolicyInitFxn
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: power.h:418
Power_ConfigV1::totalLatencyForLPDS
uint32_t totalLatencyForLPDS
Latency for entry to and exit from LPDS in microseconds.
Definition: power_xwrLx4xx.h:290
Power_Wakeup::enableUARTWakeupLPDS
bool enableUARTWakeupLPDS
Definition: power_xwrLx4xx.h:444
Power_ConfigV1::resumeLatencyForIdle
uint32_t resumeLatencyForIdle
Definition: power_xwrLx4xx.h:312
POWER_PARK
@ POWER_PARK
Definition: power_xwrLx4xx.h:367
Power_getWakeup
void Power_getWakeup(Power_Wakeup *wakeup)
Function to get wakeup configuration settings.
Power_ConfigV1::resumeLatencyForSleep
uint32_t resumeLatencyForSleep
Definition: power_xwrLx4xx.h:302
Power_ConfigV1::enableSPICSWakeupLPDS
bool enableSPICSWakeupLPDS
Definition: power_xwrLx4xx.h:231
Power_ParkInfo
Used to specify parking of a pin during LPDS.
Definition: power_xwrLx4xx.h:184
PIN_PAD_AD
#define PIN_PAD_AD
Definition: pinmux/v0/pinmux.h:104
POWER_SYNCIN_IO_WAKEUP_LPDS
@ POWER_SYNCIN_IO_WAKEUP_LPDS
Definition: power_xwrLx4xx.h:194
Power_ConfigV1::wakeupSyncIOEdgeLPDS
uint32_t wakeupSyncIOEdgeLPDS
The SYNC-IN trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:254
PIN_PAD_AS
#define PIN_PAD_AS
Definition: pinmux/v0/pinmux.h:119
Power_ConfigV1::enablePolicy
bool enablePolicy
Definition: power_xwrLx4xx.h:219
Power_sleepPolicy
void Power_sleepPolicy(unsigned long long sleepTimeus)
A reference power policy is provided which can transition the MCU from the active state to one of two...
Power_ConfigV1::enableGPIOSyncIOWakeupLPDS
bool enableGPIOSyncIOWakeupLPDS
Definition: power_xwrLx4xx.h:222
PIN_PAD_AF
#define PIN_PAD_AF
Definition: pinmux/v0/pinmux.h:106
PIN_PAD_AO
#define PIN_PAD_AO
Definition: pinmux/v0/pinmux.h:115