S32 SDK

Detailed Description

Programmable Delay Block Hardware Abstraction Layer.

This HAL provides low-level access to all hardware features of the PDB.

Data Structures

struct  pdb_timer_config_t
 Defines the type of structure for basic timer in PDB. More...
 

Enumerations

enum  pdb_load_value_mode_t { PDB_LOAD_VAL_IMMEDIATELY = 0U, PDB_LOAD_VAL_AT_MODULO_COUNTER = 1U, PDB_LOAD_VAL_AT_NEXT_TRIGGER = 2U, PDB_LOAD_VAL_AT_MODULO_COUNTER_OR_NEXT_TRIGGER = 3U }
 Defines the type of value load mode for the PDB module. More...
 
enum  pdb_clk_prescaler_div_t {
  PDB_CLK_PREDIV_BY_1 = 0U, PDB_CLK_PREDIV_BY_2 = 1U, PDB_CLK_PREDIV_BY_4 = 2U, PDB_CLK_PREDIV_BY_8 = 3U,
  PDB_CLK_PREDIV_BY_16 = 4U, PDB_CLK_PREDIV_BY_32 = 5U, PDB_CLK_PREDIV_BY_64 = 6U, PDB_CLK_PREDIV_BY_128 = 7U
}
 Defines the type of prescaler divider for the PDB counter clock. Implements : pdb_clk_prescaler_div_t_Class. More...
 
enum  pdb_trigger_src_t {
  PDB_TRIGGER_0 = 0U, PDB_TRIGGER_1 = 1U, PDB_TRIGGER_2 = 2U, PDB_TRIGGER_3 = 3U,
  PDB_TRIGGER_4 = 4U, PDB_TRIGGER_5 = 5U, PDB_TRIGGER_6 = 6U, PDB_TRIGGER_7 = 7U,
  PDB_TRIGGER_8 = 8U, PDB_TRIGGER_9 = 9U, PDB_TRIGGER_10 = 10U, PDB_TRIGGER_11 = 11U,
  PDB_TRIGGER_12 = 12U, PDB_TRIGGER_13 = 13U, PDB_TRIGGER_14 = 14U, PDB_SOFTWARE_TRIGGER = 15U
}
 Defines the type of trigger source mode for the PDB. More...
 
enum  pdb_clk_prescaler_mult_factor_t { PDB_CLK_PREMULT_FACT_AS_1 = 0U, PDB_CLK_PREMULT_FACT_AS_10 = 1U, PDB_CLK_PREMULT_FACT_AS_20 = 2U, PDB_CLK_PREMULT_FACT_AS_40 = 3U }
 Defines the type of the multiplication source mode for PDB. More...
 

Functions

void PDB_HAL_Init (PDB_Type *const base)
 Resets the PDB registers to a known state. More...
 
void PDB_HAL_ConfigTimer (PDB_Type *const base, const pdb_timer_config_t *const configPtr)
 Configure the PDB timer. More...
 
static void PDB_HAL_SetSoftTriggerCmd (PDB_Type *const base)
 Triggers the PDB by software if enabled. More...
 
static void PDB_HAL_Enable (PDB_Type *const base)
 Switches on to enable the PDB module. More...
 
static void PDB_HAL_Disable (PDB_Type *const base)
 Switches to disable the PDB module. More...
 
static bool PDB_HAL_GetTimerIntFlag (PDB_Type const *const base)
 Gets the PDB delay interrupt flag. More...
 
static void PDB_HAL_ClearTimerIntFlag (PDB_Type *const base)
 Clears the PDB delay interrupt flag. More...
 
static void PDB_HAL_SetLoadValuesCmd (PDB_Type *const base)
 Loads the delay registers value for the PDB module. More...
 
static void PDB_HAL_SetTimerModulusValue (PDB_Type *const base, uint32_t value)
 Sets the modulus value for the PDB module. More...
 
static uint32_t PDB_HAL_GetTimerValue (PDB_Type const *const base)
 Gets the PDB counter value of PDB timer. More...
 
static void PDB_HAL_SetValueForTimerInterrupt (PDB_Type *const base, uint32_t value)
 Sets the interrupt delay milestone of the PDB counter. More...
 
void PDB_HAL_SetAdcPreTriggerBackToBackEnable (PDB_Type *const base, uint32_t chn, uint32_t preChnMask, bool enable)
 Switches to enable the pre-trigger back-to-back mode. More...
 
void PDB_HAL_SetAdcPreTriggerOutputEnable (PDB_Type *const base, uint32_t chn, uint32_t preChnMask, bool enable)
 Switches to enable the pre-trigger output. More...
 
void PDB_HAL_SetAdcPreTriggerEnable (PDB_Type *const base, uint32_t chn, uint32_t preChnMask, bool enable)
 Switches to enable the pre-trigger. More...
 
static uint32_t PDB_HAL_GetAdcPreTriggerFlags (PDB_Type const *const base, uint32_t chn, uint32_t preChnMask)
 Gets the flag which indicates whether the PDB counter has reached the pre-trigger delay value. More...
 
void PDB_HAL_ClearAdcPreTriggerFlags (PDB_Type *const base, uint32_t chn, uint32_t preChnMask)
 Clears the flag which indicates that the PDB counter has reached the pre-trigger delay value. More...
 
static uint32_t PDB_HAL_GetAdcPreTriggerSeqErrFlags (PDB_Type const *const base, uint32_t chn, uint32_t preChnMask)
 Gets the flag which indicates whether a sequence error is detected. More...
 
void PDB_HAL_ClearAdcPreTriggerSeqErrFlags (PDB_Type *const base, uint32_t chn, uint32_t preChnMask)
 Clears the flag which indicates that a sequence error has been detected. More...
 
void PDB_HAL_SetAdcPreTriggerDelayValue (PDB_Type *const base, uint32_t chn, uint32_t preChn, uint32_t value)
 Sets the pre-trigger delay value. More...
 
void PDB_HAL_SetCmpPulseOutEnable (PDB_Type *const base, uint32_t pulseChnMask, bool enable)
 Switches to enable the pulse-out trigger. More...
 
static void PDB_HAL_SetCmpPulseOutDelayForHigh (PDB_Type *const base, uint32_t pulseChn, uint32_t value)
 Sets the counter delay value for the pulse-out goes high. More...
 
static void PDB_HAL_SetCmpPulseOutDelayForLow (PDB_Type *const base, uint32_t pulseChn, uint32_t value)
 Sets the counter delay value for the pulse-out goes low. More...
 

Enumeration Type Documentation

Defines the type of prescaler divider for the PDB counter clock. Implements : pdb_clk_prescaler_div_t_Class.

Enumerator
PDB_CLK_PREDIV_BY_1 

Counting divided by multiplication factor selected by MULT.

PDB_CLK_PREDIV_BY_2 

Counting divided by multiplication factor selected by 2 times ofMULT.

PDB_CLK_PREDIV_BY_4 

Counting divided by multiplication factor selected by 4 times ofMULT.

PDB_CLK_PREDIV_BY_8 

Counting divided by multiplication factor selected by 8 times ofMULT.

PDB_CLK_PREDIV_BY_16 

Counting divided by multiplication factor selected by 16 times ofMULT.

PDB_CLK_PREDIV_BY_32 

Counting divided by multiplication factor selected by 32 times ofMULT.

PDB_CLK_PREDIV_BY_64 

Counting divided by multiplication factor selected by 64 times ofMULT.

PDB_CLK_PREDIV_BY_128 

Counting divided by multiplication factor selected by 128 times ofMULT.

Definition at line 86 of file pdb_hal.h.

Defines the type of the multiplication source mode for PDB.

Selects the multiplication factor of the prescaler divider for the PDB counter clock. Implements : pdb_clk_prescaler_mult_factor_t_Class

Enumerator
PDB_CLK_PREMULT_FACT_AS_1 

Multiplication factor is 1.

PDB_CLK_PREMULT_FACT_AS_10 

Multiplication factor is 10.

PDB_CLK_PREMULT_FACT_AS_20 

Multiplication factor is 20.

PDB_CLK_PREMULT_FACT_AS_40 

Multiplication factor is 40.

Definition at line 131 of file pdb_hal.h.

Defines the type of value load mode for the PDB module.

Some timing related registers, such as the MOD, IDLY, CHnDLYm, INTx and POyDLY, buffer the setting values. Only the load operation is triggered. The setting value is loaded from a buffer and takes effect. There are four loading modes to fit different applications. Implements : pdb_load_value_mode_t_Class

Enumerator
PDB_LOAD_VAL_IMMEDIATELY 

Loaded immediately after load operation.

PDB_LOAD_VAL_AT_MODULO_COUNTER 

Loaded when counter hits the modulo after load operation.

PDB_LOAD_VAL_AT_NEXT_TRIGGER 

Loaded when detecting an input trigger after load operation.

PDB_LOAD_VAL_AT_MODULO_COUNTER_OR_NEXT_TRIGGER 

Loaded when counter hits the modulo or detecting an input trigger after load operation.

Definition at line 70 of file pdb_hal.h.

Defines the type of trigger source mode for the PDB.

Selects the trigger input source for the PDB. The trigger input source can be internal or external (EXTRG pin), or the software trigger. Implements : pdb_trigger_src_t_Class

Enumerator
PDB_TRIGGER_0 

Select trigger-In 0.

PDB_TRIGGER_1 

Select trigger-In 1.

PDB_TRIGGER_2 

Select trigger-In 2.

PDB_TRIGGER_3 

Select trigger-In 3.

PDB_TRIGGER_4 

Select trigger-In 4.

PDB_TRIGGER_5 

Select trigger-In 5.

PDB_TRIGGER_6 

Select trigger-In 6.

PDB_TRIGGER_7 

Select trigger-In 7.

PDB_TRIGGER_8 

Select trigger-In 8.

PDB_TRIGGER_9 

Select trigger-In 8.

PDB_TRIGGER_10 

Select trigger-In 10.

PDB_TRIGGER_11 

Select trigger-In 11.

PDB_TRIGGER_12 

Select trigger-In 12.

PDB_TRIGGER_13 

Select trigger-In 13.

PDB_TRIGGER_14 

Select trigger-In 14.

PDB_SOFTWARE_TRIGGER 

Select software trigger.

Definition at line 105 of file pdb_hal.h.

Function Documentation

void PDB_HAL_ClearAdcPreTriggerFlags ( PDB_Type *const  base,
uint32_t  chn,
uint32_t  preChnMask 
)

Clears the flag which indicates that the PDB counter has reached the pre-trigger delay value.

This function clears the flag which indicates that the PDB counter has reached the pre-trigger delay value.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.

Definition at line 196 of file pdb_hal.c.

void PDB_HAL_ClearAdcPreTriggerSeqErrFlags ( PDB_Type *const  base,
uint32_t  chn,
uint32_t  preChnMask 
)

Clears the flag which indicates that a sequence error has been detected.

This function clears the flag which indicates that the sequence error has been detected.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.

Definition at line 215 of file pdb_hal.c.

static void PDB_HAL_ClearTimerIntFlag ( PDB_Type *const  base)
inlinestatic

Clears the PDB delay interrupt flag.

This function clears PDB delay interrupt flag.

Parameters
baseRegister base address for the module. Implements : PDB_HAL_ClearTimerIntFlag_Activity

Definition at line 249 of file pdb_hal.h.

void PDB_HAL_ConfigTimer ( PDB_Type *const  base,
const pdb_timer_config_t *const  configPtr 
)

Configure the PDB timer.

This function configure the PDB's basic timer.

Parameters
baseRegister base address for the module.
configPtrPointer to configuration structure, see to "pdb_timer_config_t".

Definition at line 76 of file pdb_hal.c.

static void PDB_HAL_Disable ( PDB_Type *const  base)
inlinestatic

Switches to disable the PDB module.

This function switches to disable the PDB module.

Parameters
baseRegister base address for the module. Implements : PDB_HAL_Disable_Activity

Definition at line 220 of file pdb_hal.h.

static void PDB_HAL_Enable ( PDB_Type *const  base)
inlinestatic

Switches on to enable the PDB module.

This function switches on to enable the PDB module.

Parameters
baseRegister base address for the module. Implements : PDB_HAL_Enable_Activity

Definition at line 207 of file pdb_hal.h.

static uint32_t PDB_HAL_GetAdcPreTriggerFlags ( PDB_Type const *const  base,
uint32_t  chn,
uint32_t  preChnMask 
)
inlinestatic

Gets the flag which indicates whether the PDB counter has reached the pre-trigger delay value.

This function gets the flag which indicates the PDB counter has reached the pre-trigger delay value.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.
Returns
Flag mask. Indicated bit would be 1 if the event is asserted. Implements : PDB_HAL_GetAdcPreTriggerFlags_Activity

Definition at line 383 of file pdb_hal.h.

static uint32_t PDB_HAL_GetAdcPreTriggerSeqErrFlags ( PDB_Type const *const  base,
uint32_t  chn,
uint32_t  preChnMask 
)
inlinestatic

Gets the flag which indicates whether a sequence error is detected.

This function gets the flag which indicates whether a sequence error is detected.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.
Returns
Flag mask. Indicated bit would be 1 if the event is asserted. Implements : PDB_HAL_GetAdcPreTriggerSeqErrFlags_Activity

Definition at line 413 of file pdb_hal.h.

static bool PDB_HAL_GetTimerIntFlag ( PDB_Type const *const  base)
inlinestatic

Gets the PDB delay interrupt flag.

This function gets the PDB delay interrupt flag.

Parameters
baseRegister base address for the module.
Returns
Flat status, true if the flag is set. Implements : PDB_HAL_GetTimerIntFlag_Activity

Definition at line 235 of file pdb_hal.h.

static uint32_t PDB_HAL_GetTimerValue ( PDB_Type const *const  base)
inlinestatic

Gets the PDB counter value of PDB timer.

This function gets the PDB counter value of PDB timer.

Parameters
baseRegister base address for the module.
Returns
The current counter value. Implements : PDB_HAL_GetTimerValue_Activity

Definition at line 312 of file pdb_hal.h.

void PDB_HAL_Init ( PDB_Type *const  base)

Resets the PDB registers to a known state.

This function resets the PDB registers to a known state. This state is defined in a reference manual and is power on reset value.

Parameters
baseRegister base address for the module.

Definition at line 39 of file pdb_hal.c.

void PDB_HAL_SetAdcPreTriggerBackToBackEnable ( PDB_Type *const  base,
uint32_t  chn,
uint32_t  preChnMask,
bool  enable 
)

Switches to enable the pre-trigger back-to-back mode.

This function switches to enable the pre-trigger back-to-back mode.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.
enableSwitcher to assert the feature.

Definition at line 123 of file pdb_hal.c.

void PDB_HAL_SetAdcPreTriggerDelayValue ( PDB_Type *const  base,
uint32_t  chn,
uint32_t  preChn,
uint32_t  value 
)

Sets the pre-trigger delay value.

This function sets the pre-trigger delay value.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnADC channel group index for trigger.
valueSetting value for pre-trigger's delay value.

Definition at line 240 of file pdb_hal.c.

void PDB_HAL_SetAdcPreTriggerEnable ( PDB_Type *const  base,
uint32_t  chn,
uint32_t  preChnMask,
bool  enable 
)

Switches to enable the pre-trigger.

This function switches to enable the pre-trigger.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.
enableSwitcher to assert the feature.

Definition at line 171 of file pdb_hal.c.

void PDB_HAL_SetAdcPreTriggerOutputEnable ( PDB_Type *const  base,
uint32_t  chn,
uint32_t  preChnMask,
bool  enable 
)

Switches to enable the pre-trigger output.

This function switches to enable pre-trigger output.

Parameters
baseRegister base address for the module.
chnADC instance index for trigger.
preChnMaskADC channel group index mask for trigger.
enableSwitcher to assert the feature.

Definition at line 147 of file pdb_hal.c.

static void PDB_HAL_SetCmpPulseOutDelayForHigh ( PDB_Type *const  base,
uint32_t  pulseChn,
uint32_t  value 
)
inlinestatic

Sets the counter delay value for the pulse-out goes high.

This function sets the counter delay value for the pulse-out goes high.

Parameters
baseRegister base address for the module.
pulseChnPulse-out channel index for trigger.
valueSetting value for PDB delay . Implements : PDB_HAL_SetCmpPulseOutDelayForHigh_Activity

Definition at line 464 of file pdb_hal.h.

static void PDB_HAL_SetCmpPulseOutDelayForLow ( PDB_Type *const  base,
uint32_t  pulseChn,
uint32_t  value 
)
inlinestatic

Sets the counter delay value for the pulse-out goes low.

This function sets the counter delay value for the pulse-out goes low.

Parameters
baseRegister base address for the module.
pulseChnPulse-out channel index for trigger.
valueSetting value for PDB delay . Implements : PDB_HAL_SetCmpPulseOutDelayForLow_Activity

Definition at line 481 of file pdb_hal.h.

void PDB_HAL_SetCmpPulseOutEnable ( PDB_Type *const  base,
uint32_t  pulseChnMask,
bool  enable 
)

Switches to enable the pulse-out trigger.

This function switches to enable the pulse-out trigger.

Parameters
baseRegister base address for the module.
pulseChnMaskPulse-out channle index mask for trigger.
enableSwitcher to assert the feature.

Definition at line 255 of file pdb_hal.c.

static void PDB_HAL_SetLoadValuesCmd ( PDB_Type *const  base)
inlinestatic

Loads the delay registers value for the PDB module.

This function sets the LDOK bit and loads the delay registers value. Writing one to this bit updates the internal registers MOD, IDLY, CHnDLYm and POyDLY with the values written to their buffers. The MOD, IDLY, CHnDLYm and POyDLY take effect according to the load mode settings.

After one is written to the LDOK bit, the values in the buffers of above mentioned registers are not effective and cannot be written until the values in the buffers are loaded into their internal registers. The LDOK can be written only when the the PDB is enabled or as alone with it. It is automatically cleared either when the values in the buffers are loaded into the internal registers or when the PDB is disabled.

Parameters
baseRegister base address for the module. Implements : PDB_HAL_SetLoadValuesCmd_Activity

Definition at line 279 of file pdb_hal.h.

static void PDB_HAL_SetSoftTriggerCmd ( PDB_Type *const  base)
inlinestatic

Triggers the PDB by software if enabled.

If enabled, this function triggers the PDB by using software.

Parameters
baseRegister base address for the module. Implements : PDB_HAL_SetSoftTriggerCmd_Activity

Definition at line 193 of file pdb_hal.h.

static void PDB_HAL_SetTimerModulusValue ( PDB_Type *const  base,
uint32_t  value 
)
inlinestatic

Sets the modulus value for the PDB module.

This function sets the modulus value for the PDB module. When the counter reaches the setting value, it is automatically reset to zero. When in continuous mode, the counter begins to increase again.

Parameters
baseRegister base address for the module.
valueThe setting value of upper limit for PDB counter. Implements : PDB_HAL_SetTimerModulusValue_Activity

Definition at line 297 of file pdb_hal.h.

static void PDB_HAL_SetValueForTimerInterrupt ( PDB_Type *const  base,
uint32_t  value 
)
inlinestatic

Sets the interrupt delay milestone of the PDB counter.

This function sets the interrupt delay milestone of the PDB counter. If enabled, a PDB interrupt is generated when the counter is equal to the setting value.

Parameters
baseRegister base address for the module.
valueThe setting value for interrupt delay milestone of PDB counter. Implements : PDB_HAL_SetValueForTimerInterrupt_Activity

Definition at line 329 of file pdb_hal.h.