1 /******************************************************************************
2 * Filename: prcm.h
3 * Revised: 2020-02-14 11:30:20 +0100 (Fri, 14 Feb 2020)
4 * Revision: 56760
5 *
6 * Description: Defines and prototypes for the PRCM
7 *
8 * Copyright (c) 2015 - 2017, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38
39 //*****************************************************************************
40 //
41 //! \addtogroup system_control_group
42 //! @{
43 //! \addtogroup prcm_api
44 //! @{
45 //
46 //*****************************************************************************
47
48 #ifndef __PRCM_H__
49 #define __PRCM_H__
50
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include "../inc/hw_types.h"
65 #include "../inc/hw_memmap.h"
66 #include "../inc/hw_ints.h"
67 #include "../inc/hw_prcm.h"
68 #include "../inc/hw_nvic.h"
69 #include "../inc/hw_aon_rtc.h"
70 #include "interrupt.h"
71 #include "debug.h"
72 #include "cpu.h"
73
74
75 //*****************************************************************************
76 //
77 // Support for DriverLib in ROM:
78 // This section renames all functions that are not "static inline", so that
79 // calling these functions will default to implementation in flash. At the end
80 // of this file a second renaming will change the defaults to implementation in
81 // ROM for available functions.
82 //
83 // To force use of the implementation in flash, e.g. for debugging:
84 // - Globally: Define DRIVERLIB_NOROM at project level
85 // - Per function: Use prefix "NOROM_" when calling the function
86 //
87 //*****************************************************************************
88 #if !defined(DOXYGEN)
89 #define PRCMInfClockConfigureSet NOROM_PRCMInfClockConfigureSet
90 #define PRCMInfClockConfigureGet NOROM_PRCMInfClockConfigureGet
91 #define PRCMAudioClockConfigSet NOROM_PRCMAudioClockConfigSet
92 #define PRCMAudioClockConfigSetOverride NOROM_PRCMAudioClockConfigSetOverride
93 #define PRCMAudioClockInternalSource NOROM_PRCMAudioClockInternalSource
94 #define PRCMAudioClockExternalSource NOROM_PRCMAudioClockExternalSource
95 #define PRCMPowerDomainOn NOROM_PRCMPowerDomainOn
96 #define PRCMPowerDomainOff NOROM_PRCMPowerDomainOff
97 #define PRCMPeripheralRunEnable NOROM_PRCMPeripheralRunEnable
98 #define PRCMPeripheralRunDisable NOROM_PRCMPeripheralRunDisable
99 #define PRCMPeripheralSleepEnable NOROM_PRCMPeripheralSleepEnable
100 #define PRCMPeripheralSleepDisable NOROM_PRCMPeripheralSleepDisable
101 #define PRCMPeripheralDeepSleepEnable NOROM_PRCMPeripheralDeepSleepEnable
102 #define PRCMPeripheralDeepSleepDisable NOROM_PRCMPeripheralDeepSleepDisable
103 #define PRCMPowerDomainStatus NOROM_PRCMPowerDomainStatus
104 #define PRCMDeepSleep NOROM_PRCMDeepSleep
105 #endif
106
107 //*****************************************************************************
108 //
109 // Defines for the different System CPU power modes.
110 //
111 //*****************************************************************************
112 #define PRCM_RUN_MODE 0x00000001
113 #define PRCM_SLEEP_MODE 0x00000002
114 #define PRCM_DEEP_SLEEP_MODE 0x00000004
115
116 //*****************************************************************************
117 //
118 // Defines used for setting the clock division factors
119 //
120 //*****************************************************************************
121 #define PRCM_CLOCK_DIV_1 PRCM_GPTCLKDIV_RATIO_DIV1
122 #define PRCM_CLOCK_DIV_2 PRCM_GPTCLKDIV_RATIO_DIV2
123 #define PRCM_CLOCK_DIV_4 PRCM_GPTCLKDIV_RATIO_DIV4
124 #define PRCM_CLOCK_DIV_8 PRCM_GPTCLKDIV_RATIO_DIV8
125 #define PRCM_CLOCK_DIV_16 PRCM_GPTCLKDIV_RATIO_DIV16
126 #define PRCM_CLOCK_DIV_32 PRCM_GPTCLKDIV_RATIO_DIV32
127 #define PRCM_CLOCK_DIV_64 PRCM_GPTCLKDIV_RATIO_DIV64
128 #define PRCM_CLOCK_DIV_128 PRCM_GPTCLKDIV_RATIO_DIV128
129 #define PRCM_CLOCK_DIV_256 PRCM_GPTCLKDIV_RATIO_DIV256
130
131 //*****************************************************************************
132 //
133 // Defines used for enabling and disabling domains and memories in the MCU
134 // domain
135 //
136 //*****************************************************************************
137 #define PRCM_DOMAIN_RFCORE 0x00000001 // RF Core domain ID for
138 // clock/power control.
139 #define PRCM_DOMAIN_SERIAL 0x00000002 // Serial domain ID for
140 // clock/power control.
141 #define PRCM_DOMAIN_PERIPH 0x00000004 // Peripheral domain ID for
142 // clock/power control.
143 #define PRCM_DOMAIN_SYSBUS 0x00000008 // Bus domain ID for clock/power
144 // control.
145 #define PRCM_DOMAIN_VIMS 0x00000010 // VIMS domain ID for clock/power
146 // control.
147 #define PRCM_DOMAIN_VIMS_OFF_NO_WAKEUP \
148 0x00020010 // For function PRCMPowerDomainOff() it is an option to
149 // select that VIMS power domain shall not power up
150 // during the next wake up from uLDO (VIMS_MODE=0b10).
151 #define PRCM_DOMAIN_CPU 0x00000020 // CPU domain ID for clock/power
152 // control.
153 #define PRCM_DOMAIN_TIMER 0x00000040 // GPT domain ID for clock
154 // control.
155 #define PRCM_DOMAIN_CLKCTRL 0x00000080 // Clock Control domain ID for
156 // clock/power control.
157 #define PRCM_DOMAIN_MCU 0x00000100 // Reset control for entire MCU
158 // domain.
159 #define PRCM_DOMAIN_POWER_OFF 0x00000002 // The domain is powered off
160 #define PRCM_DOMAIN_POWER_ON 0x00000001 // The domain is powered on
161 #define PRCM_DOMAIN_POWER_DOWN_READY \
162 0x00000000 // The domain is ready to be
163 // powered down.
164
165 //*****************************************************************************
166 //
167 // Defines for setting up the audio interface in the I2S module.
168 //
169 //*****************************************************************************
170 #define PRCM_WCLK_NEG_EDGE 0x00000008
171 #define PRCM_WCLK_POS_EDGE 0x00000000
172 #define PRCM_WCLK_SINGLE_PHASE 0x00000000
173 #define PRCM_WCLK_DUAL_PHASE 0x00000002
174 #define PRCM_WCLK_USER_DEF 0x00000004
175 #define PRCM_I2S_WCLK_NEG_EDGE 0
176 #define PRCM_I2S_WCLK_POS_EDGE 1
177 #define PRCM_I2S_WCLK_SINGLE_PHASE 0
178 #define PRCM_I2S_WCLK_DUAL_PHASE 1
179 #define PRCM_I2S_WCLK_USER_DEF 2
180
181 #define I2S_SAMPLE_RATE_16K 0x00000001
182 #define I2S_SAMPLE_RATE_24K 0x00000002
183 #define I2S_SAMPLE_RATE_32K 0x00000004
184 #define I2S_SAMPLE_RATE_48K 0x00000008
185
186 //*****************************************************************************
187 //
188 // Defines used for enabling and disabling peripheral modules in the MCU domain
189 // bits[11:8] Defines the index into the register offset constant tables:
190 // g_pui32RCGCRegs, g_pui32SCGCRegs and g_pui32DCGCRegs
191 // bits[4:0] Defines the bit position within the register pointet on in [11:8]
192 //
193 //*****************************************************************************
194 #define PRCM_PERIPH_TIMER0 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S )) // Peripheral ID for GPT module 0
195 #define PRCM_PERIPH_TIMER1 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 1 )) // Peripheral ID for GPT module 1
196 #define PRCM_PERIPH_TIMER2 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 2 )) // Peripheral ID for GPT module 2
197 #define PRCM_PERIPH_TIMER3 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 3 )) // Peripheral ID for GPT module 3
198 #define PRCM_PERIPH_SSI0 ( 0x00000100 | ( PRCM_SSICLKGR_CLK_EN_S )) // Peripheral ID for SSI module 0
199 #define PRCM_PERIPH_SSI1 ( 0x00000100 | ( PRCM_SSICLKGR_CLK_EN_S + 1 )) // Peripheral ID for SSI module 1
200 #define PRCM_PERIPH_UART0 ( 0x00000200 | ( PRCM_UARTCLKGR_CLK_EN_S )) // Peripheral ID for UART module 0
201 #define PRCM_PERIPH_UART1 ( 0x00000200 | ( PRCM_UARTCLKGR_CLK_EN_S + 1 )) // Peripheral ID for UART module 1
202 #define PRCM_PERIPH_I2C0 ( 0x00000300 | ( PRCM_I2CCLKGR_CLK_EN_S )) // Peripheral ID for I2C module 0
203 #define PRCM_PERIPH_CRYPTO ( 0x00000400 | ( PRCM_SECDMACLKGR_CRYPTO_CLK_EN_S )) // Peripheral ID for CRYPTO module
204 #define PRCM_PERIPH_TRNG ( 0x00000400 | ( PRCM_SECDMACLKGR_TRNG_CLK_EN_S )) // Peripheral ID for TRNG module
205 #define PRCM_PERIPH_PKA ( 0x00000400 | ( PRCM_SECDMACLKGR_PKA_CLK_EN_S )) // Peripheral ID for PKA module
206 #define PRCM_PERIPH_UDMA ( 0x00000400 | ( PRCM_SECDMACLKGR_DMA_CLK_EN_S )) // Peripheral ID for UDMA module
207 #define PRCM_PERIPH_GPIO ( 0x00000500 | ( PRCM_GPIOCLKGR_CLK_EN_S )) // Peripheral ID for GPIO module
208 #define PRCM_PERIPH_I2S ( 0x00000600 | ( PRCM_I2SCLKGR_CLK_EN_S )) // Peripheral ID for I2S module
209
210 //*****************************************************************************
211 //
212 // API Functions and prototypes
213 //
214 //*****************************************************************************
215
216 #ifdef DRIVERLIB_DEBUG
217 //*****************************************************************************
218 //
219 //! \brief Checks a peripheral identifier.
220 //!
221 //! This function determines if a peripheral identifier is valid.
222 //!
223 //! \param ui32Peripheral is the peripheral identifier.
224 //!
225 //! \return Returns status of peripheral identifier:
226 //! - \b true : Peripheral identifier is valid.
227 //! - \b false : Peripheral identifier is invalid.
228 //
229 //*****************************************************************************
230 static bool
PRCMPeripheralValid(uint32_t ui32Peripheral)231 PRCMPeripheralValid(uint32_t ui32Peripheral)
232 {
233 return((ui32Peripheral == PRCM_PERIPH_TIMER0) ||
234 (ui32Peripheral == PRCM_PERIPH_TIMER1) ||
235 (ui32Peripheral == PRCM_PERIPH_TIMER2) ||
236 (ui32Peripheral == PRCM_PERIPH_TIMER3) ||
237 (ui32Peripheral == PRCM_PERIPH_SSI0) ||
238 (ui32Peripheral == PRCM_PERIPH_SSI1) ||
239 (ui32Peripheral == PRCM_PERIPH_UART0) ||
240 (ui32Peripheral == PRCM_PERIPH_UART1) ||
241 (ui32Peripheral == PRCM_PERIPH_I2C0) ||
242 (ui32Peripheral == PRCM_PERIPH_CRYPTO) ||
243 (ui32Peripheral == PRCM_PERIPH_TRNG) ||
244 (ui32Peripheral == PRCM_PERIPH_PKA) ||
245 (ui32Peripheral == PRCM_PERIPH_UDMA) ||
246 (ui32Peripheral == PRCM_PERIPH_GPIO) ||
247 (ui32Peripheral == PRCM_PERIPH_I2S));
248 }
249 #endif
250
251 //*****************************************************************************
252 //
253 //! \brief Configure the infrastructure clock.
254 //!
255 //! Each System CPU power mode has its own infrastructure clock division factor. This
256 //! function can be used for setting up the division factor for the
257 //! infrastructure clock in the available power modes for the System CPU. The
258 //! infrastructure clock is used for all internal logic in the PRCM, and is
259 //! always running as long as power is on in the MCU voltage domain.
260 //! This can be enabled and disabled from the AON Wake Up Controller.
261 //!
262 //! \note If source clock is 48 MHz, minimum clock divider is \ref PRCM_CLOCK_DIV_2.
263 //!
264 //! \param ui32ClkDiv determines the division ratio for the infrastructure
265 //! clock when the device is in the specified mode.
266 //! Allowed division factors for all three System CPU power modes are:
267 //! - \ref PRCM_CLOCK_DIV_1
268 //! - \ref PRCM_CLOCK_DIV_2
269 //! - \ref PRCM_CLOCK_DIV_8
270 //! - \ref PRCM_CLOCK_DIV_32
271 //! \param ui32PowerMode determines the System CPU operation mode for which to
272 //! modify the clock division factor.
273 //! The three allowed power modes are:
274 //! - \ref PRCM_RUN_MODE
275 //! - \ref PRCM_SLEEP_MODE
276 //! - \ref PRCM_DEEP_SLEEP_MODE
277 //!
278 //! \return None
279 //
280 //*****************************************************************************
281 extern void PRCMInfClockConfigureSet(uint32_t ui32ClkDiv,
282 uint32_t ui32PowerMode);
283
284 //*****************************************************************************
285 //
286 //! \brief Use this function to get the infrastructure clock configuration.
287 //!
288 //! \param ui32PowerMode determines which System CPU power mode to return the
289 //! infrastructure clock division ratio for.
290 //! The three allowed power modes are:
291 //! - \ref PRCM_RUN_MODE
292 //! - \ref PRCM_SLEEP_MODE
293 //! - \ref PRCM_DEEP_SLEEP_MODE
294 //!
295 //! \return Returns the infrastructure clock division factor for the specified
296 //! power mode.
297 //! - \ref PRCM_CLOCK_DIV_1
298 //! - \ref PRCM_CLOCK_DIV_2
299 //! - \ref PRCM_CLOCK_DIV_8
300 //! - \ref PRCM_CLOCK_DIV_32
301 //!
302 //! \sa \ref PRCMInfClockConfigureSet().
303 //
304 //*****************************************************************************
305 extern uint32_t PRCMInfClockConfigureGet(uint32_t ui32PowerMode);
306
307 //*****************************************************************************
308 //
309 //! \brief Assert or de-assert a request for the uLDO.
310 //!
311 //! Use this function to request to switch to the micro Low Voltage Dropout
312 //! regulator (uLDO). The uLDO has a much lower capacity for supplying power
313 //! to the system. It is therefore imperative and solely the programmers
314 //! responsibility to ensure that a sufficient amount of peripheral modules
315 //! have been turned of before requesting a switch to the uLDO.
316 //!
317 //! \note Asserting this bit has no effect until:
318 //! 1. FLASH has accepted to be powered down
319 //! 2. Deepsleep must be asserted
320 //!
321 //! \param ui32Enable
322 //! - 0 : Disable uLDO request
323 //! - 1 : Enable uLDO request
324 //!
325 //! \return None
326 //!
327 //! \sa \ref PRCMDeepSleep()
328 //
329 //*****************************************************************************
330 __STATIC_INLINE void
PRCMMcuUldoConfigure(uint32_t ui32Enable)331 PRCMMcuUldoConfigure(uint32_t ui32Enable)
332 {
333 // Enable or disable the uLDO request signal.
334 HWREGBITW(PRCM_BASE + PRCM_O_VDCTL, PRCM_VDCTL_ULDO_BITN) = ui32Enable;
335 }
336
337 //*****************************************************************************
338 //
339 //! \brief Setup the clock division factor for the GP-Timer domain.
340 //!
341 //! Use this function to set up the clock division factor on the GP-Timer.
342 //!
343 //! The division rate will be constant and ungated for Run / Sleep / DeepSleep mode when
344 //! it is slower than PRCM_GPTCLKDIV_RATIO setting.
345 //! When set faster than PRCM_GPTCLKDIV_RATIO setting PRCM_GPTCLKDIV_RATIO will be used.
346 //! Note that the register will contain the written content even though the setting is
347 //! faster than PRCM_GPTCLKDIV_RATIO setting.
348 //!
349 //! \note For change to take effect, \ref PRCMLoadSet() needs to be called
350 //!
351 //! \param clkDiv is the division factor to set.
352 //! The argument must be only one of the following values:
353 //! - \ref PRCM_CLOCK_DIV_1
354 //! - \ref PRCM_CLOCK_DIV_2
355 //! - \ref PRCM_CLOCK_DIV_4
356 //! - \ref PRCM_CLOCK_DIV_8
357 //! - \ref PRCM_CLOCK_DIV_16
358 //! - \ref PRCM_CLOCK_DIV_32
359 //! - \ref PRCM_CLOCK_DIV_64
360 //! - \ref PRCM_CLOCK_DIV_128
361 //! - \ref PRCM_CLOCK_DIV_256
362 //!
363 //! \return None
364 //!
365 //! \sa \ref PRCMGPTimerClockDivisionGet()
366 //
367 //*****************************************************************************
368 __STATIC_INLINE void
PRCMGPTimerClockDivisionSet(uint32_t clkDiv)369 PRCMGPTimerClockDivisionSet( uint32_t clkDiv )
370 {
371 ASSERT( clkDiv <= PRCM_GPTCLKDIV_RATIO_DIV256 );
372
373 HWREG( PRCM_BASE + PRCM_O_GPTCLKDIV ) = clkDiv;
374 }
375
376 //*****************************************************************************
377 //
378 //! \brief Get the clock division factor for the GP-Timer domain.
379 //!
380 //! Use this function to get the clock division factor set for the GP-Timer.
381 //!
382 //! \return Returns one of the following values:
383 //! - \ref PRCM_CLOCK_DIV_1
384 //! - \ref PRCM_CLOCK_DIV_2
385 //! - \ref PRCM_CLOCK_DIV_4
386 //! - \ref PRCM_CLOCK_DIV_8
387 //! - \ref PRCM_CLOCK_DIV_16
388 //! - \ref PRCM_CLOCK_DIV_32
389 //! - \ref PRCM_CLOCK_DIV_64
390 //! - \ref PRCM_CLOCK_DIV_128
391 //! - \ref PRCM_CLOCK_DIV_256
392 //!
393 //! \sa \ref PRCMGPTimerClockDivisionSet()
394 //
395 //*****************************************************************************
396 __STATIC_INLINE uint32_t
PRCMGPTimerClockDivisionGet(void)397 PRCMGPTimerClockDivisionGet( void )
398 {
399 return ( HWREG( PRCM_BASE + PRCM_O_GPTCLKDIV ));
400 }
401
402
403 //*****************************************************************************
404 //
405 //! \brief Enable the audio clock generation.
406 //!
407 //! Use this function to enable the audio clock generation.
408 //!
409 //! \return None
410 //
411 //*****************************************************************************
412 __STATIC_INLINE void
PRCMAudioClockEnable(void)413 PRCMAudioClockEnable(void)
414 {
415 // Enable the audio clock generation.
416 HWREGBITW(PRCM_BASE + PRCM_O_I2SCLKCTL, PRCM_I2SCLKCTL_EN_BITN) = 1;
417 }
418
419 //*****************************************************************************
420 //
421 //! \brief Disable the audio clock generation.
422 //!
423 //! Use this function to disable the audio clock generation.
424 //!
425 //! \return None
426 //
427 //*****************************************************************************
428 __STATIC_INLINE void
PRCMAudioClockDisable(void)429 PRCMAudioClockDisable(void)
430 {
431 // Disable the audio clock generation
432 HWREGBITW(PRCM_BASE + PRCM_O_I2SCLKCTL, PRCM_I2SCLKCTL_EN_BITN) = 0;
433 }
434
435 //*****************************************************************************
436 //
437 //! \brief Configure the audio clock generation.
438 //!
439 //! \deprecated This function will be removed in a future release.
440 //!
441 //! Use this function to set the sample rate when using internal audio clock
442 //! generation for the I2S module.
443 //!
444 //! \note While other clocks are possible, the stability of the four sample
445 //! rates defined here are only guaranteed if the clock input to the I2S module
446 //! is 48MHz.
447 //!
448 //! \param ui32ClkConfig is the audio clock configuration.
449 //! The parameter is a bitwise OR'ed value consisting of:
450 //! - Phase
451 //! - \ref PRCM_WCLK_SINGLE_PHASE
452 //! - \ref PRCM_WCLK_DUAL_PHASE
453 //! - Clock polarity
454 //! - \ref PRCM_WCLK_NEG_EDGE
455 //! - \ref PRCM_WCLK_POS_EDGE
456 //! \param ui32SampleRate is the desired audio clock sample rate.
457 //! The supported sample rate configurations are:
458 //! - \ref I2S_SAMPLE_RATE_16K
459 //! - \ref I2S_SAMPLE_RATE_24K
460 //! - \ref I2S_SAMPLE_RATE_32K
461 //! - \ref I2S_SAMPLE_RATE_48K
462 //!
463 //! \return None
464 //!
465 //! \sa \ref PRCMAudioClockConfigSetOverride()
466 //
467 //*****************************************************************************
468 #ifndef DEPRECATED
469 extern void PRCMAudioClockConfigSet(uint32_t ui32ClkConfig,
470 uint32_t ui32SampleRate);
471 #endif
472
473 //*****************************************************************************
474 //
475 //! \brief Configure the audio clock generation with manual setting of clock divider.
476 //!
477 //! \deprecated This function will be removed in a future release.
478 //!
479 //! Use this function to set the audio clock divider values manually.
480 //!
481 //! \note See hardware documentation before setting audio clock dividers manually.
482 //!
483 //! \param ui32ClkConfig is the audio clock configuration.
484 //! The parameter is a bitwise OR'ed value consisting of:
485 //! - Phase
486 //! - \ref PRCM_WCLK_SINGLE_PHASE
487 //! - \ref PRCM_WCLK_DUAL_PHASE
488 //! - Clock polarity
489 //! - \ref PRCM_WCLK_NEG_EDGE
490 //! - \ref PRCM_WCLK_POS_EDGE
491 //! \param ui32MstDiv is the desired master clock divider.
492 //! \param ui32WordDiv is the desired word clock divider.
493 //! \param ui32BitDiv is the desired bit clock divider.
494 //!
495 //! \return None
496 //!
497 //! \sa \ref PRCMAudioClockConfigSet()
498 //
499 //*****************************************************************************
500 #ifndef DEPRECATED
501 extern void PRCMAudioClockConfigSetOverride(uint32_t ui32ClkConfig, uint32_t ui32MstDiv,
502 uint32_t ui32BitDiv, uint32_t ui32WordDiv);
503 #endif
504
505 //*****************************************************************************
506 //
507 //! \brief Configure the audio clocks for I2S module.
508 //!
509 //! \note See hardware documentation before setting audio clock dividers.
510 //! This is user's responsability to provide valid clock dividers.
511 //!
512 //! \param ui8SamplingEdge Define the clock polarity:
513 //! - \ref PRCM_I2S_WCLK_NEG_EDGE
514 //! - \ref PRCM_I2S_WCLK_POS_EDGE
515 //! \param ui8WCLKPhase Define I2S phase used
516 //! - PRCM_I2S_WCLK_SINGLE_PHASE
517 //! - PRCM_I2S_WCLK_DUAL_PHASE
518 //! - PRCM_I2S_WCLK_USER_DEF
519 //! \param ui32MstDiv is the desired master clock divider.
520 //! \param ui32BitDiv is the desired bit clock divider.
521 //! \param ui32WordDiv is the desired word clock divider.
522 //!
523 //! \return None
524 //!
525 //*****************************************************************************
526 extern void PRCMAudioClockConfigOverride
527 (uint8_t ui8SamplingEdge,
528 uint8_t ui8WCLKPhase,
529 uint32_t ui32MstDiv,
530 uint32_t ui32BitDiv,
531 uint32_t ui32WordDiv);
532
533 //*****************************************************************************
534 //
535 //! \brief Configure the audio clocks to be internally generated.
536 //!
537 //! Use this function to set the audio clocks as internal.
538 //!
539 //! \return None
540 //!
541 //! \sa \ref PRCMAudioClockExternalSource()
542 //
543 //*****************************************************************************
544 extern void PRCMAudioClockInternalSource(void);
545
546 //*****************************************************************************
547 //
548 //! \brief Configure the audio clocks to be externally generated.
549 //!
550 //! Use this function to set the audio clocks as external.
551 //!
552 //! \return None
553 //!
554 //! \sa \ref PRCMAudioClockInternalSource()
555 //
556 //*****************************************************************************
557 extern void PRCMAudioClockExternalSource(void);
558
559 //*****************************************************************************
560 //
561 //! \brief Use this function to synchronize the load settings.
562 //!
563 //! Most of the clock settings in the PRCM module should be updated
564 //! synchronously. This is ensured by the implementation of a load registers
565 //! that, when written to, will let the previous written update values for all
566 //! the relevant registers propagate through to hardware.
567 //!
568 //! The functions that require a synchronization of the clock settings are:
569 //! - \ref PRCMAudioClockConfigSet()
570 //! - \ref PRCMAudioClockConfigSetOverride()
571 //! - \ref PRCMAudioClockDisable()
572 //! - \ref PRCMDomainEnable()
573 //! - \ref PRCMDomainDisable()
574 //! - \ref PRCMPeripheralRunEnable()
575 //! - \ref PRCMPeripheralRunDisable()
576 //! - \ref PRCMPeripheralSleepEnable()
577 //! - \ref PRCMPeripheralSleepDisable()
578 //! - \ref PRCMPeripheralDeepSleepEnable()
579 //! - \ref PRCMPeripheralDeepSleepDisable()
580 //!
581 //! \return None
582 //!
583 //! \sa \ref PRCMLoadGet()
584 //
585 //*****************************************************************************
586 __STATIC_INLINE void
PRCMLoadSet(void)587 PRCMLoadSet(void)
588 {
589 // Enable the update of all load related registers.
590 HWREG(PRCM_NONBUF_BASE + PRCM_O_CLKLOADCTL) = PRCM_CLKLOADCTL_LOAD;
591 }
592
593 //*****************************************************************************
594 //
595 //! \brief Check if any of the load sensitive register has been updated.
596 //!
597 //! \return Returns status of the load sensitive register:
598 //! - \c true : No registers have changed since the last load.
599 //! - \c false : Any register has changed.
600 //!
601 //! \sa \ref PRCMLoadSet()
602 //
603 //*****************************************************************************
604 __STATIC_INLINE bool
PRCMLoadGet(void)605 PRCMLoadGet(void)
606 {
607 // Return the load status.
608 return ((HWREG(PRCM_BASE + PRCM_O_CLKLOADCTL) & PRCM_CLKLOADCTL_LOAD_DONE) ?
609 true : false);
610 }
611
612 //*****************************************************************************
613 //
614 //! \brief Enable clock domains in the MCU voltage domain.
615 //!
616 //! \note A call to this function will only setup the shadow registers in the
617 //! MCU domain for the PRCM module. For the changes to propagate to the system
618 //! controller in the AON domain a call to this function should always be
619 //! followed by a call to \ref PRCMLoadSet().
620 //!
621 //! \note Clocks will only be running if the domain is powered.
622 //!
623 //! \param ui32Domains is a bit mask containing the clock domains to enable.
624 //! The independent clock domains inside the MCU voltage domain which can be
625 //! configured are:
626 //! - \ref PRCM_DOMAIN_RFCORE
627 //! - \ref PRCM_DOMAIN_VIMS
628 //!
629 //! \return None
630 //
631 //*****************************************************************************
632 __STATIC_INLINE void
PRCMDomainEnable(uint32_t ui32Domains)633 PRCMDomainEnable(uint32_t ui32Domains)
634 {
635 // Check the arguments.
636 ASSERT((ui32Domains & PRCM_DOMAIN_RFCORE) ||
637 (ui32Domains & PRCM_DOMAIN_VIMS));
638
639 // Enable the clock domain(s).
640 if(ui32Domains & PRCM_DOMAIN_RFCORE)
641 {
642 HWREG(PRCM_BASE + PRCM_O_RFCCLKG) = PRCM_RFCCLKG_CLK_EN;
643 }
644 if(ui32Domains & PRCM_DOMAIN_VIMS)
645 {
646 HWREG(PRCM_BASE + PRCM_O_VIMSCLKG) = PRCM_VIMSCLKG_CLK_EN_M;
647 }
648 }
649
650 //*****************************************************************************
651 //
652 //! \brief Disable clock domains in the MCU voltage domain.
653 //!
654 //! \note A call to this function will only setup the shadow registers in the
655 //! MCU domain for the PRCM module. For the changes to propagate to the system
656 //! controller in the AON domain a call to this function should always be
657 //! followed by a call to \ref PRCMLoadSet().
658 //!
659 //! \note Clocks will only be running if the domain is powered.
660 //!
661 //! \param ui32Domains is a bit mask containing the clock domains to disable.
662 //! The independent clock domains inside the MCU voltage domain are:
663 //! - \ref PRCM_DOMAIN_RFCORE
664 //! - \ref PRCM_DOMAIN_VIMS
665 //!
666 //! \return None
667 //!
668 //! \sa PRCMDomainEnable()
669 //
670 //*****************************************************************************
671 __STATIC_INLINE void
PRCMDomainDisable(uint32_t ui32Domains)672 PRCMDomainDisable(uint32_t ui32Domains)
673 {
674 // Check the arguments.
675 ASSERT((ui32Domains & PRCM_DOMAIN_RFCORE) ||
676 (ui32Domains & PRCM_DOMAIN_VIMS));
677
678 // Disable the power domains.
679 if(ui32Domains & PRCM_DOMAIN_RFCORE)
680 {
681 HWREG(PRCM_BASE + PRCM_O_RFCCLKG) = 0x0;
682 }
683 if(ui32Domains & PRCM_DOMAIN_VIMS)
684 {
685 HWREG(PRCM_BASE + PRCM_O_VIMSCLKG) = 0x0;
686 }
687 }
688
689 //*****************************************************************************
690 //
691 //! \brief Turn power on in power domains in the MCU domain.
692 //!
693 //! Use this function to turn on power domains inside the MCU voltage domain.
694 //!
695 //! Power on and power off request has different implications for the
696 //! different power domains.
697 //! - RF Core power domain:
698 //! - Power On : Domain is on or in the process of turning on.
699 //! - Power Off : Domain is powered down when System CPU is in deep sleep. The third
700 //! option for the RF Core is to power down when the it is idle.
701 //! This can be set using \b PRCMRfPowerDownWhenIdle()
702 //! - SERIAL power domain:
703 //! - Power on : Domain is powered on.
704 //! - Power off : Domain is powered off.
705 //! - PERIPHERIAL power domain:
706 //! - Power on : Domain is powered on.
707 //! - Power off : Domain is powered off.
708 //! - VIMS power domain:
709 //! - Power On : Domain is powered if Bus domain is powered.
710 //! - Power Off : Domain is only powered when CPU domain is on.
711 //! - BUS power domain:
712 //! - Power On : Domain is on.
713 //! - Power Off : Domain is on if requested by RF Core or if CPU domain is on.
714 //! - CPU power domain:
715 //! - Power On : Domain is on.
716 //! - Power Off : Domain is powering down if System CPU is idle. This will also
717 //! initiate a power down of the SRAM and BUS power domains, unless
718 //! RF Core is requesting them to be on.
719 //!
720 //! \note After a call to this function the status of the power domain should
721 //! be checked using either \ref PRCMPowerDomainStatus().
722 //! Any write operation to a power domain which is still not operational can
723 //! result in unexpected behavior.
724 //!
725 //! \param ui32Domains determines which power domains to turn on.
726 //! The domains that can be turned on/off are:
727 //! - \b PRCM_DOMAIN_RFCORE : RF Core
728 //! - \b PRCM_DOMAIN_SERIAL : SSI0, UART0, I2C0
729 //! - \b PRCM_DOMAIN_PERIPH : GPT0, GPT1, GPT2, GPT3, GPIO, SSI1, I2S, DMA, UART1
730 //! - \b PRCM_DOMAIN_VIMS : SRAM, FLASH, ROM
731 //! - \b PRCM_DOMAIN_SYSBUS
732 //! - \b PRCM_DOMAIN_CPU
733 //!
734 //! \return None
735 //
736 //*****************************************************************************
737 extern void PRCMPowerDomainOn(uint32_t ui32Domains);
738
739 //*****************************************************************************
740 //
741 //! \brief Turn off a specific power domain.
742 //!
743 //! Use this function to power down domains inside the MCU voltage domain.
744 //!
745 //! \note For specifics regarding on/off configuration please see
746 //! \ref PRCMPowerDomainOn().
747 //!
748 //! \param ui32Domains determines which domain to request a power down for.
749 //! The domains that can be turned on/off are:
750 //! - \b PRCM_DOMAIN_RFCORE : RF Core
751 //! - \b PRCM_DOMAIN_SERIAL : SSI0, UART0, I2C0
752 //! - \b PRCM_DOMAIN_PERIPH : GPT0, GPT1, GPT2, GPT3, GPIO, SSI1, I2S, DMA, UART1
753 //! - \b PRCM_DOMAIN_VIMS : SRAM, FLASH, ROM
754 //! - \b PRCM_DOMAIN_VIMS_OFF_NO_WAKEUP : SRAM, FLASH, ROM
755 //! - \b PRCM_DOMAIN_SYSBUS
756 //! - \b PRCM_DOMAIN_CPU
757 //!
758 //! \return None
759 //
760 //*****************************************************************************
761 extern void PRCMPowerDomainOff(uint32_t ui32Domains);
762
763 //*****************************************************************************
764 //
765 //! \brief Configure RF core to power down when idle.
766 //!
767 //! Use this function to configure the RF core to power down when Idle. This
768 //! is handled automatically in hardware if the RF Core reports that it is
769 //! idle.
770 //!
771 //! \return None
772 //
773 //*****************************************************************************
774 __STATIC_INLINE void
PRCMRfPowerDownWhenIdle(void)775 PRCMRfPowerDownWhenIdle(void)
776 {
777 // Configure the RF power domain.
778 HWREGBITW(PRCM_BASE + PRCM_O_PDCTL0RFC, PRCM_PDCTL0RFC_ON_BITN) = 0;
779 }
780
781 //*****************************************************************************
782 //
783 //! \brief Enables a peripheral in Run mode.
784 //!
785 //! Peripherals are enabled with this function. At power-up, some peripherals
786 //! are disabled; they must be enabled in order to operate or respond to
787 //! register reads/writes.
788 //!
789 //! \note The actual enabling of the peripheral may be delayed until some
790 //! time after this function returns. Care should be taken to ensure that the
791 //! peripheral is not accessed until it is enabled.
792 //! When enabling Timers always make sure that the division factor for the
793 //! \b PERBUSCPUCLK is set. This will guarantee that the timers run at a
794 //! continuous rate even if the \b SYSBUSCLK is gated.
795 //!
796 //! \note A call to this function will only setup the shadow registers in the
797 //! MCU domain for the PRCM module. For the changes to propagate to the system
798 //! controller in the AON domain a call to this function should always be
799 //! followed by a call to \ref PRCMLoadSet().
800 //!
801 //! \param ui32Peripheral is the peripheral to enable.
802 //! The parameter must be one of the following:
803 //! - \ref PRCM_PERIPH_TIMER0
804 //! - \ref PRCM_PERIPH_TIMER1
805 //! - \ref PRCM_PERIPH_TIMER2
806 //! - \ref PRCM_PERIPH_TIMER3
807 //! - \ref PRCM_PERIPH_SSI0
808 //! - \ref PRCM_PERIPH_SSI1
809 //! - \ref PRCM_PERIPH_UART0
810 //! - \ref PRCM_PERIPH_UART1
811 //! - \ref PRCM_PERIPH_I2C0
812 //! - \ref PRCM_PERIPH_CRYPTO
813 //! - \ref PRCM_PERIPH_TRNG
814 //! - \ref PRCM_PERIPH_PKA
815 //! - \ref PRCM_PERIPH_UDMA
816 //! - \ref PRCM_PERIPH_GPIO
817 //! - \ref PRCM_PERIPH_I2S
818 //!
819 //! \return None
820 //!
821 //! \sa \ref PRCMLoadSet()
822 //
823 //*****************************************************************************
824 extern void PRCMPeripheralRunEnable(uint32_t ui32Peripheral);
825
826 //*****************************************************************************
827 //
828 //! \brief Disables a peripheral in Run mode
829 //!
830 //! Peripherals are disabled with this function. Once disabled, they will not
831 //! operate or respond to register reads/writes.
832 //!
833 //! \note A call to this function will only setup the shadow registers in the
834 //! MCU domain for the PRCM module. For the changes to propagate to the system
835 //! controller in the AON domain a call to this function should always be
836 //! followed by a call to \ref PRCMLoadSet().
837 //!
838 //! \note The actual disabling of the peripheral may be delayed until some
839 //! time after this function returns. Care should be taken by the user to
840 //! ensure that the peripheral is not accessed in this interval as this might
841 //! cause the system to hang.
842 //!
843 //! \param ui32Peripheral is the peripheral to disable.
844 //! The parameter must be one of the following:
845 //! - \ref PRCM_PERIPH_TIMER0
846 //! - \ref PRCM_PERIPH_TIMER1
847 //! - \ref PRCM_PERIPH_TIMER2
848 //! - \ref PRCM_PERIPH_TIMER3
849 //! - \ref PRCM_PERIPH_SSI0
850 //! - \ref PRCM_PERIPH_SSI1
851 //! - \ref PRCM_PERIPH_UART0
852 //! - \ref PRCM_PERIPH_UART1
853 //! - \ref PRCM_PERIPH_I2C0
854 //! - \ref PRCM_PERIPH_CRYPTO
855 //! - \ref PRCM_PERIPH_TRNG
856 //! - \ref PRCM_PERIPH_PKA
857 //! - \ref PRCM_PERIPH_UDMA
858 //! - \ref PRCM_PERIPH_GPIO
859 //! - \ref PRCM_PERIPH_I2S
860 //!
861 //! \return None
862 //!
863 //! \sa \ref PRCMLoadSet()
864 //
865 //*****************************************************************************
866 extern void PRCMPeripheralRunDisable(uint32_t ui32Peripheral);
867
868 //*****************************************************************************
869 //
870 //! \brief Enables a peripheral in sleep mode.
871 //!
872 //! This function allows a peripheral to continue operating when the processor
873 //! goes into sleep mode. Since the clocking configuration of the device does
874 //! not change, any peripheral can safely continue operating while the
875 //! processor is in sleep mode, and can therefore wake the processor from sleep
876 //! mode.
877 //!
878 //! \note A call to this function will only setup the shadow registers in the
879 //! MCU domain for the PRCM module. For the changes to propagate to the system
880 //! controller in the AON domain a call to this function should always be
881 //! followed by a call to \ref PRCMLoadSet().
882 //!
883 //! \param ui32Peripheral is the peripheral to enable in sleep mode.
884 //! The parameter must be one of the following:
885 //! - \ref PRCM_PERIPH_TIMER0
886 //! - \ref PRCM_PERIPH_TIMER1
887 //! - \ref PRCM_PERIPH_TIMER2
888 //! - \ref PRCM_PERIPH_TIMER3
889 //! - \ref PRCM_PERIPH_SSI0
890 //! - \ref PRCM_PERIPH_SSI1
891 //! - \ref PRCM_PERIPH_UART0
892 //! - \ref PRCM_PERIPH_UART1
893 //! - \ref PRCM_PERIPH_I2C0
894 //! - \ref PRCM_PERIPH_CRYPTO
895 //! - \ref PRCM_PERIPH_TRNG
896 //! - \ref PRCM_PERIPH_PKA
897 //! - \ref PRCM_PERIPH_UDMA
898 //! - \ref PRCM_PERIPH_GPIO
899 //! - \ref PRCM_PERIPH_I2S
900 //!
901 //! \return None
902 //!
903 //! \sa \ref PRCMLoadSet()
904 //
905 //*****************************************************************************
906 extern void PRCMPeripheralSleepEnable(uint32_t ui32Peripheral);
907
908 //*****************************************************************************
909 //
910 //! \brief Disables a peripheral in sleep mode.
911 //!
912 //! This function causes a peripheral to stop operating when the processor goes
913 //! into sleep mode. Disabling peripherals while in sleep mode helps to lower
914 //! the current draw of the device. If enabled (via \ref PRCMPeripheralRunEnable()),
915 //! the peripheral will automatically resume operation when the processor
916 //! leaves sleep mode, maintaining its entire state from before sleep mode was
917 //! entered.
918 //!
919 //! \note A call to this function will only setup the shadow registers in the
920 //! MCU domain for the PRCM module. For the changes to propagate to the system
921 //! controller in the AON domain a call to this function should always be
922 //! followed by a call to \ref PRCMLoadSet().
923 //!
924 //! \param ui32Peripheral is the peripheral to disable in sleep mode.
925 //! The parameter must be one of the following:
926 //! - \ref PRCM_PERIPH_TIMER0
927 //! - \ref PRCM_PERIPH_TIMER1
928 //! - \ref PRCM_PERIPH_TIMER2
929 //! - \ref PRCM_PERIPH_TIMER3
930 //! - \ref PRCM_PERIPH_SSI0
931 //! - \ref PRCM_PERIPH_SSI1
932 //! - \ref PRCM_PERIPH_UART0
933 //! - \ref PRCM_PERIPH_UART1
934 //! - \ref PRCM_PERIPH_I2C0
935 //! - \ref PRCM_PERIPH_CRYPTO
936 //! - \ref PRCM_PERIPH_TRNG
937 //! - \ref PRCM_PERIPH_PKA
938 //! - \ref PRCM_PERIPH_UDMA
939 //! - \ref PRCM_PERIPH_GPIO
940 //! - \ref PRCM_PERIPH_I2S
941 //!
942 //! \return None
943 //!
944 //! \sa \ref PRCMLoadSet()
945 //
946 //*****************************************************************************
947 extern void PRCMPeripheralSleepDisable(uint32_t ui32Peripheral);
948
949 //*****************************************************************************
950 //
951 //! \brief Enables a peripheral in deep-sleep mode.
952 //!
953 //! This function allows a peripheral to continue operating when the processor
954 //! goes into deep-sleep mode. Since the clocking configuration of the device
955 //! may change, not all peripherals can safely continue operating while the
956 //! processor is in sleep mode. This in turn depends on the chosen power mode.
957 //! It is the responsibility of the caller to make sensible choices.
958 //!
959 //! \note A call to this function will only setup the shadow registers in the
960 //! MCU domain for the PRCM module. For the changes to propagate to the system
961 //! controller in the AON domain a call to this function should always be
962 //! followed by a call to \ref PRCMLoadSet().
963 //!
964 //! \param ui32Peripheral is the peripheral to enable in deep-sleep mode.
965 //! The parameter must be one of the following:
966 //! - \ref PRCM_PERIPH_TIMER0
967 //! - \ref PRCM_PERIPH_TIMER1
968 //! - \ref PRCM_PERIPH_TIMER2
969 //! - \ref PRCM_PERIPH_TIMER3
970 //! - \ref PRCM_PERIPH_SSI0
971 //! - \ref PRCM_PERIPH_SSI1
972 //! - \ref PRCM_PERIPH_UART0
973 //! - \ref PRCM_PERIPH_UART1
974 //! - \ref PRCM_PERIPH_I2C0
975 //! - \ref PRCM_PERIPH_CRYPTO
976 //! - \ref PRCM_PERIPH_TRNG
977 //! - \ref PRCM_PERIPH_PKA
978 //! - \ref PRCM_PERIPH_UDMA
979 //! - \ref PRCM_PERIPH_GPIO
980 //! - \ref PRCM_PERIPH_I2S
981 //!
982 //! \return None
983 //!
984 //! \sa \ref PRCMLoadSet()
985 //
986 //*****************************************************************************
987 extern void PRCMPeripheralDeepSleepEnable(uint32_t ui32Peripheral);
988
989 //*****************************************************************************
990 //
991 //! \brief Disables a peripheral in deep-sleep mode.
992 //!
993 //! This function causes a peripheral to stop operating when the processor goes
994 //! into deep-sleep mode. Disabling peripherals while in deep-sleep mode helps
995 //! to lower the current draw of the device, and can keep peripherals that
996 //! require a particular clock frequency from operating when the clock changes
997 //! as a result of entering deep-sleep mode. If enabled (via
998 //! \ref PRCMPeripheralRunEnable()), the peripheral will automatically resume
999 //! operation when the processor leaves deep-sleep mode, maintaining its entire
1000 //! state from before deep-sleep mode was entered.
1001 //!
1002 //! \note A call to this function will only setup the shadow registers in the
1003 //! MCU domain for the PRCM module. For the changes to propagate to the system
1004 //! controller in the AON domain a call to this function should always be
1005 //! followed by a call to \ref PRCMLoadSet().
1006 //!
1007 //! \param ui32Peripheral is the peripheral to disable in deep-sleep mode.
1008 //! The parameter must be one of the following:
1009 //! - \ref PRCM_PERIPH_TIMER0
1010 //! - \ref PRCM_PERIPH_TIMER1
1011 //! - \ref PRCM_PERIPH_TIMER2
1012 //! - \ref PRCM_PERIPH_TIMER3
1013 //! - \ref PRCM_PERIPH_SSI0
1014 //! - \ref PRCM_PERIPH_SSI1
1015 //! - \ref PRCM_PERIPH_UART0
1016 //! - \ref PRCM_PERIPH_UART1
1017 //! - \ref PRCM_PERIPH_I2C0
1018 //! - \ref PRCM_PERIPH_CRYPTO
1019 //! - \ref PRCM_PERIPH_TRNG
1020 //! - \ref PRCM_PERIPH_PKA
1021 //! - \ref PRCM_PERIPH_UDMA
1022 //! - \ref PRCM_PERIPH_GPIO
1023 //! - \ref PRCM_PERIPH_I2S
1024 //!
1025 //! \return None
1026 //!
1027 //! \sa \ref PRCMLoadSet()
1028 //
1029 //*****************************************************************************
1030 extern void PRCMPeripheralDeepSleepDisable(uint32_t ui32Peripheral);
1031
1032 //*****************************************************************************
1033 //
1034 //! \brief Get the status for a specific power domain.
1035 //!
1036 //! Use this function to retrieve the current power status of one or more
1037 //! power domains.
1038 //!
1039 //! \param ui32Domains determines which domain to get the power status for.
1040 //! The parameter must be an OR'ed combination of one or several of:
1041 //! - \ref PRCM_DOMAIN_RFCORE : RF Core.
1042 //! - \ref PRCM_DOMAIN_SERIAL : SSI0, UART0, I2C0
1043 //! - \ref PRCM_DOMAIN_PERIPH : GPT0, GPT1, GPT2, GPT3, GPIO, SSI1, I2S, DMA, UART1
1044 //!
1045 //! \return Returns status of the requested domains:
1046 //! - \ref PRCM_DOMAIN_POWER_ON : The specified domains are \b all powered up.
1047 //! This status is unconditional and the powered up status is guaranteed.
1048 //! - \ref PRCM_DOMAIN_POWER_OFF : Any of the domains are powered down.
1049 //
1050 //*****************************************************************************
1051 extern uint32_t PRCMPowerDomainStatus(uint32_t ui32Domains);
1052
1053 //*****************************************************************************
1054 //
1055 //! \brief Return the access status of the RF Core.
1056 //!
1057 //! Use this function to check if the RF Core is on and ready to be accessed.
1058 //! Accessing register or memories that are not powered and clocked will
1059 //! cause a bus fault.
1060 //!
1061 //! \return Returns access status of the RF Core.
1062 //! - \c true : RF Core can be accessed.
1063 //! - \c false : RF Core domain is not ready for access.
1064 //
1065 //*****************************************************************************
1066 __STATIC_INLINE bool
PRCMRfReady(void)1067 PRCMRfReady(void)
1068 {
1069 // Return the ready status of the RF Core.
1070 return ((HWREG(PRCM_BASE + PRCM_O_PDSTAT1RFC) &
1071 PRCM_PDSTAT1RFC_ON) ? true : false);
1072 }
1073
1074
1075 //*****************************************************************************
1076 //
1077 //! \brief Put the processor into sleep mode.
1078 //!
1079 //! This function places the processor into sleep mode; it does not return
1080 //! until the processor returns to run mode. The peripherals that are enabled
1081 //! via PRCMPeripheralSleepEnable() continue to operate and can wake up the
1082 //! processor.
1083 //!
1084 //! \return None
1085 //!
1086 //! \sa \ref PRCMPeripheralSleepEnable()
1087 //
1088 //*****************************************************************************
1089 __STATIC_INLINE void
PRCMSleep(void)1090 PRCMSleep(void)
1091 {
1092 // Wait for an interrupt.
1093 CPUwfi();
1094 }
1095
1096 //*****************************************************************************
1097 //
1098 //! \brief Put the processor into deep-sleep mode.
1099 //!
1100 //! This function places the processor into deep-sleep mode; it does not return
1101 //! until the processor returns to run mode. The peripherals that are enabled
1102 //! via \ref PRCMPeripheralDeepSleepEnable() continue to operate and can wake up
1103 //! the processor.
1104 //!
1105 //! \return None
1106 //!
1107 //! \sa \ref PRCMPeripheralDeepSleepEnable()
1108 //
1109 //*****************************************************************************
1110 extern void PRCMDeepSleep(void);
1111
1112 //*****************************************************************************
1113 //
1114 //! \brief Enable CACHE RAM retention
1115 //!
1116 //! Enables CACHE RAM retention on both VIMS_TRAM and VIMS_CRAM
1117 //!
1118 //! \return None
1119 //
1120 //*****************************************************************************
1121 __STATIC_INLINE void
PRCMCacheRetentionEnable(void)1122 PRCMCacheRetentionEnable( void )
1123 {
1124 HWREG( PRCM_BASE + PRCM_O_RAMRETEN ) |= PRCM_RAMRETEN_VIMS_M;
1125 }
1126
1127 //*****************************************************************************
1128 //
1129 //! \brief Disable CACHE RAM retention
1130 //!
1131 //! Disables CACHE RAM retention on both VIMS_TRAM and VIMS_CRAM
1132 //!
1133 //! \return None
1134 //
1135 //*****************************************************************************
1136 __STATIC_INLINE void
PRCMCacheRetentionDisable(void)1137 PRCMCacheRetentionDisable( void )
1138 {
1139 HWREG( PRCM_BASE + PRCM_O_RAMRETEN ) &= ~PRCM_RAMRETEN_VIMS_M;
1140 }
1141
1142
1143 //*****************************************************************************
1144 //
1145 // Support for DriverLib in ROM:
1146 // Redirect to implementation in ROM when available.
1147 //
1148 //*****************************************************************************
1149 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1150 #include "../driverlib/rom.h"
1151 #ifdef ROM_PRCMInfClockConfigureSet
1152 #undef PRCMInfClockConfigureSet
1153 #define PRCMInfClockConfigureSet ROM_PRCMInfClockConfigureSet
1154 #endif
1155 #ifdef ROM_PRCMInfClockConfigureGet
1156 #undef PRCMInfClockConfigureGet
1157 #define PRCMInfClockConfigureGet ROM_PRCMInfClockConfigureGet
1158 #endif
1159 #ifdef ROM_PRCMAudioClockConfigSet
1160 #undef PRCMAudioClockConfigSet
1161 #define PRCMAudioClockConfigSet ROM_PRCMAudioClockConfigSet
1162 #endif
1163 #ifdef ROM_PRCMAudioClockConfigSetOverride
1164 #undef PRCMAudioClockConfigSetOverride
1165 #define PRCMAudioClockConfigSetOverride ROM_PRCMAudioClockConfigSetOverride
1166 #endif
1167 #ifdef ROM_PRCMAudioClockInternalSource
1168 #undef PRCMAudioClockInternalSource
1169 #define PRCMAudioClockInternalSource ROM_PRCMAudioClockInternalSource
1170 #endif
1171 #ifdef ROM_PRCMAudioClockExternalSource
1172 #undef PRCMAudioClockExternalSource
1173 #define PRCMAudioClockExternalSource ROM_PRCMAudioClockExternalSource
1174 #endif
1175 #ifdef ROM_PRCMPowerDomainOn
1176 #undef PRCMPowerDomainOn
1177 #define PRCMPowerDomainOn ROM_PRCMPowerDomainOn
1178 #endif
1179 #ifdef ROM_PRCMPowerDomainOff
1180 #undef PRCMPowerDomainOff
1181 #define PRCMPowerDomainOff ROM_PRCMPowerDomainOff
1182 #endif
1183 #ifdef ROM_PRCMPeripheralRunEnable
1184 #undef PRCMPeripheralRunEnable
1185 #define PRCMPeripheralRunEnable ROM_PRCMPeripheralRunEnable
1186 #endif
1187 #ifdef ROM_PRCMPeripheralRunDisable
1188 #undef PRCMPeripheralRunDisable
1189 #define PRCMPeripheralRunDisable ROM_PRCMPeripheralRunDisable
1190 #endif
1191 #ifdef ROM_PRCMPeripheralSleepEnable
1192 #undef PRCMPeripheralSleepEnable
1193 #define PRCMPeripheralSleepEnable ROM_PRCMPeripheralSleepEnable
1194 #endif
1195 #ifdef ROM_PRCMPeripheralSleepDisable
1196 #undef PRCMPeripheralSleepDisable
1197 #define PRCMPeripheralSleepDisable ROM_PRCMPeripheralSleepDisable
1198 #endif
1199 #ifdef ROM_PRCMPeripheralDeepSleepEnable
1200 #undef PRCMPeripheralDeepSleepEnable
1201 #define PRCMPeripheralDeepSleepEnable ROM_PRCMPeripheralDeepSleepEnable
1202 #endif
1203 #ifdef ROM_PRCMPeripheralDeepSleepDisable
1204 #undef PRCMPeripheralDeepSleepDisable
1205 #define PRCMPeripheralDeepSleepDisable ROM_PRCMPeripheralDeepSleepDisable
1206 #endif
1207 #ifdef ROM_PRCMPowerDomainStatus
1208 #undef PRCMPowerDomainStatus
1209 #define PRCMPowerDomainStatus ROM_PRCMPowerDomainStatus
1210 #endif
1211 #ifdef ROM_PRCMDeepSleep
1212 #undef PRCMDeepSleep
1213 #define PRCMDeepSleep ROM_PRCMDeepSleep
1214 #endif
1215 #endif
1216
1217 //*****************************************************************************
1218 //
1219 // Mark the end of the C bindings section for C++ compilers.
1220 //
1221 //*****************************************************************************
1222 #ifdef __cplusplus
1223 }
1224 #endif
1225
1226 #endif // __PRCM_H__
1227
1228 //*****************************************************************************
1229 //
1230 //! Close the Doxygen group.
1231 //! @}
1232 //! @}
1233 //
1234 //*****************************************************************************
1235