#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_types.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_prcm.h"
#include "../inc/hw_nvic.h"
#include "../inc/hw_aon_rtc.h"
#include "interrupt.h"
#include "debug.h"
#include "cpu.h"
Macros | |
#define | PRCM_RUN_MODE 0x00000001 |
#define | PRCM_SLEEP_MODE 0x00000002 |
#define | PRCM_DEEP_SLEEP_MODE 0x00000004 |
#define | PRCM_CLOCK_DIV_1 PRCM_GPTCLKDIV_RATIO_DIV1 |
#define | PRCM_CLOCK_DIV_2 PRCM_GPTCLKDIV_RATIO_DIV2 |
#define | PRCM_CLOCK_DIV_4 PRCM_GPTCLKDIV_RATIO_DIV4 |
#define | PRCM_CLOCK_DIV_8 PRCM_GPTCLKDIV_RATIO_DIV8 |
#define | PRCM_CLOCK_DIV_16 PRCM_GPTCLKDIV_RATIO_DIV16 |
#define | PRCM_CLOCK_DIV_32 PRCM_GPTCLKDIV_RATIO_DIV32 |
#define | PRCM_CLOCK_DIV_64 PRCM_GPTCLKDIV_RATIO_DIV64 |
#define | PRCM_CLOCK_DIV_128 PRCM_GPTCLKDIV_RATIO_DIV128 |
#define | PRCM_CLOCK_DIV_256 PRCM_GPTCLKDIV_RATIO_DIV256 |
#define | PRCM_DOMAIN_RFCORE 0x00000001 |
#define | PRCM_DOMAIN_SERIAL 0x00000002 |
#define | PRCM_DOMAIN_PERIPH 0x00000004 |
#define | PRCM_DOMAIN_SYSBUS 0x00000008 |
#define | PRCM_DOMAIN_VIMS 0x00000010 |
#define | PRCM_DOMAIN_CPU 0x00000020 |
#define | PRCM_DOMAIN_TIMER 0x00000040 |
#define | PRCM_DOMAIN_CLKCTRL 0x00000080 |
#define | PRCM_DOMAIN_MCU 0x00000100 |
#define | PRCM_DOMAIN_POWER_OFF 0x00000002 |
#define | PRCM_DOMAIN_POWER_ON 0x00000001 |
#define | PRCM_DOMAIN_POWER_DOWN_READY 0x00000000 |
#define | PRCM_WCLK_NEG_EDGE 0x00000008 |
#define | PRCM_WCLK_POS_EDGE 0x00000000 |
#define | PRCM_WCLK_SINGLE_PHASE 0x00000000 |
#define | PRCM_WCLK_DUAL_PHASE 0x00000002 |
#define | PRCM_WCLK_USER_DEF 0x00000004 |
#define | PRCM_I2S_WCLK_NEG_EDGE 0 |
#define | PRCM_I2S_WCLK_POS_EDGE 1 |
#define | PRCM_I2S_WCLK_SINGLE_PHASE 0 |
#define | PRCM_I2S_WCLK_DUAL_PHASE 1 |
#define | PRCM_I2S_WCLK_USER_DEF 2 |
#define | I2S_SAMPLE_RATE_16K 0x00000001 |
#define | I2S_SAMPLE_RATE_24K 0x00000002 |
#define | I2S_SAMPLE_RATE_32K 0x00000004 |
#define | I2S_SAMPLE_RATE_48K 0x00000008 |
#define | PRCM_PERIPH_TIMER0 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S )) |
#define | PRCM_PERIPH_TIMER1 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 1 )) |
#define | PRCM_PERIPH_TIMER2 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 2 )) |
#define | PRCM_PERIPH_TIMER3 ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 3 )) |
#define | PRCM_PERIPH_SSI0 ( 0x00000100 | ( PRCM_SSICLKGR_CLK_EN_S )) |
#define | PRCM_PERIPH_SSI1 ( 0x00000100 | ( PRCM_SSICLKGR_CLK_EN_S + 1 )) |
#define | PRCM_PERIPH_UART0 ( 0x00000200 | ( PRCM_UARTCLKGR_CLK_EN_S )) |
#define | PRCM_PERIPH_I2C0 ( 0x00000300 | ( PRCM_I2CCLKGR_CLK_EN_S )) |
#define | PRCM_PERIPH_CRYPTO ( 0x00000400 | ( PRCM_SECDMACLKGR_CRYPTO_CLK_EN_S )) |
#define | PRCM_PERIPH_TRNG ( 0x00000400 | ( PRCM_SECDMACLKGR_TRNG_CLK_EN_S )) |
#define | PRCM_PERIPH_UDMA ( 0x00000400 | ( PRCM_SECDMACLKGR_DMA_CLK_EN_S )) |
#define | PRCM_PERIPH_GPIO ( 0x00000500 | ( PRCM_GPIOCLKGR_CLK_EN_S )) |
#define | PRCM_PERIPH_I2S ( 0x00000600 | ( PRCM_I2SCLKGR_CLK_EN_S )) |
Functions | |
void | PRCMInfClockConfigureSet (uint32_t ui32ClkDiv, uint32_t ui32PowerMode) |
Configure the infrastructure clock. More... | |
uint32_t | PRCMInfClockConfigureGet (uint32_t ui32PowerMode) |
Use this function to get the infrastructure clock configuration. More... | |
static void | PRCMMcuPowerOff (void) |
Request a power off of the MCU voltage domain. More... | |
static void | PRCMMcuPowerOffCancel (void) |
Cancel a request for a power off of the MCU voltage domain. More... | |
static void | PRCMMcuUldoConfigure (uint32_t ui32Enable) |
Assert or de-assert a request for the uLDO. More... | |
static void | PRCMGPTimerClockDivisionSet (uint32_t clkDiv) |
Setup the clock division factor for the GP-Timer domain. More... | |
static uint32_t | PRCMGPTimerClockDivisionGet (void) |
Get the clock division factor for the GP-Timer domain. More... | |
static void | PRCMAudioClockEnable (void) |
Enable the audio clock generation. More... | |
static void | PRCMAudioClockDisable (void) |
Disable the audio clock generation. More... | |
void | PRCMAudioClockConfigSet (uint32_t ui32ClkConfig, uint32_t ui32SampleRate) |
Configure the audio clock generation. More... | |
void | PRCMAudioClockConfigSetOverride (uint32_t ui32ClkConfig, uint32_t ui32MstDiv, uint32_t ui32BitDiv, uint32_t ui32WordDiv) |
Configure the audio clock generation with manual setting of clock divider. More... | |
void | PRCMAudioClockConfigOverride (uint8_t ui8SamplingEdge, uint8_t ui8WCLKPhase, uint32_t ui32MstDiv, uint32_t ui32BitDiv, uint32_t ui32WordDiv) |
Configure the audio clocks for I2S module. More... | |
void | PRCMAudioClockInternalSource (void) |
Configure the audio clocks to be internally generated. More... | |
void | PRCMAudioClockExternalSource (void) |
Configure the audio clocks to be externally generated. More... | |
static void | PRCMLoadSet (void) |
Use this function to synchronize the load settings. More... | |
static bool | PRCMLoadGet (void) |
Check if any of the load sensitive register has been updated. More... | |
static void | PRCMDomainEnable (uint32_t ui32Domains) |
Enable clock domains in the MCU voltage domain. More... | |
static void | PRCMDomainDisable (uint32_t ui32Domains) |
Disable clock domains in the MCU voltage domain. More... | |
void | PRCMPowerDomainOn (uint32_t ui32Domains) |
Turn power on in power domains in the MCU domain. More... | |
void | PRCMPowerDomainOff (uint32_t ui32Domains) |
Turn off a specific power domain. More... | |
static void | PRCMRfPowerDownWhenIdle (void) |
Configure RF core to power down when idle. More... | |
void | PRCMPeripheralRunEnable (uint32_t ui32Peripheral) |
Enables a peripheral in Run mode. More... | |
void | PRCMPeripheralRunDisable (uint32_t ui32Peripheral) |
Disables a peripheral in Run mode. More... | |
void | PRCMPeripheralSleepEnable (uint32_t ui32Peripheral) |
Enables a peripheral in sleep mode. More... | |
void | PRCMPeripheralSleepDisable (uint32_t ui32Peripheral) |
Disables a peripheral in sleep mode. More... | |
void | PRCMPeripheralDeepSleepEnable (uint32_t ui32Peripheral) |
Enables a peripheral in deep-sleep mode. More... | |
void | PRCMPeripheralDeepSleepDisable (uint32_t ui32Peripheral) |
Disables a peripheral in deep-sleep mode. More... | |
uint32_t | PRCMPowerDomainStatus (uint32_t ui32Domains) |
Get the status for a specific power domain. More... | |
static bool | PRCMRfReady (void) |
Return the access status of the RF Core. More... | |
static void | PRCMSleep (void) |
Put the processor into sleep mode. More... | |
void | PRCMDeepSleep (void) |
Put the processor into deep-sleep mode. More... | |
static void | PRCMCacheRetentionEnable (void) |
Enable CACHE RAM retention. More... | |
static void | PRCMCacheRetentionDisable (void) |
Disable CACHE RAM retention. More... | |