Atmel Software Framework

samg/genclk.h File Reference

Chip-specific generic clock management.

Copyright (c) 2013-2016 Atmel Corporation. All rights reserved.

#include <osc.h>
#include <pll.h>

Data Structures

struct  genclk_config
 Hardware representation of a set of generic clock parameters. More...
 

Macros

Programmable Clock Identifiers (PCK)
#define GENCLK_PCK_0   0
 PCK0 ID. More...
 
#define GENCLK_PCK_1   1
 PCK1 ID. More...
 
#define GENCLK_PCK_2   2
 PCK2 ID. More...
 

Enumerations

enum  genclk_source {
  GENCLK_PCK_SRC_SLCK_RC = 0,
  GENCLK_PCK_SRC_SLCK_XTAL = 1,
  GENCLK_PCK_SRC_SLCK_BYPASS = 2,
  GENCLK_PCK_SRC_MAINCK_8M_RC = 3,
  GENCLK_PCK_SRC_MAINCK_16M_RC = 4,
  GENCLK_PCK_SRC_MAINCK_24M_RC = 5,
  GENCLK_PCK_SRC_MAINCK_XTAL = 6,
  GENCLK_PCK_SRC_MAINCK_BYPASS = 7,
  GENCLK_PCK_SRC_PLLACK = 8,
  GENCLK_PCK_SRC_MCK = 9
}
 Generic clock source ID. More...
 
Programmable Clock Prescalers (PCK)
enum  genclk_divider {
  GENCLK_PCK_PRES_1 = PMC_MCKR_PRES_CLK_1,
  GENCLK_PCK_PRES_2 = PMC_MCKR_PRES_CLK_2,
  GENCLK_PCK_PRES_4 = PMC_MCKR_PRES_CLK_4,
  GENCLK_PCK_PRES_8 = PMC_MCKR_PRES_CLK_8,
  GENCLK_PCK_PRES_16 = PMC_MCKR_PRES_CLK_16,
  GENCLK_PCK_PRES_32 = PMC_MCKR_PRES_CLK_32,
  GENCLK_PCK_PRES_64 = PMC_MCKR_PRES_CLK_64
}
 

Functions

static void genclk_config_defaults (struct genclk_config *p_cfg, uint32_t ul_id)
 
static void genclk_config_read (struct genclk_config *p_cfg, uint32_t ul_id)
 
static void genclk_config_write (const struct genclk_config *p_cfg, uint32_t ul_id)
 
static void genclk_disable (uint32_t ul_id)
 
static void genclk_enable (const struct genclk_config *p_cfg, uint32_t ul_id)
 
Programmable Clock Source and Prescaler configuration
static void genclk_config_set_source (struct genclk_config *p_cfg, enum genclk_source e_src)
 Select a new source clock src in configuration cfg. More...
 
static void genclk_config_set_divider (struct genclk_config *p_cfg, uint32_t e_divider)
 
Generic clock configuration
static void genclk_enable_source (enum genclk_source e_src)
 Enable the source clock src used by a generic clock. More...