Kinetis SDK v.1.2 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fsl_clock_manager.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include "fsl_device_registers.h"
#include "fsl_sim_hal.h"

Data Structures

struct  oscer_config_t
 OSC configuration for OSCERCLK. More...
 
struct  osc_user_config_t
 OSC Initialization Configuration Structure. More...
 
struct  rtc_osc_user_config_t
 RTC OSC Initialization Configuration Structure. More...
 
struct  mcg_config_t
 MCG configure structure for mode change. More...
 
struct  clock_manager_user_config_t
 Clock configuration structure. More...
 
struct  clock_notify_struct_t
 Clock notification structure passed to clock callback function. More...
 
struct  clock_manager_callback_user_config_t
 Structure for callback function and its parameter. More...
 
struct  clock_manager_state_t
 Clock manager state structure. More...
 

Macros

#define CLOCK_USE_MCG   /* MCG is used. */
 
#define CPU_LPO_CLK_HZ   1000U
 Frequency of LPO. More...
 

Typedefs

typedef
clock_manager_error_code_t(* 
clock_manager_callback_t )(clock_notify_struct_t *notify, void *callbackData)
 Type of clock callback functions. More...
 

Enumerations

enum  clock_systick_src_t {
  kClockSystickSrcExtRef = 0U,
  kClockSystickSrcCore = 1U
}
 Systick clock source selection. More...
 
enum  clock_names_t {
  kCoreClock,
  kSystemClock,
  kPlatformClock,
  kBusClock,
  kFlexBusClock,
  kFlashClock,
  kFastPeripheralClock,
  kSystickClock,
  kOsc32kClock,
  kOsc0ErClock,
  kOsc1ErClock,
  kOsc0ErClockUndiv,
  kIrc48mClock,
  kRtcoutClock,
  kMcgFfClock,
  kMcgFllClock,
  kMcgPll0Clock,
  kMcgPll1Clock,
  kMcgExtPllClock,
  kMcgOutClock,
  kMcgIrClock,
  kLpoClock,
  kClockNameCount
}
 Clock name used to get clock frequency. More...
 
enum  clock_manager_error_code_t {
  kClockManagerSuccess,
  kClockManagerError,
  kClockManagerNoSuchClockName,
  kClockManagerInvalidParam,
  kClockManagerErrorOutOfRange,
  kClockManagerErrorNotificationBefore,
  kClockManagerErrorNotificationAfter,
  kClockManagerErrorUnknown
}
 Error code definition for the clock manager APIs. More...
 
enum  clock_manager_notify_t {
  kClockManagerNotifyRecover = 0x00U,
  kClockManagerNotifyBefore = 0x01U,
  kClockManagerNotifyAfter = 0x02U
}
 The clock notification type. More...
 
enum  clock_manager_callback_type_t {
  kClockManagerCallbackBefore = 0x01U,
  kClockManagerCallbackAfter = 0x02U,
  kClockManagerCallbackBeforeAfter = 0x03U
}
 The callback type, indicates what kinds of notification this callback handles. More...
 
enum  clock_manager_policy_t {
  kClockManagerPolicyAgreement,
  kClockManagerPolicyForcible
}
 Clock transition policy. More...
 

Functions

clock_manager_error_code_t CLOCK_SYS_GetFreq (clock_names_t clockName, uint32_t *frequency)
 Gets the clock frequency for a specific clock name. More...
 
uint32_t CLOCK_SYS_GetCoreClockFreq (void)
 Get core clock frequency. More...
 
uint32_t CLOCK_SYS_GetSystemClockFreq (void)
 Get system clock frequency. More...
 
uint32_t CLOCK_SYS_GetBusClockFreq (void)
 Get bus clock frequency. More...
 
uint32_t CLOCK_SYS_GetFlashClockFreq (void)
 Get flash clock frequency. More...
 
static uint32_t CLOCK_SYS_GetLpoClockFreq (void)
 Get LPO clock frequency. More...
 
static void CLOCK_SYS_SetSystickSrc (clock_systick_src_t src)
 Set Systick clock source SYST_CSR[CLKSOURCE]. More...
 
static uint32_t CLOCK_SYS_GetSystickFreq (void)
 Get Systick clock frequency. More...
 
Dynamic clock setting
clock_manager_error_code_t CLOCK_SYS_Init (clock_manager_user_config_t const **clockConfigsPtr, uint8_t configsNumber, clock_manager_callback_user_config_t **callbacksPtr, uint8_t callbacksNumber)
 Install pre-defined clock configurations. More...
 
clock_manager_error_code_t CLOCK_SYS_UpdateConfiguration (uint8_t targetConfigIndex, clock_manager_policy_t policy)
 Set system clock configuration according to pre-defined structure. More...
 
clock_manager_error_code_t CLOCK_SYS_SetConfiguration (clock_manager_user_config_t const *config)
 Set system clock configuration. More...
 
uint8_t CLOCK_SYS_GetCurrentConfiguration (void)
 Get current system clock configuration. More...
 
clock_manager_callback_user_config_tCLOCK_SYS_GetErrorCallback (void)
 Get the callback which returns error in last clock switch. More...
 
mcg_mode_error_t CLOCK_SYS_SetMcgMode (mcg_config_t const *targetConfig, void(*fllStableDelay)(void))
 Set MCG to some target mode. More...
 
OSC configuration
clock_manager_error_code_t CLOCK_SYS_OscInit (uint32_t instance, osc_user_config_t *config)
 Initialize OSC. More...
 
void CLOCK_SYS_OscDeinit (uint32_t instance)
 Deinitialize OSC. More...
 
void CLOCK_SYS_SetOscerConfigration (uint32_t instance, oscer_config_t const *config)
 Configure the OSCERCLK. More...
 

Variables

SIM_Type *const g_simBase []
 The register base of SIM module. More...
 
MCG_Type *const g_mcgBase []
 The register base of MCG/MCG_LITE module. More...
 
OSC_Type *const g_oscBase []
 The register base of OSC module. More...