CC3200 Peripheral Driver Library User's Guide  1.2.0
prcm.h
1 //*****************************************************************************
2 //
3 // prcm.h
4 //
5 // Prototypes for the PRCM control driver.
6 //
7 // Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com/
8 //
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
12 // are met:
13 //
14 // Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the
20 // distribution.
21 //
22 // Neither the name of Texas Instruments Incorporated nor the names of
23 // its contributors may be used to endorse or promote products derived
24 // from this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 //*****************************************************************************
39 
40 #ifndef __PRCM_H__
41 #define __PRCM_H__
42 
43 //*****************************************************************************
44 //
45 // If building with a C++ compiler, make all of the definitions in this header
46 // have a C binding.
47 //
48 //*****************************************************************************
49 #ifdef __cplusplus
50 extern "C"
51 {
52 #endif
53 
54 //*****************************************************************************
55 //
56 // Peripheral clock and reset control registers
57 //
58 //*****************************************************************************
59 typedef struct _PRCM_PeripheralRegs_
60 {
61 
62 unsigned long ulClkReg;
63 unsigned long ulRstReg;
64 
66 
67 //*****************************************************************************
68 // Values that can be passed to PRCMPeripheralEnable() and
69 // PRCMPeripheralDisable()
70 //*****************************************************************************
71 #define PRCM_RUN_MODE_CLK 0x00000001
72 #define PRCM_SLP_MODE_CLK 0x00000100
73 
74 //*****************************************************************************
75 // Values that can be passed to PRCMSRAMRetentionEnable() and
76 // PRCMSRAMRetentionDisable() as ulSramColSel.
77 //*****************************************************************************
78 #define PRCM_SRAM_COL_1 0x00000001
79 #define PRCM_SRAM_COL_2 0x00000002
80 #define PRCM_SRAM_COL_3 0x00000004
81 #define PRCM_SRAM_COL_4 0x00000008
82 
83 //*****************************************************************************
84 // Values that can be passed to PRCMSRAMRetentionEnable() and
85 // PRCMSRAMRetentionDisable() as ulModeFlags.
86 //*****************************************************************************
87 #define PRCM_SRAM_LPDS_RET 0x00000002
88 
89 //*****************************************************************************
90 // Values that can be passed to PRCMLPDSWakeupSourceEnable(),
91 // PRCMLPDSWakeupCauseGet() and PRCMLPDSWakeupSourceDisable().
92 //*****************************************************************************
93 #define PRCM_LPDS_HOST_IRQ 0x00000080
94 #define PRCM_LPDS_GPIO 0x00000010
95 #define PRCM_LPDS_TIMER 0x00000001
96 
97 //*****************************************************************************
98 // Values that can be passed to PRCMLPDSWakeUpGPIOSelect() as Type
99 //*****************************************************************************
100 #define PRCM_LPDS_LOW_LEVEL 0x00000002
101 #define PRCM_LPDS_HIGH_LEVEL 0x00000000
102 #define PRCM_LPDS_FALL_EDGE 0x00000001
103 #define PRCM_LPDS_RISE_EDGE 0x00000003
104 
105 //*****************************************************************************
106 // Values that can be passed to PRCMLPDSWakeUpGPIOSelect()
107 //*****************************************************************************
108 #define PRCM_LPDS_GPIO2 0x00000000
109 #define PRCM_LPDS_GPIO4 0x00000001
110 #define PRCM_LPDS_GPIO13 0x00000002
111 #define PRCM_LPDS_GPIO17 0x00000003
112 #define PRCM_LPDS_GPIO11 0x00000004
113 #define PRCM_LPDS_GPIO24 0x00000005
114 #define PRCM_LPDS_GPIO26 0x00000006
115 
116 //*****************************************************************************
117 // Values that can be passed to PRCMHibernateWakeupSourceEnable(),
118 // PRCMHibernateWakeupSourceDisable().
119 //*****************************************************************************
120 #define PRCM_HIB_SLOW_CLK_CTR 0x00000001
121 
122 //*****************************************************************************
123 // Values that can be passed to PRCMHibernateWakeUpGPIOSelect() as ulType
124 //*****************************************************************************
125 #define PRCM_HIB_LOW_LEVEL 0x00000000
126 #define PRCM_HIB_HIGH_LEVEL 0x00000001
127 #define PRCM_HIB_FALL_EDGE 0x00000002
128 #define PRCM_HIB_RISE_EDGE 0x00000003
129 
130 //*****************************************************************************
131 // Values that can be passed to PRCMHibernateWakeupSourceEnable(),
132 // PRCMHibernateWakeupSourceDisable(), PRCMHibernateWakeUpGPIOSelect()
133 //*****************************************************************************
134 #define PRCM_HIB_GPIO2 0x00010000
135 #define PRCM_HIB_GPIO4 0x00020000
136 #define PRCM_HIB_GPIO13 0x00040000
137 #define PRCM_HIB_GPIO17 0x00080000
138 #define PRCM_HIB_GPIO11 0x00100000
139 #define PRCM_HIB_GPIO24 0x00200000
140 #define PRCM_HIB_GPIO26 0x00400000
141 
142 //*****************************************************************************
143 // Values that will be returned from PRCMSysResetCauseGet().
144 //*****************************************************************************
145 #define PRCM_POWER_ON 0x00000000
146 #define PRCM_LPDS_EXIT 0x00000001
147 #define PRCM_CORE_RESET 0x00000003
148 #define PRCM_MCU_RESET 0x00000004
149 #define PRCM_WDT_RESET 0x00000005
150 #define PRCM_SOC_RESET 0x00000006
151 #define PRCM_HIB_EXIT 0x00000007
152 
153 //*****************************************************************************
154 // Values that can be passed to PRCMHibernateWakeupCauseGet().
155 //*****************************************************************************
156 #define PRCM_HIB_WAKEUP_CAUSE_SLOW_CLOCK 0x00000002
157 #define PRCM_HIB_WAKEUP_CAUSE_GPIO 0x00000004
158 
159 //*****************************************************************************
160 // Values that can be passed to PRCMSEnableInterrupt
161 //*****************************************************************************
162 #define PRCM_INT_SLOW_CLK_CTR 0x00004000
163 
164 //*****************************************************************************
165 // Values that can be passed to PRCMPeripheralClkEnable(),
166 // PRCMPeripheralClkDisable(), PRCMPeripheralReset()
167 //*****************************************************************************
168 #define PRCM_CAMERA 0x00000000
169 #define PRCM_I2S 0x00000001
170 #define PRCM_SDHOST 0x00000002
171 #define PRCM_GSPI 0x00000003
172 #define PRCM_LSPI 0x00000004
173 #define PRCM_UDMA 0x00000005
174 #define PRCM_GPIOA0 0x00000006
175 #define PRCM_GPIOA1 0x00000007
176 #define PRCM_GPIOA2 0x00000008
177 #define PRCM_GPIOA3 0x00000009
178 #define PRCM_GPIOA4 0x0000000A
179 #define PRCM_WDT 0x0000000B
180 #define PRCM_UARTA0 0x0000000C
181 #define PRCM_UARTA1 0x0000000D
182 #define PRCM_TIMERA0 0x0000000E
183 #define PRCM_TIMERA1 0x0000000F
184 #define PRCM_TIMERA2 0x00000010
185 #define PRCM_TIMERA3 0x00000011
186 #define PRCM_DTHE 0x00000012
187 #define PRCM_SSPI 0x00000013
188 #define PRCM_I2CA0 0x00000014
189 // Note : PRCM_ADC is a dummy define for pinmux utility code generation
190 // PRCM_ADC should never be used in any user code.
191 #define PRCM_ADC 0x000000FF
192 
193 //*****************************************************************************
194 //
195 // API Function prototypes
196 //
197 //*****************************************************************************
198 extern void PRCMMCUReset(tBoolean bIncludeSubsystem);
199 extern unsigned long PRCMSysResetCauseGet(void);
200 
201 extern void PRCMPeripheralClkEnable(unsigned long ulPeripheral,
202  unsigned long ulClkFlags);
203 extern void PRCMPeripheralClkDisable(unsigned long ulPeripheral,
204  unsigned long ulClkFlags);
205 extern void PRCMPeripheralReset(unsigned long ulPeripheral);
206 extern tBoolean PRCMPeripheralStatusGet(unsigned long ulPeripheral);
207 
208 extern void PRCMI2SClockFreqSet(unsigned long ulI2CClkFreq);
209 extern unsigned long PRCMPeripheralClockGet(unsigned long ulPeripheral);
210 
211 extern void PRCMSleepEnter(void);
212 
213 extern void PRCMSRAMRetentionEnable(unsigned long ulSramColSel,
214  unsigned long ulFlags);
215 extern void PRCMSRAMRetentionDisable(unsigned long ulSramColSel,
216  unsigned long ulFlags);
217 extern void PRCMLPDSRestoreInfoSet(unsigned long ulRestoreSP,
218  unsigned long ulRestorePC);
219 extern void PRCMLPDSEnter(void);
220 extern void PRCMLPDSIntervalSet(unsigned long ulTicks);
221 extern void PRCMLPDSWakeupSourceEnable(unsigned long ulLpdsWakeupSrc);
222 extern unsigned long PRCMLPDSWakeupCauseGet(void);
223 extern void PRCMLPDSWakeUpGPIOSelect(unsigned long ulGPIOPin,
224  unsigned long ulType);
225 extern void PRCMLPDSWakeupSourceDisable(unsigned long ulLpdsWakeupSrc);
226 
227 extern void PRCMHibernateEnter(void);
228 extern void PRCMHibernateWakeupSourceEnable(unsigned long ulHIBWakupSrc);
229 extern unsigned long PRCMHibernateWakeupCauseGet(void);
230 extern void PRCMHibernateWakeUpGPIOSelect(unsigned long ulMultiGPIOBitMap,
231  unsigned long ulType);
232 extern void PRCMHibernateWakeupSourceDisable(unsigned long ulHIBWakupSrc);
233 extern void PRCMHibernateIntervalSet(unsigned long long ullTicks);
234 
235 extern unsigned long long PRCMSlowClkCtrGet(void);
236 extern unsigned long long PRCMSlowClkCtrFastGet(void);
237 extern void PRCMSlowClkCtrMatchSet(unsigned long long ullTicks);
238 extern unsigned long long PRCMSlowClkCtrMatchGet(void);
239 
240 extern void PRCMOCRRegisterWrite(unsigned char ucIndex,
241  unsigned long ulRegValue);
242 extern unsigned long PRCMOCRRegisterRead(unsigned char ucIndex);
243 
244 extern void PRCMIntRegister(void (*pfnHandler)(void));
245 extern void PRCMIntUnregister(void);
246 extern void PRCMIntEnable(unsigned long ulIntFlags);
247 extern void PRCMIntDisable(unsigned long ulIntFlags);
248 extern unsigned long PRCMIntStatus(void);
249 extern void PRCMRTCInUseSet(void);
250 extern tBoolean PRCMRTCInUseGet(void);
251 extern void PRCMRTCSet(unsigned long ulSecs, unsigned short usMsec);
252 extern void PRCMRTCGet(unsigned long *ulSecs, unsigned short *usMsec);
253 extern void PRCMRTCMatchSet(unsigned long ulSecs, unsigned short usMsec);
254 extern void PRCMRTCMatchGet(unsigned long *ulSecs, unsigned short *usMsec);
255 extern void PRCMCC3200MCUInit(void);
256 extern unsigned long PRCMHIBRegRead(unsigned long ulRegAddr);
257 extern void PRCMHIBRegWrite(unsigned long ulRegAddr, unsigned long ulValue);
258 extern unsigned long PRCMCameraFreqSet(unsigned char ulDivider,
259  unsigned char ulWidth);
260 extern void PRCMLPDSEnterKeepDebugIf(void);
261 
262 
263 //*****************************************************************************
264 //
265 // Mark the end of the C bindings section for C++ compilers.
266 //
267 //*****************************************************************************
268 #ifdef __cplusplus
269 }
270 #endif
271 
272 #endif // __PRCM_H__
void PRCMIntRegister(void(*pfnHandler)(void))
Definition: prcm.c:1400
void PRCMLPDSEnterKeepDebugIf(void)
Definition: prcm.c:698
unsigned long PRCMCameraFreqSet(unsigned char ulDivider, unsigned char ulWidth)
Definition: prcm.c:2001
void PRCMLPDSWakeupSourceDisable(unsigned long ulLpdsWakeupSrc)
Definition: prcm.c:797
tBoolean PRCMPeripheralStatusGet(unsigned long ulPeripheral)
Definition: prcm.c:518
void PRCMIntEnable(unsigned long ulIntFlags)
Definition: prcm.c:1453
void PRCMSRAMRetentionEnable(unsigned long ulSramColSel, unsigned long ulFlags)
Definition: prcm.c:937
void PRCMRTCMatchSet(unsigned long ulSecs, unsigned short usMsec)
Definition: prcm.c:1657
void PRCMRTCGet(unsigned long *ulSecs, unsigned short *usMsec)
Definition: prcm.c:1622
void PRCMIntDisable(unsigned long ulIntFlags)
Definition: prcm.c:1489
void PRCMRTCInUseSet(void)
Definition: prcm.c:1542
void PRCMHibernateWakeupSourceDisable(unsigned long ulHIBWakupSrc)
Definition: prcm.c:1056
void PRCMSlowClkCtrMatchSet(unsigned long long ullTicks)
Definition: prcm.c:1311
unsigned long PRCMLPDSWakeupCauseGet(void)
Definition: prcm.c:814
void PRCMHibernateEnter(void)
Definition: prcm.c:1218
unsigned long long PRCMSlowClkCtrGet(void)
Definition: prcm.c:1250
unsigned long long PRCMSlowClkCtrFastGet(void)
Definition: prcm.c:1284
unsigned long PRCMOCRRegisterRead(unsigned char ucIndex)
Definition: prcm.c:1379
unsigned long PRCMHibernateWakeupCauseGet(void)
Definition: prcm.c:1103
void PRCMOCRRegisterWrite(unsigned char ucIndex, unsigned long ulRegValue)
Definition: prcm.c:1362
void PRCMI2SClockFreqSet(unsigned long ulI2CClkFreq)
Definition: prcm.c:561
void PRCMLPDSRestoreInfoSet(unsigned long ulRestoreSP, unsigned long ulRestorePC)
Definition: prcm.c:592
void PRCMRTCSet(unsigned long ulSecs, unsigned short usMsec)
Definition: prcm.c:1589
void PRCMLPDSWakeUpGPIOSelect(unsigned long ulGPIOPin, unsigned long ulType)
Definition: prcm.c:878
unsigned long PRCMPeripheralClockGet(unsigned long ulPeripheral)
Definition: prcm.c:424
void PRCMRTCMatchGet(unsigned long *ulSecs, unsigned short *usMsec)
Definition: prcm.c:1690
unsigned long PRCMHIBRegRead(unsigned long ulRegAddr)
Definition: prcm.c:1925
unsigned long PRCMSysResetCauseGet(void)
Definition: prcm.c:319
void PRCMHibernateWakeUpGPIOSelect(unsigned long ulMultiGPIOBitMap, unsigned long ulType)
Definition: prcm.c:1182
void PRCMHibernateIntervalSet(unsigned long long ullTicks)
Definition: prcm.c:1120
unsigned long PRCMIntStatus(void)
Definition: prcm.c:1519
void PRCMLPDSIntervalSet(unsigned long ulTicks)
Definition: prcm.c:833
void PRCMPeripheralReset(unsigned long ulPeripheral)
Definition: prcm.c:477
void PRCMLPDSEnter(void)
Definition: prcm.c:623
void PRCMCC3200MCUInit(void)
Definition: prcm.c:1715
void PRCMHIBRegWrite(unsigned long ulRegAddr, unsigned long ulValue)
Definition: prcm.c:1958
unsigned long long PRCMSlowClkCtrMatchGet(void)
Definition: prcm.c:1332
void PRCMLPDSWakeupSourceEnable(unsigned long ulLpdsWakeupSrc)
Definition: prcm.c:761
tBoolean PRCMRTCInUseGet(void)
Definition: prcm.c:1565
void PRCMPeripheralClkEnable(unsigned long ulPeripheral, unsigned long ulClkFlags)
Definition: prcm.c:364
void PRCMPeripheralClkDisable(unsigned long ulPeripheral, unsigned long ulClkFlags)
Definition: prcm.c:401
void PRCMSRAMRetentionDisable(unsigned long ulSramColSel, unsigned long ulFlags)
Definition: prcm.c:973
void PRCMIntUnregister(void)
Definition: prcm.c:1425
void PRCMHibernateWakeupSourceEnable(unsigned long ulHIBWakupSrc)
Definition: prcm.c:1007
void PRCMSleepEnter(void)
Definition: prcm.c:904
Definition: prcm.h:59
void PRCMMCUReset(tBoolean bIncludeSubsystem)
Definition: prcm.c:272