Skip to content

Commit

Permalink
cpu/cc26x0: cpu_clock_init() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent-Valéry authored and yogo1212 committed Apr 9, 2016
1 parent db363a9 commit 26f2700
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
27 changes: 26 additions & 1 deletion cpu/cc26x0/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@
* @}
*/

#include "cpu.h"
#include "cpu.h"
#include "periph_conf.h"

#ifndef HF_CLOCK_SOURCE
#define HF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_RCOSC /* set 48MHz RCOSC */
#endif
#ifndef LF_CLOCK_SOURCE
#define LF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_LF_SRC_SEL_HF_RCOSC /* set 31.25kHz derived from 48MHz RCOSC */
#endif

/**
*@brief Configure the MCU system clock
*/
static void cpu_clock_init(void);

/**
* @brief Initialize the CPU, set IRQ priorities
Expand All @@ -26,4 +39,16 @@ void cpu_init(void)
{
/* initialize the Cortex-M core */
cortexm_init();

/* initialize the system clock */
cpu_clock_init();
}

static void cpu_clock_init(void)
{
AON_WUC->AUXCTL |= AUXCTL_AUX_FORCE_ON; /* power on AUX_PD */
while(!(AON_WUC->PWRSTAT & PWRSTAT_AUX_PD_ON)); /* wait for AUX_PD to be powered on */
AUX_WUC->MODCLKEN0 |= MODCLKEN0_AUX_DDI0_OSC_EN; /* turn on oscillator interface clock */

DDI_0_OSC->CTL0 |= HF_CLOCK_SOURCE | LF_CLOCK_SOURCE; /* configure HF and LF clocks */
}
8 changes: 8 additions & 0 deletions cpu/cc26x0/include/cc26x0_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ typedef struct {
* @brief AUX_WUC register values
* @{
*/
#define MODCLKEN0_SMPH_EN 0x00000001 /* enable clock for AUX_SMPH */
#define MODCLKEN0_AIODIO0_EN 0x00000002 /* enable clock for AUX_AIODIO0 */
#define MODCLKEN0_AIODIO1_EN 0x00000004 /* enable clock for AUX_AIODIO1 */
#define MODCLKEN0_TIMER_EN 0x00000008 /* enable clock for AUX_TIMER */
#define MODCLKEN0_ANAIF_EN 0x00000010 /* enable clock for AUX_ANAIF */
#define MODCLKEN0_TDC_EN 0x00000020 /* enable clock for AUX_TDC */
#define MODCLKEN0_AUX_DDI0_OSC_EN 0x00000040 /* enable clock for AUX_DDI0_OSC */
#define MODCLKEN0_AUX_ADI4_EN 0x00000080 /* enable clock for AUX_ADI4 */
/** @} */

/** @ingroup cpu_specific_peripheral_memory_map
Expand Down

0 comments on commit 26f2700

Please sign in to comment.