TI-RTOS Drivers  tidrivers_full_2_20_00_08
PowerCC3200.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, 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  */
75 #ifndef ti_drivers_power_PowerCC3200__include
76 #define ti_drivers_power_PowerCC3200__include
77 
78 #include <stdint.h>
79 #include <ti/drivers/utils/List.h>
80 #include <ti/drivers/Power.h>
81 
82 /* driverlib header files */
83 #include <inc/hw_types.h>
84 #include <driverlib/pin.h>
85 #include <driverlib/rom.h>
86 #include <driverlib/rom_map.h>
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92 /* values were gathered from a logic analyzer and rounded up */
94 #define PowerCC3200_RESUMETIMELPDS 2500
95 
97 #define PowerCC3200_TOTALTIMELPDS 20000
98 
100 #define PowerCC3200_TOTALTIMESHUTDOWN 500000
101 
102 /* Power resources */
103 #define PowerCC3200_PERIPH_CAMERA 0
104 #define PowerCC3200_PERIPH_I2S 1
105 #define PowerCC3200_PERIPH_SDHOST 2
106 #define PowerCC3200_PERIPH_GSPI 3
107 #define PowerCC3200_PERIPH_LSPI 4
108 #define PowerCC3200_PERIPH_UDMA 5
109 #define PowerCC3200_PERIPH_GPIOA0 6
110 #define PowerCC3200_PERIPH_GPIOA1 7
111 #define PowerCC3200_PERIPH_GPIOA2 8
112 #define PowerCC3200_PERIPH_GPIOA3 9
113 #define PowerCC3200_PERIPH_GPIOA4 10
114 #define PowerCC3200_PERIPH_WDT 11
115 #define PowerCC3200_PERIPH_UARTA0 12
116 #define PowerCC3200_PERIPH_UARTA1 13
117 #define PowerCC3200_PERIPH_TIMERA0 14
118 #define PowerCC3200_PERIPH_TIMERA1 15
119 #define PowerCC3200_PERIPH_TIMERA2 16
120 #define PowerCC3200_PERIPH_TIMERA3 17
121 #define PowerCC3200_PERIPH_DTHE 18
122 #define PowerCC3200_PERIPH_SSPI 19
123 #define PowerCC3200_PERIPH_I2CA0 20
124 #define PowerCC3200_NUMRESOURCES 21
125 
126 /*
127  * Power constraints on the CC3200 device
128  */
129 #define PowerCC3200_DISALLOW_LPDS 0
130 #define PowerCC3200_DISALLOW_SHUTDOWN 1
131 #define PowerCC3200_NUMCONSTRAINTS 2
133 /*
134  * Power events on the CC3200 device
135  *
136  * Each event must be a power of two and must be sequential
137  * without any gaps.
138  */
139 #define PowerCC3200_ENTERING_LPDS 0x1
140 #define PowerCC3200_ENTERING_SHUTDOWN 0x2
141 #define PowerCC3200_AWAKE_LPDS 0x4
142 #define PowerCC3200_NUMEVENTS 3
144 /* Power sleep states */
145 #define PowerCC3200_LPDS 0x1
147 /* Use by NVIC Register structure */
148 #define PowerCC3200_numNVICSetEnableRegs 6
149 #define PowerCC3200_numNVICIntPriority 49
150 
151 /* Number of pins that can be parked in LPDS */
152 #define PowerCC3200_NUMPINS 34
153 
155 typedef struct PowerCC3200_ParkInfo {
156  uint32_t pin;
157  uint32_t parkState;
159 
161 typedef struct PowerCC3200_ConfigV1 {
172  void (*enterLPDSHookFxn)(void);
179  void (*resumeLPDSHookFxn)(void);
229  void (*wakeupGPIOFxnLPDS)(unsigned int argument);
233  unsigned int wakeupGPIOFxnLPDSArg;
290  uint32_t numPins;
292 
294 typedef struct PowerCC3200_ModuleState {
296  uint32_t constraintMask;
297  uint32_t state;
307  uint16_t stateAntPin29;
308  uint16_t stateAntPin30;
309  uint32_t pinLockMask;
310  void (*wakeupGPIOFxnLPDS)(unsigned int);
311  unsigned int wakeupGPIOFxnLPDSArg;
313 
316  uint32_t vectorTable;
317  uint32_t auxCtrl;
318  uint32_t intCtrlState;
319  uint32_t appInt;
320  uint32_t sysCtrl;
321  uint32_t configCtrl;
322  uint32_t sysPri1;
323  uint32_t sysPri2;
324  uint32_t sysPri3;
325  uint32_t sysHcrs;
326  uint32_t systickCtrl;
327  uint32_t systickReload;
328  uint32_t systickCalib;
332 
334 typedef struct PowerCC3200_MCURegisters {
335  uint32_t msp;
336  uint32_t psp;
337  uint32_t psr;
338  uint32_t primask;
339  uint32_t faultmask;
340  uint32_t basepri;
341  uint32_t control;
343 
349 
351 typedef enum {
352  PowerCC3200_NO_PULL_HIZ = PIN_TYPE_STD,
353  PowerCC3200_WEAK_PULL_UP_STD = PIN_TYPE_STD_PU,
361 
363 typedef enum {
399 
401 typedef struct PowerCC3200_Wakeup {
407  void (*wakeupGPIOFxnLPDS)();
408  unsigned int wakeupGPIOFxnLPDSArg;
412 
425 
427 void PowerCC3200_initPolicy(void);
428 
430 void PowerCC3200_setParkState(PowerCC3200_Pin pin, uint32_t level);
431 
448 void PowerCC3200_disableIORetention(unsigned long groupFlags);
449 
451 void PowerCC3200_sleepPolicy(void);
452 
453 #define Power_getPerformanceLevel(void) 0
454 #define Power_setPerformanceLevel(level) Power_EFAIL
455 
456 #ifdef __cplusplus
457 }
458 #endif
459 
460 #endif /* ti_drivers_power_PowerCC3200__include */
struct PowerCC3200_SaveRegisters PowerCC3200_SaveRegisters
struct of context registers to save on entering LPDS
struct PowerCC3200_ModuleState PowerCC3200_ModuleState
Internal module state.
uint32_t pinLockMask
Definition: PowerCC3200.h:309
PowerCC3200_ParkInfo * pinParkDefs
Pointer to an array of pins to be parked during LPDS.
Definition: PowerCC3200.h:286
uint32_t configCtrl
Definition: PowerCC3200.h:321
bool enableNetworkWakeupLPDS
Definition: PowerCC3200.h:404
uint32_t msp
Definition: PowerCC3200.h:335
void PowerCC3200_configureWakeup(PowerCC3200_Wakeup *wakeup)
Function configures wakeup for LPDS and shutdown.
uint32_t control
Definition: PowerCC3200.h:341
Definition: PowerCC3200.h:386
Internal module state.
Definition: PowerCC3200.h:294
Definition: PowerCC3200.h:356
Definition: PowerCC3200.h:373
NVIC registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:315
MCU core registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:334
uint8_t refCount[PowerCC3200_NUMRESOURCES]
Definition: PowerCC3200.h:301
Definition: PowerCC3200.h:378
Definition: List.h:131
#define PowerCC3200_numNVICSetEnableRegs
Definition: PowerCC3200.h:148
uint32_t primask
Definition: PowerCC3200.h:338
uint32_t wakeupGPIOTypeLPDS
Definition: PowerCC3200.h:406
Definition: PowerCC3200.h:354
bool keepDebugActiveDuringLPDS
Keep debug interface active during LPDS.
Definition: PowerCC3200.h:272
uint32_t wakeupGPIOSourceShutdown
Definition: PowerCC3200.h:409
struct of context registers to save on entering LPDS
Definition: PowerCC3200.h:345
void(* wakeupGPIOFxnLPDS)()
Definition: PowerCC3200.h:407
uint32_t intSetEn[PowerCC3200_numNVICSetEnableRegs]
Definition: PowerCC3200.h:329
uint32_t wakeupGPIOTypeShutdown
Definition: PowerCC3200.h:410
uint32_t systickCalib
Definition: PowerCC3200.h:328
Definition: PowerCC3200.h:352
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:91
Power manager interface.
Definition: PowerCC3200.h:382
uint32_t intCtrlState
Definition: PowerCC3200.h:318
uint32_t sysPri2
Definition: PowerCC3200.h:323
Definition: PowerCC3200.h:365
struct PowerCC3200_ConfigV1 PowerCC3200_ConfigV1
Power global configuration.
Definition: PowerCC3200.h:392
Definition: PowerCC3200.h:364
uint16_t dbRecords[PowerCC3200_NUMRESOURCES]
Definition: PowerCC3200.h:298
Power_PolicyFxn policyFxn
Definition: PowerCC3200.h:165
uint32_t vectorTable
Definition: PowerCC3200.h:316
Definition: PowerCC3200.h:394
Definition: PowerCC3200.h:383
Definition: PowerCC3200.h:388
uint16_t stateAntPin30
Definition: PowerCC3200.h:308
uint32_t wakeupGPIOTypeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: PowerCC3200.h:208
uint32_t parkState
Definition: PowerCC3200.h:157
Definition: PowerCC3200.h:375
#define PowerCC3200_NUMRESOURCES
Definition: PowerCC3200.h:124
Definition: PowerCC3200.h:397
uint32_t sysPri1
Definition: PowerCC3200.h:322
uint32_t basepri
Definition: PowerCC3200.h:340
uint32_t ramRetentionMaskLPDS
SRAM retention mask for LPDS.
Definition: PowerCC3200.h:262
Power_PolicyInitFxn policyInitFxn
Definition: PowerCC3200.h:163
void PowerCC3200_sleepPolicy(void)
uint32_t numPins
Number of pins to be parked during LPDS.
Definition: PowerCC3200.h:290
Definition: PowerCC3200.h:377
uint32_t sysHcrs
Definition: PowerCC3200.h:325
uint32_t appInt
Definition: PowerCC3200.h:319
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:96
bool enablePolicy
Definition: PowerCC3200.h:299
uint16_t pinDir[PowerCC3200_NUMPINS]
Definition: PowerCC3200.h:305
Definition: PowerCC3200.h:391
Definition: PowerCC3200.h:353
void PowerCC3200_disableIORetention(unsigned long groupFlags)
Function to disable IO retention and unlock pin groups following exit from Shutdown.
Definition: PowerCC3200.h:387
uint8_t constraintCounts[PowerCC3200_NUMCONSTRAINTS]
Definition: PowerCC3200.h:302
uint32_t wakeupGPIOSourceLPDS
The GPIO source for wakeup from LPDS.
Definition: PowerCC3200.h:200
uint32_t wakeupGPIOTypeShutdown
The GPIO trigger type for wakeup from shutdown.
Definition: PowerCC3200.h:254
uint32_t systickReload
Definition: PowerCC3200.h:327
Definition: PowerCC3200.h:359
Definition: PowerCC3200.h:367
struct PowerCC3200_NVICRegisters PowerCC3200_NVICRegisters
NVIC registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:358
Definition: PowerCC3200.h:379
Definition: PowerCC3200.h:395
struct PowerCC3200_ParkInfo PowerCC3200_ParkInfo
Used to specify parking of a pin during LPDS.
Definition: PowerCC3200.h:384
Definition: PowerCC3200.h:369
uint32_t psr
Definition: PowerCC3200.h:337
Definition: PowerCC3200.h:366
bool enableGPIOWakeupShutdown
Definition: PowerCC3200.h:185
void(* resumeLPDSHookFxn)(void)
Hook function called when resuming from LPDS.
Definition: PowerCC3200.h:179
bool enableNetworkWakeupLPDS
Definition: PowerCC3200.h:187
#define PowerCC3200_numNVICIntPriority
Definition: PowerCC3200.h:149
uint32_t pin
Definition: PowerCC3200.h:156
uint32_t wakeupGPIOSourceShutdown
The GPIO sources for wakeup from shutdown.
Definition: PowerCC3200.h:246
Definition: PowerCC3200.h:355
List_List notifyList
Definition: PowerCC3200.h:295
uint32_t psp
Definition: PowerCC3200.h:336
PowerCC3200_Pin
enumeration of pins that can be parked
Definition: PowerCC3200.h:363
Definition: PowerCC3200.h:380
bool enableGPIOWakeupLPDS
Definition: PowerCC3200.h:183
void PowerCC3200_initPolicy(void)
void(* wakeupGPIOFxnLPDS)(unsigned int argument)
Function to be called when the configured GPIO triggers wakeup from LPDS.
Definition: PowerCC3200.h:229
PowerCC3200_ParkState
enumeration of state for parked pins
Definition: PowerCC3200.h:351
Definition: PowerCC3200.h:389
#define PowerCC3200_NUMCONSTRAINTS
Definition: PowerCC3200.h:131
Definition: PowerCC3200.h:370
void(* wakeupGPIOFxnLPDS)(unsigned int)
Definition: PowerCC3200.h:310
struct PowerCC3200_MCURegisters PowerCC3200_MCURegisters
MCU core registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:374
unsigned int wakeupGPIOFxnLPDSArg
The argument to be passed to wakeupGPIOFxnLPDS()
Definition: PowerCC3200.h:233
void PowerCC3200_setParkState(PowerCC3200_Pin pin, uint32_t level)
PowerCC3200_MCURegisters m4Regs
Definition: PowerCC3200.h:346
uint32_t wakeupGPIOSourceLPDS
Definition: PowerCC3200.h:405
unsigned int wakeupGPIOFxnLPDSArg
Definition: PowerCC3200.h:408
uint8_t pinMode[PowerCC3200_NUMPINS]
Definition: PowerCC3200.h:306
uint32_t pinType[PowerCC3200_NUMPINS]
Definition: PowerCC3200.h:304
struct PowerCC3200_Wakeup PowerCC3200_Wakeup
For wakeup from LPDS or shutdown configuration.
uint32_t systickCtrl
Definition: PowerCC3200.h:326
uint32_t state
Definition: PowerCC3200.h:297
bool enableGPIOWakeupShutdown
Definition: PowerCC3200.h:403
uint32_t auxCtrl
Definition: PowerCC3200.h:317
Definition: PowerCC3200.h:390
Definition: PowerCC3200.h:357
uint32_t constraintMask
Definition: PowerCC3200.h:296
Definition: PowerCC3200.h:396
Definition: PowerCC3200.h:393
unsigned int wakeupGPIOFxnLPDSArg
Definition: PowerCC3200.h:311
Power_PolicyFxn policyFxn
Definition: PowerCC3200.h:303
Definition: PowerCC3200.h:381
Definition: PowerCC3200.h:368
bool enableGPIOWakeupLPDS
Definition: PowerCC3200.h:402
bool enablePolicy
Definition: PowerCC3200.h:181
#define PowerCC3200_NUMPINS
Definition: PowerCC3200.h:152
Definition: PowerCC3200.h:376
uint16_t stateAntPin29
Definition: PowerCC3200.h:307
PowerCC3200_NVICRegisters nvicRegs
Definition: PowerCC3200.h:347
uint32_t faultmask
Definition: PowerCC3200.h:339
uint32_t intPriority[PowerCC3200_numNVICIntPriority]
Definition: PowerCC3200.h:330
bool initialized
Definition: PowerCC3200.h:300
Definition: PowerCC3200.h:385
Power global configuration.
Definition: PowerCC3200.h:161
void(* enterLPDSHookFxn)(void)
Hook function called before entering LPDS.
Definition: PowerCC3200.h:172
uint32_t ioRetentionShutdown
IO retention mask for Shutdown.
Definition: PowerCC3200.h:280
For wakeup from LPDS or shutdown configuration.
Definition: PowerCC3200.h:401
uint32_t sysPri3
Definition: PowerCC3200.h:324
Definition: PowerCC3200.h:372
Linked List interface for use in drivers.
Definition: PowerCC3200.h:371
uint32_t sysCtrl
Definition: PowerCC3200.h:320
Used to specify parking of a pin during LPDS.
Definition: PowerCC3200.h:155
Copyright 2016, Texas Instruments Incorporated