S32 SDK
sim_hal_S32K144.h File Reference
#include "device_registers.h"
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  sim_clock_out_config_t
 SIM ClockOut configuration. Implements sim_clock_out_config_t_Class. More...
 
struct  sim_lpo_clock_config_t
 SIM LPO Clocks configuration. Implements sim_lpo_clock_config_t_Class. More...
 
struct  sim_plat_gate_config_t
 SIM Platform Gate Clock configuration. Implements sim_plat_gate_config_t_Class. More...
 
struct  sim_tclk_config_t
 SIM Platform Gate Clock configuration. Implements sim_tclk_config_t_Class. More...
 
struct  sim_trace_clock_config_t
 SIM Debug Trace clock configuration. Implements sim_trace_clock_config_t_Class. More...
 
struct  sim_clock_config_t
 SIM configure structure. Implements sim_clock_config_t_Class. More...
 

Macros

#define NUMBER_OF_TCLK_INPUTS   3U
 

Enumerations

enum  sim_adc_supply_src_t {
  ADC_SUPPLY_VDD = 0U, ADC_SUPPLY_VDDA = 1U, ADC_SUPPLY_VREFH = 2U, ADC_SUPPLY_VDD_3V = 3U,
  ADC_SUPPLY_VDD_FLASH_3V = 4U, ADC_SUPPLY_LV = 5U
}
 Internal supplies monitored by ADC_SUPPLY Implements sim_adc_supply_src_t_Class. More...
 
enum  clock_trace_src_t { CLOCK_TRACE_SRC_CORE_CLK, CLOCK_TRACE_SRC_PLATFORM_CLK }
 Debug trace clock source select Implements clock_trace_src_t_Class. More...
 
enum  sim_pdb_bb_src_t { PDB_BACK_TO_BACK_OPTION_0, PDB_BACK_TO_BACK_OPTION_1 }
 PDB back-to-back select Implements sim_pdb_bb_src_t_Class. More...
 
enum  sim_clkout_src_t {
  SIM_CLKOUT_SEL_SYSTEM_SCG_CLKOUT = 0U, SIM_CLKOUT_SEL_SYSTEM_SOSC_DIV2_CLK = 2U, SIM_CLKOUT_SEL_SYSTEM_SIRC_DIV2_CLK = 4U, SIM_CLKOUT_SEL_SYSTEM_FIRC_DIV2_CLK = 6U,
  SIM_CLKOUT_SEL_SYSTEM_SPLL_DIV2_CLK = 8U, SIM_CLKOUT_SEL_SYSTEM_LPO_128K_CLK = 10U, SIM_CLKOUT_SEL_SYSTEM_LPO_CLK = 12U, SIM_CLKOUT_SEL_SYSTEM_RTC_CLK = 14U
}
 SIM CLKOUT select Implements sim_clkout_src_t_Class. More...
 
enum  sim_clkout_div_t {
  SIM_CLKOUT_DIV_BY_1 = 0U, SIM_CLKOUT_DIV_BY_2 = 1U, SIM_CLKOUT_DIV_BY_3 = 2U, SIM_CLKOUT_DIV_BY_4 = 3U,
  SIM_CLKOUT_DIV_BY_5 = 4U, SIM_CLKOUT_DIV_BY_6 = 5U, SIM_CLKOUT_DIV_BY_7 = 6U, SIM_CLKOUT_DIV_BY_8 = 7U
}
 SIM CLKOUT divider Implements sim_clkout_div_t_Class. More...
 
enum  sim_ftm_clk_sel_t { SIM_FTM_CLK_SEL_00 = 0U, SIM_FTM_CLK_SEL_01 = 1U, SIM_FTM_CLK_SEL_10 = 2U, SIM_FTM_CLK_SEL_11 = 3U }
 SIM FlexTimer external clock select Implements sim_ftm_clk_sel_t_Class. More...
 
enum  sim_rtc_clk_sel_src_t { SIM_RTCCLK_SEL_SOSCDIV1_CLK, SIM_RTCCLK_SEL_LPO_32K, SIM_RTCCLK_SEL_RTC_CLKIN, SIM_RTCCLK_SEL_FIRCDIV1_CLK }
 SIM CLK32KSEL clock source select Implements sim_rtc_clk_sel_src_t_Class. More...
 
enum  sim_lpoclk_sel_src_t { SIM_LPO_CLK_SEL_LPO_128K, SIM_LPO_CLK_SEL_NO_CLOCK, SIM_LPO_CLK_SEL_LPO_32K, SIM_LPO_CLK_SEL_LPO_1K }
 SIM LPOCLKSEL clock source select Implements sim_lpoclk_sel_src_t_Class. More...
 
enum  sim_adc_pretrg_sel_t { SIM_ADC_PRETRG_SEL_PDB, SIM_ADC_PRETRG_SEL_TRGMUX, SIM_ADC_PRETRG_SEL_SOFTWARE, SIM_ADC_PRETRG_SEL_RESERVED }
 SIM ADCx pre-trigger select Implements sim_adc_pretrg_sel_t_Class. More...
 
enum  sim_adc_sw_pretrg_sel_t {
  SIM_ADC_SW_PRETRG_SEL_DISABLED = 0U, SIM_ADC_SW_PRETRG_SEL_RESERVED0 = 1U, SIM_ADC_SW_PRETRG_SEL_RESERVED1 = 2U, SIM_ADC_SW_PRETRG_SEL_RESERVED2 = 3U,
  SIM_ADC_SW_PRETRG_SEL_0 = 4U, SIM_ADC_SW_PRETRG_SEL_1 = 5U, SIM_ADC_SW_PRETRG_SEL_2 = 6U, SIM_ADC_SW_PRETRG_SEL_3 = 7U
}
 SIM ADCx software pre-trigger select Implements sim_adc_sw_pretrg_sel_t_Class. More...
 
enum  sim_adc_trg_sel_t { SIM_ADC_TRG_SEL_PDB = 0U, SIM_ADC_TRG_SEL_TRGMUX = 1U }
 SIM ADCx trigger select Implements sim_adc_trg_sel_t_Class. More...
 
enum  sim_ftm_ch_out_src_t { SIM_FTM_CH_OUT_SRC_0, SIM_FTM_CH_OUT_SRC_1 }
 SIM FlexTimer x channel y output source select Implements sim_ftm_ch_out_src_t_Class. More...
 
enum  sim_ftm_ch_src_t { SIM_FTM_CH_SRC_0 = 0U, SIM_FTM_CH_SRC_1 = 1U, SIM_FTM_CH_SRC_2 = 2U, SIM_FTM_CH_SRC_3 = 3U }
 SIM FlexTimer x channel y input source select Implements sim_ftm_ch_src_t_Class. More...
 
enum  sim_ram_size_t { SIM_RAM_SIZE_48KB = 0xDU, SIM_RAM_SIZE_64KB = 0xFU }
 SIM RAM size Implements sim_ram_size_t_Class. More...
 
enum  sim_package_t { SIM_PACKAGE_64_LQFP = 0x3U, SIM_PACKAGE_100_LQFP = 0x4U, SIM_PACKAGE_100_MAP_BGA = 0x8U }
 SIM Package Implements sim_package_t_Class. More...
 
enum  sim_features_t { SIM_FEATURE_FLEXIO = (1U << 5U), SIM_FEATURE_ISO_CAN_FD = (1U << 6U), SIM_FEATURE_SECURITY = (1U << 7U) }
 SIM Features Implements sim_features_t_Class. More...
 
enum  sim_eee_sram_size_t {
  SIM_EEE_SRAM_SIZE_4KB = 0x2U, SIM_EEE_SRAM_SIZE_2KB = 0x3U, SIM_EEE_SRAM_SIZE_1KB = 0x4U, SIM_EEE_SRAM_SIZE_512B = 0x5U,
  SIM_EEE_SRAM_SIZE_256B = 0x6U, SIM_EEE_SRAM_SIZE_128B = 0x7U, SIM_EEE_SRAM_SIZE_64B = 0x8U, SIM_EEE_SRAM_SIZE_32B = 0x9U
}
 SIM EEE SRAM Size Implements sim_eee_sram_size_t_Class. More...
 
enum  sim_flexnvm_partition_t {
  SIM_DEPART_0000 = 0x0U, SIM_DEPART_0011 = 0x3U, SIM_DEPART_0100 = 0x4U, SIM_DEPART_1000 = 0x8U,
  SIM_DEPART_1010 = 0xAU, SIM_DEPART_1011 = 0xBU, SIM_DEPART_1100 = 0xCU, SIM_DEPART_1111 = 0xFU
}
 SIM FlexNVM partition Implements sim_flexnvm_partition_t_Class. More...
 

Functions

static void SIM_HAL_SetSramLRetentionCmd (SIM_Type *base, bool setting)
 Set SRAM L Retention setting. More...
 
static bool SIM_HAL_GetSramLRetentionCmd (const SIM_Type *base)
 Get SRAM L Retention setting. More...
 
static void SIM_HAL_SetSramURetentionCmd (SIM_Type *base, bool setting)
 Set SRAM U Retention setting. More...
 
static bool SIM_HAL_GetSramURetentionCmd (const SIM_Type *base)
 Get SRAM U Retention setting. More...
 
static void SIM_HAL_SetAdcSupplyEnCmd (SIM_Type *base, bool setting)
 Set ADC Supply Enable setting. More...
 
static bool SIM_HAL_GetAdcSupplyEnCmd (const SIM_Type *base)
 Get ADC Supply Enable setting. More...
 
static void SIM_HAL_SetAdcSupplySrc (SIM_Type *base, sim_adc_supply_src_t setting)
 Set ADC Supply Enable setting. More...
 
static sim_adc_supply_src_t SIM_HAL_GetAdcSupplySrc (const SIM_Type *base)
 Get ADC supply source. More...
 
static void SIM_HAL_SetPdbBackToBackSrc (SIM_Type *base, sim_pdb_bb_src_t setting)
 Set PDB back-to-back selection. More...
 
static sim_pdb_bb_src_t SIM_HAL_GetPdbBackToBackSrc (const SIM_Type *base)
 Get PDB back-to-back selection. More...
 
void SIM_HAL_GetClkoutDefaultConfig (sim_clock_out_config_t *config)
 Get the default SIM CLKOUT clock configuration. More...
 
void SIM_HAL_GetClkoutConfig (const SIM_Type *base, sim_clock_out_config_t *config)
 Get the SIM CLKOUT clock configuration. More...
 
void SIM_HAL_InitClkout (SIM_Type *base, const sim_clock_out_config_t *config)
 Initialize SIM CLKOUT. More...
 
static void SIM_HAL_DeinitClkout (SIM_Type *base)
 De-initialize SIM CLKOUT. More...
 
static void SIM_HAL_SetAdcInterleaveSel (SIM_Type *base, uint8_t setting)
 Set ADC interleave channel select. More...
 
static uint8_t SIM_HAL_GetAdcInterleaveSel (const SIM_Type *base)
 Get ADC interleave channel select. More...
 
void SIM_HAL_SetFtmExternalClkPinMode (SIM_Type *base, uint32_t instance, sim_ftm_clk_sel_t select)
 Sets the FlexTimer x external clock pin select setting. More...
 
sim_ftm_clk_sel_t SIM_HAL_GetFtmExternalClkPinMode (const SIM_Type *base, uint32_t instance)
 Gets the FlexTimer x external clock pin select setting. More...
 
void SIM_HAL_SetFtmFaultSelMode (SIM_Type *base, uint32_t instance, uint8_t select)
 Sets the FlexTimer x faults select settings. More...
 
uint8_t SIM_HAL_GetFtmFaultSelMode (const SIM_Type *base, uint32_t instance)
 Gets the FlexTimer x faults select settings. More...
 
static sim_rtc_clk_sel_src_t SIM_HAL_GetRtcClkSrc (const SIM_Type *base)
 Get the clock selection of RTCCLKSEL. More...
 
static void SIM_HAL_SetLpoClocks (SIM_Type *base, sim_lpo_clock_config_t setting)
 Set the clock selection of LPOCLKSEL. More...
 
static sim_lpoclk_sel_src_t SIM_HAL_GetLpoClkSrc (const SIM_Type *base)
 Get the clock selection of LPOCLKSEL. More...
 
static bool SIM_HAL_GetLpo32kClkEnCmd (const SIM_Type *base)
 Gets the 32 kHz LPO clock Control. More...
 
static bool SIM_HAL_GetLpo1kClkEnCmd (const SIM_Type *base)
 Gets the 1 kHz LPO clock Control. More...
 
uint32_t SIM_HAL_GetLpoFreq (const SIM_Type *base)
 Get SIM LPO clock frequency (LPO_CLOCK). More...
 
uint32_t SIM_HAL_GetLpo128KFreq (const SIM_Type *base)
 Get SIM LPO 128KHz clock frequency (LPO_128K_CLOCK). More...
 
uint32_t SIM_HAL_GetLpo32KFreq (const SIM_Type *base)
 Get SIM LPO 32KHz clock frequency (LPO_32K_CLOCK). More...
 
uint32_t SIM_HAL_GetLpo1KFreq (const SIM_Type *base)
 Get SIM LPO 1KHz clock frequency (LPO_1K_CLOCK). 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 (const SIM_Type *base, uint32_t instance)
 Gets the ADCx pre-trigger select setting. More...
 
void SIM_HAL_SetAdcSwPreTriggerMode (SIM_Type *base, uint32_t instance, sim_adc_sw_pretrg_sel_t select)
 Sets the ADCx software pre-trigger select setting. More...
 
sim_adc_sw_pretrg_sel_t SIM_HAL_GetAdcSwPreTriggerMode (const SIM_Type *base, uint32_t instance)
 Gets the ADCx software 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 (const SIM_Type *base, uint32_t instance)
 Gets the ADCx trigger select setting. More...
 
static void SIM_HAL_SetFtmGlobalLoad (SIM_Type *base, bool enable)
 Configure the FTM Global Load from the FTM Option Register 1. More...
 
static bool SIM_HAL_GetFtmGlobalLoad (const SIM_Type *base)
 Gets the FTM Global Load from the FTM Option Register 1. More...
 
void SIM_HAL_SetFtmChOutSrcMode (SIM_Type *base, uint32_t instance, uint8_t channel, sim_ftm_ch_out_src_t select)
 Sets the FlexTimer x channel y output source select setting. More...
 
sim_ftm_ch_out_src_t SIM_HAL_GetFtmChOutSrcMode (const SIM_Type *base, uint32_t instance, uint8_t channel)
 Gets the FlexTimer x channel y output source select setting. More...
 
void SIM_HAL_SetFtmChSrcMode (SIM_Type *base, uint32_t instance, uint8_t channel, sim_ftm_ch_src_t select)
 Sets the FlexTimer x channel y input source select setting. More...
 
sim_ftm_ch_src_t SIM_HAL_GetFtmChSrcMode (const SIM_Type *base, uint32_t instance, uint8_t channel)
 Gets the FlexTimer x channel y input source select setting. More...
 
void SIM_HAL_SetFtmSyncCmd (SIM_Type *base, uint32_t instance, bool sync)
 Set FlexTimer x hardware trigger 0 software synchronization. More...
 
static bool SIM_HAL_GetFtmSyncCmd (const SIM_Type *base, uint32_t instance)
 Get FlexTimer x hardware trigger software synchronization setting. More...
 
static void SIM_HAL_SetObeCtrlCmd (SIM_Type *base, uint32_t instance, bool setting)
 Sets FTM channel state. More...
 
static bool SIM_HAL_GetObeCtrlCmd (const SIM_Type *base, uint32_t instance)
 Gets FTM channel state. More...
 
static uint32_t SIM_HAL_GetGeneration (const SIM_Type *base)
 Gets the product series Generation from System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetSubSeries (const SIM_Type *base)
 Gets the sub-series in the System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetDerivate (const SIM_Type *base)
 Gets the Derivate from the System Device ID register (SIM_SDID). More...
 
static sim_ram_size_t SIM_HAL_GetRamSize (const SIM_Type *base)
 Gets RAM size. More...
 
static uint32_t SIM_HAL_GetRevId (const SIM_Type *base)
 Gets the Revision ID in the System Device ID register (SIM_SDID). More...
 
static sim_package_t SIM_HAL_GetPackage (const SIM_Type *base)
 Gets the Package in System Device ID register (SIM_SDID). More...
 
static uint32_t SIM_HAL_GetFeatures (const SIM_Type *base)
 Gets the Features from System Device ID register (SIM_SDID). More...
 
static void SIM_HAL_SetEimClockGate (SIM_Type *base, bool enable)
 Set the EIM Clock Gate from the Platform Clock Gating Control Register. More...
 
static bool SIM_HAL_GetEimClockGate (const SIM_Type *base)
 Gets the EIM Clock Gate from the Platform Clock Gating Control Register. More...
 
static void SIM_HAL_SetErmClockGate (SIM_Type *base, bool enable)
 Set the ERM Clock Gate from the Platform Clock Gating Control Register. More...
 
static bool SIM_HAL_GetErmClockGate (const SIM_Type *base)
 Gets the ERM Clock Gate from the Platform Clock Gating Control Register. More...
 
static void SIM_HAL_SetDmaClockGate (SIM_Type *base, bool enable)
 Set the DMA Clock Gate from the Platform Clock Gating Control Register. More...
 
static bool SIM_HAL_GetDmaClockGate (const SIM_Type *base)
 Gets the DMA Clock Gate from the Platform Clock Gating Control Register. More...
 
static void SIM_HAL_SetMpuClockGate (SIM_Type *base, bool enable)
 Configure the MPU Clock Gating from the Platform Clock Gating Control Register. More...
 
static bool SIM_HAL_GetMpuClockGate (const SIM_Type *base)
 Gets the MPU Clock Gating from the Platform Clock Gating Control Register. More...
 
static void SIM_HAL_SetMscmClockGate (SIM_Type *base, bool enable)
 Configure the MSCM Clock Gating from the Platform Clock Gating Control Register. More...
 
static bool SIM_HAL_GetMscmClockGate (const SIM_Type *base)
 Gets the MSCM Clock Gating from the Platform Clock Gating Control Register. More...
 
static sim_eee_sram_size_t SIM_HAL_GetEeeSramSize (const SIM_Type *base)
 Gets the EEE SRAM size in the Flash Configuration Register 1. More...
 
static sim_flexnvm_partition_t SIM_HAL_GetFlexNvmPartition (const SIM_Type *base)
 Gets the FlexNVM partition in the Flash Configuration Register 1. More...
 
static uint32_t SIM_HAL_GetUniqueIdHigh (const SIM_Type *base)
 Gets the UID127_96 from Unique Identification Register High. More...
 
static uint32_t SIM_HAL_GetUniqueIdMidHigh (const SIM_Type *base)
 Gets the UID95_64 from Unique Identification Register Mid High. More...
 
static uint32_t SIM_HAL_GetUniqueIdMidLow (const SIM_Type *base)
 Gets the UID63_32 from Unique Identification Register Mid Low. More...
 
static uint32_t SIM_HAL_GetUniqueIdLow (const SIM_Type *base)
 Gets the UID31_0 from Unique Identification Register Low. More...
 
void SIM_HAL_GetTraceClockDefaultConfig (sim_trace_clock_config_t *config)
 Get the default Debug Trace clock configuration. More...
 
void SIM_HAL_InitTraceClock (SIM_Type *base, const sim_trace_clock_config_t *config)
 Initialize SIM Debug Trace. More...
 
static void SIM_HAL_DeinitTraceClock (SIM_Type *base)
 De-initialize SIM Debug Trace. More...
 
static void SIM_HAL_SetSwTriggerTrgmux (SIM_Type *base, bool disable)
 Sets the Software Trigger bit to TRGMUX setting. More...
 
static uint32_t SIM_HAL_GetSwTriggerTrgmux (const SIM_Type *base)
 Gets the Software Trigger bit to TRGMUX. More...
 
static void SIM_HAL_SetTClkFreq (SIM_Type *base, uint8_t index, uint32_t frequency)
 Sets the TClk Frequency. More...
 
static uint32_t SIM_HAL_GetTClkFreq (SIM_Type *base, uint8_t index)
 Gets the TClk Frequency. More...
 

Variables

uint32_t g_TClkFreq [NUMBER_OF_TCLK_INPUTS]