cc2538: Allow for configuration of processor speed
This commit is contained in:
parent
730bda2001
commit
d8efa8428c
7 changed files with 107 additions and 38 deletions
|
@ -70,17 +70,18 @@ sys_ctrl_init()
|
|||
* 32KHz source: RC or crystal, according to SYS_CTRL_OSC32K_USE_XTAL
|
||||
* System Clock: 32 MHz
|
||||
* Power Down Unused
|
||||
* I/O Div: 16MHz
|
||||
* Sys Div: 16MHz
|
||||
* I/O Div: according to SYS_CTRL_IO_DIV
|
||||
* Sys Div: according to SYS_CTRL_SYS_DIV
|
||||
* Rest: Don't care
|
||||
*/
|
||||
|
||||
val = SYS_CTRL_OSCS | SYS_CTRL_CLOCK_CTRL_OSC_PD
|
||||
| SYS_CTRL_CLOCK_CTRL_IO_DIV_16MHZ | SYS_CTRL_CLOCK_CTRL_SYS_DIV_16MHZ;
|
||||
| SYS_CTRL_IO_DIV | SYS_CTRL_SYS_DIV;
|
||||
REG(SYS_CTRL_CLOCK_CTRL) = val;
|
||||
|
||||
while((REG(SYS_CTRL_CLOCK_STA) & (SYS_CTRL_CLOCK_STA_OSC32K |
|
||||
SYS_CTRL_CLOCK_STA_OSC)) != SYS_CTRL_OSCS);
|
||||
while((REG(SYS_CTRL_CLOCK_STA)
|
||||
& (SYS_CTRL_CLOCK_STA_OSC32K | SYS_CTRL_CLOCK_STA_OSC))
|
||||
!= SYS_CTRL_OSCS);
|
||||
|
||||
#if SYS_CTRL_OSC32K_USE_XTAL
|
||||
/* Wait for the 32-kHz crystal oscillator to stabilize */
|
||||
|
@ -94,7 +95,20 @@ sys_ctrl_reset()
|
|||
{
|
||||
REG(SYS_CTRL_PWRDBG) = SYS_CTRL_PWRDBG_FORCE_WARM_RESET;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
uint32_t
|
||||
sys_ctrl_get_sys_clock(void)
|
||||
{
|
||||
return SYS_CTRL_32MHZ >> (REG(SYS_CTRL_CLOCK_STA) &
|
||||
SYS_CTRL_CLOCK_STA_SYS_DIV);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
uint32_t
|
||||
sys_ctrl_get_io_clock(void)
|
||||
{
|
||||
return SYS_CTRL_32MHZ >> ((REG(SYS_CTRL_CLOCK_STA) &
|
||||
SYS_CTRL_CLOCK_STA_IO_DIV) >> 8);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue