xWRL6432 MMWAVE-L-SDK  05.04.00.01
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);
223  void (*enteridle3HookFxn)(void);
230  void (*resumeidle3HookFxn)(void);
231 
234 
237 
240 
243 
246 
249 
252 
269 
276 
286  uint32_t numPins;
290  uint32_t LPDSThreshold;
295 
300  uint32_t sleepThreshold;
305 
310  uint32_t idleThreshold;
315 
317 
319 
324 typedef struct {
325  uint32_t vectorTable;
326  uint32_t auxCtrl;
327  uint32_t intCtrlState;
328  uint32_t appInt;
329  uint32_t sysCtrl;
330  uint32_t configCtrl;
331  uint32_t sysPri1;
332  uint32_t sysPri2;
333  uint32_t sysPri3;
334  uint32_t sysHcrs;
335  uint32_t systickCtrl;
336  uint32_t systickReload;
337  uint32_t systickCalib;
338  uint32_t intSetEn[POWER_numNVICSetEnableRegs];
339  uint32_t intPriority[POWER_numNVICIntPriority];
340 } Power_NVICRegisters;
347 typedef struct {
348  uint32_t msp;
349  uint32_t psp;
350  uint32_t psr;
351  uint32_t primask;
352  uint32_t faultmask;
353  uint32_t basepri;
354  uint32_t control;
355 } Power_MCURegisters;
362 typedef struct {
363  Power_MCURegisters m4Regs;
364  Power_NVICRegisters nvicRegs;
365 } Power_SaveRegisters;
369 typedef enum {
375 
379 typedef enum {
381  POWER_PIN_PAD_AA = PIN_PAD_AA,
383  POWER_PIN_PAD_AB = PIN_PAD_AB,
385  POWER_PIN_PAD_AC = PIN_PAD_AC,
387  POWER_PIN_PAD_AD = PIN_PAD_AD,
389  POWER_PIN_PAD_AE = PIN_PAD_AE,
391  POWER_PIN_PAD_AF = PIN_PAD_AF,
393  POWER_PIN_PAD_AG = PIN_PAD_AG,
395  POWER_PIN_PAD_AH = PIN_PAD_AH,
397  POWER_PIN_PAD_AI = PIN_PAD_AI,
399  POWER_PIN_PAD_AJ = PIN_PAD_AJ,
401  POWER_PIN_PAD_AK = PIN_PAD_AK,
403  POWER_PIN_PAD_AL = PIN_PAD_AL,
405  POWER_PIN_PAD_AM = PIN_PAD_AM,
407  POWER_PIN_PAD_AN = PIN_PAD_AN,
409  POWER_PIN_PAD_AO = PIN_PAD_AO,
411  POWER_PIN_PAD_AP = PIN_PAD_AP,
413  POWER_PIN_PAD_AQ = PIN_PAD_AQ,
415  POWER_PIN_PAD_AR = PIN_PAD_AR,
417  POWER_PIN_PAD_AS = PIN_PAD_AS,
419  POWER_PIN_PAD_AT = PIN_PAD_AT,
421  POWER_PIN_PAD_AU = PIN_PAD_AU,
423  POWER_PIN_PAD_AV = PIN_PAD_AV,
425  POWER_PIN_PAD_AW = PIN_PAD_AW,
427  POWER_PIN_PAD_AX = PIN_PAD_AX,
428 } Power_Pin;
439 typedef struct {
440 
469 
470 } Power_Wakeup;
471 
476 typedef struct {
477  List_List notifyList;
478  uint32_t constraintMask;
479  uint32_t state;
480  uint16_t dbRecords[POWER_NUMRESOURCES];
481  bool enablePolicy;
482  bool initialized;
483  uint8_t refCount[POWER_NUMRESOURCES];
484  uint8_t constraintCounts[POWER_NUMCONSTRAINTS];
485  Power_PolicyFxn policyFxn;
486  uint32_t pinMode[POWER_NUMPINS];
487  uint32_t pinLockMask;
488  Power_Wakeup wakeupConfig;
489 } Power_ModuleState;
501 
503 void Power_initPolicy(void);
504 
514 
525 void Power_sleepPolicy(unsigned long long sleepTimeus);
526 
543 int_fast16_t Power_reset(uint_fast16_t resourceId);
557  void Power_Idle3();
558 
559 /* \cond */
560 #define Power_getPerformanceLevel(void) 0
561 #define Power_setPerformanceLevel(level) Power_EFAIL
562 /* \endcond */
563 
564 #ifdef __cplusplus
565 }
566 #endif
567 
568 #endif /* POWER_XWRLX4XX_H */
569 
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:304
Power_Wakeup::enableGPIOSyncIOWakeupLPDS
bool enableGPIOSyncIOWakeupLPDS
Definition: power_xwrLx4xx.h:442
Power_ConfigV1::wakeupGPIOEdgeLPDS
uint32_t wakeupGPIOEdgeLPDS
The GPIO (WU_REQIN) trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:261
POWER_GPIO_WAKEUP_LPDS
@ POWER_GPIO_WAKEUP_LPDS
Definition: power_xwrLx4xx.h:193
POWER_DONT_PARK
@ POWER_DONT_PARK
Definition: power_xwrLx4xx.h:373
Power_Wakeup::enableSleepCounterWakeupLPDS
bool enableSleepCounterWakeupLPDS
Definition: power_xwrLx4xx.h:446
Power_ConfigV1::selectGpioSyncIOLpds
Power_GPIO_SYNCIO_Wakeup_Enable selectGpioSyncIOLpds
Definition: power_xwrLx4xx.h:254
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:300
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:275
Power_ConfigV1::idleThreshold
uint32_t idleThreshold
Threshold for entry to Idle in microseconds.
Definition: power_xwrLx4xx.h:310
Power_ConfigV1::enableUARTWakeupLPDS
bool enableUARTWakeupLPDS
Definition: power_xwrLx4xx.h:242
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:314
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:461
Power_Wakeup::enableRTCWakeupLPDS
bool enableRTCWakeupLPDS
Definition: power_xwrLx4xx.h:452
Power_Wakeup
Specify the wakeup sources for LPDS and Shutdown.
Definition: power_xwrLx4xx.h:439
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:444
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:282
PIN_PAD_AM
#define PIN_PAD_AM
Definition: pinmux/v0/pinmux.h:113
Power_ConfigV1::enableSleepCounterWakeupLPDS
bool enableSleepCounterWakeupLPDS
Definition: power_xwrLx4xx.h:239
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:248
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_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:286
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:454
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:468
Power_ConfigV1::LPDSThreshold
uint32_t LPDSThreshold
Threshold for entry to LPDS in microseconds.
Definition: power_xwrLx4xx.h:290
Power_ConfigV1::resumeLatencyForLPDS
uint32_t resumeLatencyForLPDS
Definition: power_xwrLx4xx.h:296
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:369
Power_Wakeup::enableSPICSWakeupLPDS
bool enableSPICSWakeupLPDS
Definition: power_xwrLx4xx.h:450
Power_initPolicy
void Power_initPolicy(void)
Power_ConfigV1::enableFRCWakeupLPDS
bool enableFRCWakeupLPDS
Definition: power_xwrLx4xx.h:251
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:294
Power_Wakeup::enableUARTWakeupLPDS
bool enableUARTWakeupLPDS
Definition: power_xwrLx4xx.h:448
Power_ConfigV1::resumeLatencyForIdle
uint32_t resumeLatencyForIdle
Definition: power_xwrLx4xx.h:316
POWER_PARK
@ POWER_PARK
Definition: power_xwrLx4xx.h:371
Power_getWakeup
void Power_getWakeup(Power_Wakeup *wakeup)
Function to get wakeup configuration settings.
Power_ConfigV1::resumeLatencyForSleep
uint32_t resumeLatencyForSleep
Definition: power_xwrLx4xx.h:306
Power_ConfigV1::enableSPICSWakeupLPDS
bool enableSPICSWakeupLPDS
Definition: power_xwrLx4xx.h:245
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:268
PIN_PAD_AS
#define PIN_PAD_AS
Definition: pinmux/v0/pinmux.h:119
Power_ConfigV1::enablePolicy
bool enablePolicy
Definition: power_xwrLx4xx.h:233
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:236
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