xWRL6432 MMWAVE-L-SDK  05.01.00.04
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 
72 /* latency values were measured with a logic analyzer, and rounded up */
73 
75 #define POWER_RESUMETIMELPDS 2500
76 
77 /* Power resources */
78 #define POWER_PERIPH_CAN 0
79 
81 #define POWER_PERIPH_SPI 1
82 
84 #define POWER_PERIPH_QSPI 2
85 
87 #define POWER_PERIPH_TOPSS 3
88 
90 #define POWER_PERIPH_APP_RTI 4
91 
93 #define POWER_PERIPH_WD 5
94 
96 #define POWER_PERIPH_UART0 6
97 
99 #define POWER_PERIPH_UART1 7
100 
102 #define POWER_PERIPH_I2C 8
103 
105 #define POWER_PERIPH_LIN 9
106 
108 #define POWER_PERIPH_ESM 10
109 
111 #define POWER_PERIPH_EDMA 11
112 
114 #define POWER_PERIPH_CRC 12
115 
117 #define POWER_PERIPH_PWM 13
118 
120 #define POWER_PERIPH_GIO 14
121 
123 #define POWER_PERIPH_HWASS 15
124 
126 /* \cond */
127 #define POWER_NUMRESOURCES 16 /* Number of resources in database */
128 /* \endcond */
129 
130 /*
131  * Power constraints on the 64XX device
132  */
133 #define POWER_DISALLOW_LPDS 0
134 
136 #define POWER_DISALLOW_SLEEP 1
137 
139 #define POWER_DISALLOW_IDLE 2
140 
142 /* \cond */
143 #define POWER_NUMCONSTRAINTS 3
144 /* \endcond */
145 
146 /*
147  * Power events on the 64XX device
148  *
149  * Each event must be a power of two, and the event IDs must be sequential
150  * without any gaps.
151  */
152 #define POWER_ENTERING_LPDS 0x1
153 
155 #define POWER_ENTERING_SLEEP 0x2
156 
158 #define POWER_ENTERING_IDLE 0x4
159 
161 #define POWER_AWAKE_LPDS 0x8
162 
164 #define POWER_AWAKE_SLEEP 0x10
165 
167 #define POWER_AWAKE_IDLE 0x20
168 
170 /* \cond */
171 #define POWER_NUMEVENTS 6
172 /* \endcond */
173 
174 /* \cond */
175 /* Use by NVIC Register structure */
176 #define POWER_numNVICSetEnableRegs 6
177 #define POWER_numNVICIntPriority 49
178 /* \endcond */
179 
180 /* \cond */
181 /* Number of pins that can be parked in LPDS */
182 #define POWER_NUMPINS 24
183 /* \endcond */
184 
186 typedef struct {
187  uint32_t pin;
189  uint32_t parkState;
192 
193 typedef enum {
197 
199 typedef struct {
201  Power_PolicyInitFxn policyInitFxn;
203  Power_PolicyFxn policyFxn;
210  void (*enterLPDSHookFxn)(void);
217  void (*resumeLPDSHookFxn)(void);
218 
221 
223 
226 
229 
232 
235 
238 
239  // Select source of wakeup to be either GPIO or SYNC_IN
241 
280  void (*wakeupGPIOFxnLPDS)(uint_least8_t argument);
284  uint_least8_t wakeupGPIOFxnLPDSArg;
285 
304 
323 
333  uint32_t numPins;
342 
344 
346 
348 
350 
352 
354 
359 typedef struct {
360  uint32_t vectorTable;
361  uint32_t auxCtrl;
362  uint32_t intCtrlState;
363  uint32_t appInt;
364  uint32_t sysCtrl;
365  uint32_t configCtrl;
366  uint32_t sysPri1;
367  uint32_t sysPri2;
368  uint32_t sysPri3;
369  uint32_t sysHcrs;
370  uint32_t systickCtrl;
371  uint32_t systickReload;
372  uint32_t systickCalib;
373  uint32_t intSetEn[POWER_numNVICSetEnableRegs];
374  uint32_t intPriority[POWER_numNVICIntPriority];
375 } Power_NVICRegisters;
382 typedef struct {
383  uint32_t msp;
384  uint32_t psp;
385  uint32_t psr;
386  uint32_t primask;
387  uint32_t faultmask;
388  uint32_t basepri;
389  uint32_t control;
390 } Power_MCURegisters;
397 typedef struct {
398  Power_MCURegisters m4Regs;
399  Power_NVICRegisters nvicRegs;
400 } Power_SaveRegisters;
404 typedef enum {
418 
420 typedef enum {
469 } Power_Pin;
470 
471 typedef struct
472 {
473  uint32_t pad;
474  uint32_t mode;
475 }syncinpadcfg;
476 
485 typedef struct {
486 
488  // Select between GPIO and SYNC_IN
538  void (*wakeupGPIOFxnLPDS)(uint_least8_t argument);
542  uint_least8_t wakeupGPIOFxnLPDSArg;
543 
562 
563 } Power_Wakeup;
564 
569 typedef struct {
570  List_List notifyList;
571  uint32_t constraintMask;
572  uint32_t state;
573  uint16_t dbRecords[POWER_NUMRESOURCES];
574  bool enablePolicy;
575  bool initialized;
576  uint8_t refCount[POWER_NUMRESOURCES];
577  uint8_t constraintCounts[POWER_NUMCONSTRAINTS];
578  Power_PolicyFxn policyFxn;
579  uint32_t pinMode[POWER_NUMPINS];
580  uint32_t pinLockMask;
581  Power_Wakeup wakeupConfig;
582 } Power_ModuleState;
596 
598 void Power_initPolicy(void);
599 
609 
612 
615  Power_ParkState state);
616 
618 void Power_setParkState(Power_Pin pin, uint32_t level);
619 
630 void Power_sleepPolicy(unsigned long long sleepTimeus);
631 
647 int_fast16_t Power_reset(uint_fast16_t resourceId);
648 
655  void Power_Idle3();
656 
657  void Power_afterLPDS(void);
658 
659 /* \cond */
660 #define Power_getPerformanceLevel(void) 0
661 #define Power_setPerformanceLevel(level) Power_EFAIL
662 /* \endcond */
663 
664 #ifdef __cplusplus
665 }
666 #endif
667 
668 #endif /* POWER_XWRLX4XX_H */
669 
POWER_PIN_PAD_AM
@ POWER_PIN_PAD_AM
Definition: power_xwrLx4xx.h:446
Power_ConfigV1
Power global configuration.
Definition: power_xwrLx4xx.h:199
Power_Wakeup::wakeupGPIOFxnLPDSArg
uint_least8_t wakeupGPIOFxnLPDSArg
The argument to be passed to wakeupGPIOFxnLPDS()
Definition: power_xwrLx4xx.h:542
Power_ConfigV1::totalLatencyForSleep
uint32_t totalLatencyForSleep
Definition: power_xwrLx4xx.h:345
Power_Wakeup::enableGPIOSyncIOWakeupLPDS
bool enableGPIOSyncIOWakeupLPDS
Definition: power_xwrLx4xx.h:487
Power_ConfigV1::wakeupGPIOEdgeLPDS
uint32_t wakeupGPIOEdgeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:259
POWER_GPIO_WAKEUP_LPDS
@ POWER_GPIO_WAKEUP_LPDS
Definition: power_xwrLx4xx.h:194
POWER_DONT_PARK
@ POWER_DONT_PARK
Definition: power_xwrLx4xx.h:416
syncinpadcfg::mode
uint32_t mode
Definition: power_xwrLx4xx.h:474
Power_Wakeup::enableSleepCounterWakeupLPDS
bool enableSleepCounterWakeupLPDS
Definition: power_xwrLx4xx.h:491
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_PIN_PAD_AT
@ POWER_PIN_PAD_AT
Definition: power_xwrLx4xx.h:460
POWER_PIN_PAD_AU
@ POWER_PIN_PAD_AU
Definition: power_xwrLx4xx.h:462
PIN_PAD_AC
#define PIN_PAD_AC
Definition: pinmux/v0/pinmux.h:103
POWER_WEAK_PULL_UP_STD
@ POWER_WEAK_PULL_UP_STD
Definition: power_xwrLx4xx.h:408
Power_ConfigV1::ramRetentionMaskLPDS
uint32_t ramRetentionMaskLPDS
SRAM retention mask for LPDS.
Definition: power_xwrLx4xx.h:312
Power_ConfigV1::enableUARTWakeupLPDS
bool enableUARTWakeupLPDS
Definition: power_xwrLx4xx.h:228
POWER_PIN_PAD_AE
@ POWER_PIN_PAD_AE
Definition: power_xwrLx4xx.h:430
POWER_PIN_PAD_AB
@ POWER_PIN_PAD_AB
Definition: power_xwrLx4xx.h:424
PIN_PAD_AK
#define PIN_PAD_AK
Definition: pinmux/v0/pinmux.h:111
Power_ConfigV1::totalLatencyForIdle
uint32_t totalLatencyForIdle
Definition: power_xwrLx4xx.h:349
PIN_PAD_AV
#define PIN_PAD_AV
Definition: pinmux/v0/pinmux.h:122
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:517
Power_Wakeup::enableRTCWakeupLPDS
bool enableRTCWakeupLPDS
Definition: power_xwrLx4xx.h:497
Power_Wakeup
Specify the wakeup sources for LPDS and Shutdown.
Definition: power_xwrLx4xx.h:485
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:489
PIN_PAD_AA
#define PIN_PAD_AA
Definition: pinmux/v0/pinmux.h:101
POWER_PIN_PAD_AK
@ POWER_PIN_PAD_AK
Definition: power_xwrLx4xx.h:442
Power_ConfigV1::wakeupGPIOFxnLPDSArg
uint_least8_t wakeupGPIOFxnLPDSArg
The argument to be passed to wakeupGPIOFxnLPDS()
Definition: power_xwrLx4xx.h:284
Power_ConfigV1::pinParkDefs
Power_ParkInfo * pinParkDefs
Pointer to an array of pins to be parked during LPDS.
Definition: power_xwrLx4xx.h:329
PIN_PAD_AM
#define PIN_PAD_AM
Definition: pinmux/v0/pinmux.h:113
Power_ConfigV1::enableSleepCounterWakeupLPDS
bool enableSleepCounterWakeupLPDS
Definition: power_xwrLx4xx.h:225
Power_Wakeup::wakeupSyncIOPadLPDS
uint32_t wakeupSyncIOPadLPDS
The GPIO source for wakeup from LPDS.
Definition: power_xwrLx4xx.h:553
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_Pin
Power_Pin
Enumeration of pins that can be parked.
Definition: power_xwrLx4xx.h:420
POWER_PIN_PAD_AI
@ POWER_PIN_PAD_AI
Definition: power_xwrLx4xx.h:438
syncinpadcfg
Definition: power_xwrLx4xx.h:472
POWER_WEAK_PULL_DOWN_STD
@ POWER_WEAK_PULL_DOWN_STD
Definition: power_xwrLx4xx.h:410
Power_setParkState
void Power_setParkState(Power_Pin pin, uint32_t level)
Power_ConfigV1::enableRTCWakeupLPDS
bool enableRTCWakeupLPDS
Definition: power_xwrLx4xx.h:234
POWER_PIN_PAD_AW
@ POWER_PIN_PAD_AW
Definition: power_xwrLx4xx.h:466
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:322
Power_reset
int_fast16_t Power_reset(uint_fast16_t resourceId)
Software reset of a resource.
Power_ParkInfo::pin
uint32_t pin
Definition: power_xwrLx4xx.h:187
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:333
PIN_PAD_AW
#define PIN_PAD_AW
Definition: pinmux/v0/pinmux.h:123
Power_Wakeup::wakeupGPIOPadLPDS
uint32_t wakeupGPIOPadLPDS
The GPIO source for wakeup from LPDS.
Definition: power_xwrLx4xx.h:509
PIN_PAD_AP
#define PIN_PAD_AP
Definition: pinmux/v0/pinmux.h:116
POWER_DRIVE_HIGH
@ POWER_DRIVE_HIGH
Definition: power_xwrLx4xx.h:414
Power_ParkInfo::parkState
uint32_t parkState
Definition: power_xwrLx4xx.h:189
POWER_PIN_PAD_AP
@ POWER_PIN_PAD_AP
Definition: power_xwrLx4xx.h:452
POWER_PIN_PAD_AR
@ POWER_PIN_PAD_AR
Definition: power_xwrLx4xx.h:456
PIN_PAD_AJ
#define PIN_PAD_AJ
Definition: pinmux/v0/pinmux.h:110
Power_getParkState
Power_ParkState Power_getParkState(Power_Pin pin)
POWER_PIN_PAD_AC
@ POWER_PIN_PAD_AC
Definition: power_xwrLx4xx.h:426
Power_Wakeup::enableFRCWakeupLPDS
bool enableFRCWakeupLPDS
Definition: power_xwrLx4xx.h:499
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:561
Power_restoreParkState
void Power_restoreParkState(Power_Pin pin, Power_ParkState state)
Power_ConfigV1::resumeLatencyForLPDS
uint32_t resumeLatencyForLPDS
Definition: power_xwrLx4xx.h:343
POWER_PIN_PAD_AA
@ POWER_PIN_PAD_AA
Definition: power_xwrLx4xx.h:422
PIN_PAD_AU
#define PIN_PAD_AU
Definition: pinmux/v0/pinmux.h:121
syncinpadcfg::pad
uint32_t pad
Definition: power_xwrLx4xx.h:473
Power_ConfigV1::wakeupSyncIOPadLPDS
uint32_t wakeupSyncIOPadLPDS
The GPIO source for wakeup from LPDS.
Definition: power_xwrLx4xx.h:295
Power_ConfigV1::policyFxn
Power_PolicyFxn policyFxn
Definition: power_xwrLx4xx.h:203
pinmux.h
Power_ParkState
Power_ParkState
Enumeration of states a pin can be parked in.
Definition: power_xwrLx4xx.h:404
Power_Wakeup::enableSPICSWakeupLPDS
bool enableSPICSWakeupLPDS
Definition: power_xwrLx4xx.h:495
Power_afterLPDS
void Power_afterLPDS(void)
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
Definition: power_xwrLx4xx.h:193
Power_ConfigV1::policyInitFxn
Power_PolicyInitFxn policyInitFxn
Definition: power_xwrLx4xx.h:201
POWER_DRIVE_LOW
@ POWER_DRIVE_LOW
Definition: power_xwrLx4xx.h:412
POWER_PIN_PAD_AS
@ POWER_PIN_PAD_AS
Definition: power_xwrLx4xx.h:458
Power_ConfigV1::totalLatencyForLPDS
uint32_t totalLatencyForLPDS
Latency to reserve for entry to and exit from LPDS, in microseconds.
Definition: power_xwrLx4xx.h:341
POWER_PIN_PAD_AO
@ POWER_PIN_PAD_AO
Definition: power_xwrLx4xx.h:450
Power_Wakeup::enableUARTWakeupLPDS
bool enableUARTWakeupLPDS
Definition: power_xwrLx4xx.h:493
POWER_PIN_PAD_AD
@ POWER_PIN_PAD_AD
Definition: power_xwrLx4xx.h:428
Power_ConfigV1::resumeLatencyForIdle
uint32_t resumeLatencyForIdle
Definition: power_xwrLx4xx.h:351
POWER_PIN_PAD_AF
@ POWER_PIN_PAD_AF
Definition: power_xwrLx4xx.h:432
POWER_PIN_PAD_AX
@ POWER_PIN_PAD_AX
Definition: power_xwrLx4xx.h:468
Power_getWakeup
void Power_getWakeup(Power_Wakeup *wakeup)
Function to get wakeup configuration settings.
POWER_PIN_PAD_AV
@ POWER_PIN_PAD_AV
Definition: power_xwrLx4xx.h:464
Power_ConfigV1::resumeLatencyForSleep
uint32_t resumeLatencyForSleep
Definition: power_xwrLx4xx.h:347
POWER_PIN_PAD_AQ
@ POWER_PIN_PAD_AQ
Definition: power_xwrLx4xx.h:454
Power_ConfigV1::enableSPICSWakeupLPDS
bool enableSPICSWakeupLPDS
Definition: power_xwrLx4xx.h:231
Power_ConfigV1::wakeupGPIOPadLPDS
uint32_t wakeupGPIOPadLPDS
The GPIO source for wakeup from LPDS.
Definition: power_xwrLx4xx.h:251
Power_ParkInfo
Used to specify parking of a pin during LPDS.
Definition: power_xwrLx4xx.h:186
POWER_PIN_PAD_AN
@ POWER_PIN_PAD_AN
Definition: power_xwrLx4xx.h:448
POWER_PIN_PAD_AH
@ POWER_PIN_PAD_AH
Definition: power_xwrLx4xx.h:436
PIN_PAD_AD
#define PIN_PAD_AD
Definition: pinmux/v0/pinmux.h:104
POWER_PIN_PAD_AJ
@ POWER_PIN_PAD_AJ
Definition: power_xwrLx4xx.h:440
POWER_SYNCIN_IO_WAKEUP_LPDS
@ POWER_SYNCIN_IO_WAKEUP_LPDS
Definition: power_xwrLx4xx.h:195
Power_ConfigV1::wakeupSyncIOEdgeLPDS
uint32_t wakeupSyncIOEdgeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: power_xwrLx4xx.h:303
PIN_PAD_AS
#define PIN_PAD_AS
Definition: pinmux/v0/pinmux.h:119
Power_ConfigV1::enablePolicy
bool enablePolicy
Definition: power_xwrLx4xx.h:220
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_NO_PULL_HIZ
@ POWER_NO_PULL_HIZ
Definition: power_xwrLx4xx.h:406
POWER_PIN_PAD_AL
@ POWER_PIN_PAD_AL
Definition: power_xwrLx4xx.h:444
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
POWER_PIN_PAD_AG
@ POWER_PIN_PAD_AG
Definition: power_xwrLx4xx.h:434