Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fsl_sim_hal_MKL02Z4.h File Reference

Macros

#define FSL_SIM_SCGC_BIT(SCGCx, n)   (((SCGCx-1U)<<5U) + n)
 SIM SCGC bit index. More...
 

Enumerations

enum  clock_cop_src_kl02z4_t {
  kClockCopSrcLpoClk,
  kClockCopSrcAltClk
}
 COP clock source select. More...
 
enum  clock_tpm_src_kl02z4_t {
  kClockTpmSrcNone,
  kClockTpmSrcFll,
  kClockTpmSrcOsc0erClk,
  kClockTpmSrcMcgIrClk
}
 TPM clock source select. More...
 
enum  clock_lptmr_src_kl02z4_t {
  kClockLptmrSrcMcgIrClk,
  kClockLptmrSrcLpoClk,
  kClockLptmrSrcEr32kClk,
  kClockLptmrSrcOsc0erClk
}
 LPTMR clock source select. More...
 
enum  clock_lpsci_src_kl02z4_t {
  kClockLpsciSrcNone,
  kClockLpsciSrcFll,
  kClockLpsciSrcOsc0erClk,
  kClockLpsciSrcMcgIrClk
}
 UART0 clock source select. More...
 
enum  clock_clkout_src_kl02z4_t {
  kClockClkoutReserved = 0U,
  kClockClkoutReserved1 = 1U,
  kClockClkoutBusClk = 2U,
  kClockClkoutLpoClk = 3U,
  kClockClkoutMcgIrClk = 4U,
  kClockClkoutReserved2 = 5U,
  kClockClkoutOsc0erClk = 6U,
  kClockClkoutReserved3 = 7U
}
 SIM CLKOUT_SEL clock source select. More...
 
enum  sim_adc_pretrg_sel_kl02z4_t {
  kSimAdcPretrgselA,
  kSimAdcPretrgselB
}
 SIM ADCx pre-trigger select. More...
 
enum  sim_adc_trg_sel_kl02z4_t {
  kSimAdcTrgselExt = 0U,
  kSimAdcTrgSelComp0 = 1U,
  kSimAdcTrgSelReserved2 = 2U,
  kSimAdcTrgSelReserved3 = 3U,
  kSimAdcTrgSelReserved4 = 4U,
  kSimAdcTrgSelReserved5 = 5U,
  kSimAdcTrgSelReserved6 = 6U,
  kSimAdcTrgSelReserved7 = 7U,
  kSimAdcTrgSelTpm0 = 8U,
  kSimAdcTrgSelTpm1 = 9U,
  kSimAdcTrgSelReserved10 = 10U,
  kSimAdcTrgSelReserved11 = 11U,
  kSimAdcTrgSelReserved12 = 12U,
  kSimAdcTrgSelReserved13 = 13U,
  kSimAdcTrgSelLptimer = 14U,
  kSimAdcTrgSelReserved15 = 15U
}
 SIM ADCx trigger select. More...
 
enum  sim_lpsci_rxsrc_kl02z4_t {
  kSimLpsciRxsrcPin,
  kSimLpsciRxsrcCmp0
}
 SIM LPSCI receive data source select. More...
 
enum  sim_lpsci_txsrc_kl02z4_t {
  kSimLpsciTxsrcPin,
  kSimLpsciTxsrcTpm1
}
 SIM LPSCI transmit data source select. More...
 
enum  sim_tpm_clk_sel_kl02z4_t {
  kSimTpmClkSel0,
  kSimTpmClkSel1
}
 SIM Timer/PWM external clock select. More...
 
enum  sim_tpm_ch_src_kl02z4_t {
  kSimTpmChSrc0,
  kSimTpmChSrc1
}
 SIM Timer/PWM x channel y input capture source select. More...
 
enum  sim_clock_gate_name_kl02z4_t {
  kSimClockGateI2c0 = FSL_SIM_SCGC_BIT(4U, 6U),
  kSimClockGateI2c1 = FSL_SIM_SCGC_BIT(4U, 7U),
  kSimClockGateLpsci0 = FSL_SIM_SCGC_BIT(4U, 10U),
  kSimClockGateCmp0 = FSL_SIM_SCGC_BIT(4U, 19U),
  kSimClockGateSpi0 = FSL_SIM_SCGC_BIT(4U, 22U),
  kSimClockGateLptmr0 = FSL_SIM_SCGC_BIT(5U, 0U),
  kSimClockGatePortA = FSL_SIM_SCGC_BIT(5U, 9U),
  kSimClockGatePortB = FSL_SIM_SCGC_BIT(5U, 10U),
  kSimClockGateFtf0 = FSL_SIM_SCGC_BIT(6U, 0U),
  kSimClockGateTpm0 = FSL_SIM_SCGC_BIT(6U, 24U),
  kSimClockGateTpm1 = FSL_SIM_SCGC_BIT(6U, 25U),
  kSimClockGateAdc0 = FSL_SIM_SCGC_BIT(6U, 27U)
}
 Clock gate name used for SIM_HAL_EnableClock/SIM_HAL_DisableClock. More...
 

Functions

static void SIM_HAL_EnableClock (SIM_Type *base, sim_clock_gate_name_t name)
 Enable the clock for specific module. More...
 
static void SIM_HAL_DisableClock (SIM_Type *base, sim_clock_gate_name_t name)
 Disable the clock for specific module. More...
 
static bool SIM_HAL_GetGateCmd (SIM_Type *base, sim_clock_gate_name_t name)
 Get the the clock gate state for specific module. More...
 
static void CLOCK_HAL_SetTpmSrc (SIM_Type *base, uint32_t instance, clock_tpm_src_t setting)
 Set the TPM clock source selection. More...
 
static clock_tpm_src_t CLOCK_HAL_GetTpmSrc (SIM_Type *base, uint32_t instance)
 Get the TPM clock source selection. More...
 
static void CLOCK_HAL_SetLpsciSrc (SIM_Type *base, uint32_t instance, clock_lpsci_src_t setting)
 Set the LPSCI clock source selection. More...
 
static clock_lpsci_src_t CLOCK_HAL_GetLpsciSrc (SIM_Type *base, uint32_t instance)
 Get the LPSCI clock source selection. More...
 
static void CLOCK_HAL_SetOutDiv1 (SIM_Type *base, uint8_t setting)
 Set OUTDIV1. More...
 
static uint8_t CLOCK_HAL_GetOutDiv1 (SIM_Type *base)
 Get OUTDIV1. More...
 
static void CLOCK_HAL_SetOutDiv4 (SIM_Type *base, uint8_t setting)
 Set OUTDIV4. More...
 
static uint8_t CLOCK_HAL_GetOutDiv4 (SIM_Type *base)
 Get OUTDIV4. More...
 
static void SIM_HAL_SetLpsciRxSrcMode (SIM_Type *base, uint32_t instance, sim_lpsci_rxsrc_t select)
 Sets the LPSCIx receive data source select setting. More...
 
static sim_lpsci_rxsrc_t SIM_HAL_GetLpsciRxSrcMode (SIM_Type *base, uint32_t instance)
 Gets the LPSCIx receive data source select setting. More...
 
static void SIM_HAL_SetLpsciTxSrcMode (SIM_Type *base, uint32_t instance, sim_lpsci_txsrc_t select)
 Sets the LPSCIx transmit data source select setting. More...
 
static sim_lpsci_txsrc_t SIM_HAL_GetLpsciTxSrcMode (SIM_Type *base, uint32_t instance)
 Gets the LPSCIx transmit data source select setting. More...
 
static uint32_t SIM_HAL_GetFamilyId (SIM_Type *base)
 Gets the Kinetis Family ID in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetSubFamilyId (SIM_Type *base)
 Gets the Kinetis Sub-Family ID in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetSeriesId (SIM_Type *base)
 Gets the Kinetis SeriesID in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetSramSize (SIM_Type *base)
 Gets the Kinetis SramSize in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetPinCntId (SIM_Type *base)
 Gets the Kinetis Pincount ID in System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetRevId (SIM_Type *base)
 Gets the Kinetis Revision ID in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetDieId (SIM_Type *base)
 Gets the Kinetis Die ID in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetProgramFlashSize (SIM_Type *base)
 Gets the program flash size in the Flash Configuration Register 1 (SIM_FCFG). More...
 
static void SIM_HAL_SetFlashDoze (SIM_Type *base, uint32_t setting)
 Sets the Flash Doze in the Flash Configuration Register 1 (SIM_FCFG). More...
 
static uint32_t SIM_HAL_GetFlashDoze (SIM_Type *base)
 Gets the Flash Doze in the Flash Configuration Register 1 (SIM_FCFG). More...
 
static void SIM_HAL_SetFlashDisableCmd (SIM_Type *base, bool disable)
 Sets the Flash disable setting. More...
 
static bool SIM_HAL_GetFlashDisableCmd (SIM_Type *base)
 Gets the Flash disable setting. More...
 
static uint32_t SIM_HAL_GetFlashMaxAddrBlock0 (SIM_Type *base)
 Gets the Flash maximum address block 0 in the Flash Configuration Register 1 (SIM_FCFG). More...
 
IP related clock feature APIs
void CLOCK_HAL_SetOutDiv (SIM_Type *base, uint8_t outdiv1, uint8_t outdiv2, uint8_t outdiv3, uint8_t outdiv4)
 Sets the clock out dividers setting. More...
 
void CLOCK_HAL_GetOutDiv (SIM_Type *base, uint8_t *outdiv1, uint8_t *outdiv2, uint8_t *outdiv3, uint8_t *outdiv4)
 Gets the clock out dividers setting. More...
 
void SIM_HAL_SetAdcAlternativeTriggerCmd (SIM_Type *base, uint32_t instance, bool enable)
 Sets the ADCx alternate trigger enable setting. More...
 
bool SIM_HAL_GetAdcAlternativeTriggerCmd (SIM_Type *base, uint32_t instance)
 Gets the ADCx alternate trigger enable setting. More...
 
void SIM_HAL_SetAdcPreTriggerMode (SIM_Type *base, uint32_t instance, sim_adc_pretrg_sel_t select)
 Sets the ADCx pre-trigger select setting. More...
 
sim_adc_pretrg_sel_t SIM_HAL_GetAdcPreTriggerMode (SIM_Type *base, uint32_t instance)
 Gets the ADCx pre-trigger select setting. More...
 
void SIM_HAL_SetAdcTriggerMode (SIM_Type *base, uint32_t instance, sim_adc_trg_sel_t select)
 Sets the ADCx trigger select setting. More...
 
sim_adc_trg_sel_t SIM_HAL_GetAdcTriggerMode (SIM_Type *base, uint32_t instance)
 Gets the ADCx trigger select setting. More...
 
void SIM_HAL_SetAdcTriggerModeOneStep (SIM_Type *base, uint32_t instance, bool altTrigEn, sim_adc_pretrg_sel_t preTrigSel, sim_adc_trg_sel_t trigSel)
 Sets the ADCx trigger select setting in one function. More...
 

Function Documentation

static void SIM_HAL_EnableClock ( SIM_Type *  base,
sim_clock_gate_name_t  name 
)
inlinestatic

This function enables the clock for specific module.

Parameters
baseBase address for current SIM instance.
nameName of the module to enable.
static void SIM_HAL_DisableClock ( SIM_Type *  base,
sim_clock_gate_name_t  name 
)
inlinestatic

This function disables the clock for specific module.

Parameters
baseBase address for current SIM instance.
nameName of the module to disable.
static bool SIM_HAL_GetGateCmd ( SIM_Type *  base,
sim_clock_gate_name_t  name 
)
inlinestatic

This function will get the clock gate state for specific module.

Parameters
baseBase address for current SIM instance.
nameName of the module to get.
Returns
state true - ungated(Enabled), false - gated (Disabled)
static void CLOCK_HAL_SetTpmSrc ( SIM_Type *  base,
uint32_t  instance,
clock_tpm_src_t  setting 
)
inlinestatic

This function sets the TPM clock source selection.

Parameters
baseBase address for current SIM instance.
instanceIP instance.
settingThe value to set.
static clock_tpm_src_t CLOCK_HAL_GetTpmSrc ( SIM_Type *  base,
uint32_t  instance 
)
inlinestatic

This function gets the TPM clock source selection.

Parameters
baseBase address for current SIM instance.
instanceIP instance.
Returns
Current selection.
static void CLOCK_HAL_SetOutDiv1 ( SIM_Type *  base,
uint8_t  setting 
)
inlinestatic

This function sets divide value OUTDIV1.

Parameters
baseBase address for current SIM instance.
settingThe value to set.
static uint8_t CLOCK_HAL_GetOutDiv1 ( SIM_Type *  base)
inlinestatic

This function gets divide value OUTDIV1.

Parameters
baseBase address for current SIM instance.
Returns
Current divide value.
static void CLOCK_HAL_SetOutDiv4 ( SIM_Type *  base,
uint8_t  setting 
)
inlinestatic

This function sets divide value OUTDIV4.

Parameters
baseBase address for current SIM instance.
settingThe value to set.
static uint8_t CLOCK_HAL_GetOutDiv4 ( SIM_Type *  base)
inlinestatic

This function gets divide value OUTDIV4.

Parameters
baseBase address for current SIM instance.
Returns
Current divide value.
static uint32_t SIM_HAL_GetFamilyId ( SIM_Type *  base)
inlinestatic

This function gets the Kinetis Family ID in the System Device ID register.

Parameters
baseBase address for current SIM instance.
Returns
id Kinetis Family ID
static uint32_t SIM_HAL_GetSubFamilyId ( SIM_Type *  base)
inlinestatic

This function gets the Kinetis Sub-Family ID in System Device ID register.

Parameters
baseBase address for current SIM instance.
Returns
id Kinetis Sub-Family ID
static uint32_t SIM_HAL_GetSeriesId ( SIM_Type *  base)
inlinestatic

This function gets the Kinetis Series ID in System Device ID register.

Parameters
baseBase address for current SIM instance.
Returns
id Kinetis Series ID
static uint32_t SIM_HAL_GetPinCntId ( SIM_Type *  base)
inlinestatic

This function gets the Kinetis Pincount ID in System Device ID register.

Parameters
baseBase address for current SIM instance.
Returns
id Kinetis Pincount ID
static uint32_t SIM_HAL_GetRevId ( SIM_Type *  base)
inlinestatic

This function gets the Kinetis Revision ID in System Device ID register.

Parameters
baseBase address for current SIM instance.
Returns
id Kinetis Revision ID
static uint32_t SIM_HAL_GetDieId ( SIM_Type *  base)
inlinestatic

This function gets the Kinetis Die ID in System Device ID register.

Parameters
baseBase address for current SIM instance.
Returns
id Kinetis Die ID
static uint32_t SIM_HAL_GetProgramFlashSize ( SIM_Type *  base)
inlinestatic

This function gets the program flash size in the Flash Configuration Register 1.

Parameters
baseBase address for current SIM instance.
Returns
size Program flash Size
static void SIM_HAL_SetFlashDoze ( SIM_Type *  base,
uint32_t  setting 
)
inlinestatic

This function sets the Flash Doze in the Flash Configuration Register 1.

Parameters
baseBase address for current SIM instance.
settingFlash Doze setting
static uint32_t SIM_HAL_GetFlashDoze ( SIM_Type *  base)
inlinestatic

This function gets the Flash Doze in the Flash Configuration Register 1.

Parameters
baseBase address for current SIM instance.
Returns
setting Flash Doze setting
static void SIM_HAL_SetFlashDisableCmd ( SIM_Type *  base,
bool  disable 
)
inlinestatic

This function sets the Flash disable setting in the Flash Configuration Register 1.

Parameters
baseBase address for current SIM instance.
disableFlash disable setting
static bool SIM_HAL_GetFlashDisableCmd ( SIM_Type *  base)
inlinestatic

This function gets the Flash disable setting in the Flash Configuration Register 1.

Parameters
baseBase address for current SIM instance.
Returns
setting Flash disable setting
static uint32_t SIM_HAL_GetFlashMaxAddrBlock0 ( SIM_Type *  base)
inlinestatic

This function gets the Flash maximum block 0 in Flash Configuration Register 2.

Parameters
baseBase address for current SIM instance.
Returns
address Flash maximum block 0 address