Skip to content

Commit

Permalink
squash kw41z/cpu.c cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Nohlgård committed Jun 21, 2017
1 parent 6ea0c37 commit 00d9be2
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions cpu/kw41z/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,19 @@
#include "cpu_conf.h"
#include "periph/init.h"

static void cpu_clock_init(void);

/**
* @brief Initialize the CPU, set IRQ priorities
*/
void cpu_init(void)
{
/* initialize the Cortex-M core */
cortexm_init();
/* initialize the clock system */
cpu_clock_init();
/* Clear LLS protection */
/* Clear VLPS, VLPW, VLPR protection */
/* Note: This register can only be written once after each reset, so we must
* enable all power modes that we wish to use. */
SMC->PMPROT |= SMC_PMPROT_ALLS_MASK | SMC_PMPROT_AVLP_MASK;

/* trigger static peripheral initialization */
periph_init();
}

/**
* @brief Configure the clock prescalers
*
* | Clock name | Run mode frequency (max) | VLPR mode frequency (max) |
*
* | Core | 48 MHz | 4 MHz |
* | System | 48 MHz | 4 MHz |
* | Bus | 24 MHz | 1 MHz or 800 KHz |
* | Flash | 24 MHz | 1 MHz or 800 KHz |
*/
static void cpu_clock_init(void)
{
/* setup system prescalers */
/* TODO: Make this configurable */
SIM->CLKDIV1 = (uint32_t)SIM_CLKDIV1_OUTDIV4(1);
}

0 comments on commit 00d9be2

Please sign in to comment.