Trigger MUX Control Peripheral Driver. The TRGMUX introduces an extremely flexible methodology for connecting various trigger sources to multiple pins/peripherals.
The S32 SDK provides Peripheral Drivers for the Trigger MUX Control (TRGMUX) module of S32 SDK devices.
This section describes the programing interface of the TRGMUX driver. The TRGMUX driver configures the TRGMUX (Trigger Mux Control). The Trigger MUX module allows software to configure the trigger inputs for various peripherals.
TRGMUX can be seen as a collection of muxes, each mux allowing to select one output from a list of input signals that are common to all muxes. The TRGMUX registers are identical as structure and all bitfields can be read/written using the TRGMUX driver API.
The TRGMUX_DRV_Init() function is used to initialize the TRGMUX IP. The function receives as parameter a pointer to the trgmux_user_config_t structure. This structure contains a variable number of mappings between a trgmux trigger source and a trgmux target modules.
After initialization, the driver allows the reconfiguration of the source trigger for a given target module using TRGMUX_DRV_SetTrigSourceForTargetModule(). Also, by using TRGMUX_DRV_SetLockForTargetModule(), a given target module can be locked, such that it cannot be updated until a reset.
Data Structures | |
struct | trgmux_inout_mapping_config_t |
Configuration structure for pairing source triggers with target modules. More... | |
struct | trgmux_user_config_t |
User configuration structure for the TRGMUX driver. More... | |
Typedefs | |
typedef enum trgmux_trigger_source_e | trgmux_trigger_source_t |
Enumeration for trigger source module of TRGMUX. More... | |
typedef enum trgmux_target_module_e | trgmux_target_module_t |
Enumeration for target module of TRGMUX. More... | |
Functions | |
status_t | TRGMUX_DRV_Init (const uint32_t instance, const trgmux_user_config_t *const trgmuxUserConfig) |
Initialize a TRGMUX instance for operation. More... | |
status_t | TRGMUX_DRV_Deinit (const uint32_t instance) |
Reset to default values the source triggers corresponding to all target modules, if none of the target modules is locked. More... | |
status_t | TRGMUX_DRV_SetTrigSourceForTargetModule (const uint32_t instance, const trgmux_trigger_source_t triggerSource, const trgmux_target_module_t targetModule) |
Configure a source trigger for a selected target module. More... | |
trgmux_trigger_source_t | TRGMUX_DRV_GetTrigSourceForTargetModule (const uint32_t instance, const trgmux_target_module_t targetModule) |
Get the source trigger configured for a target module. More... | |
void | TRGMUX_DRV_SetLockForTargetModule (const uint32_t instance, const trgmux_target_module_t targetModule) |
Locks the TRGMUX register of a target module. More... | |
bool | TRGMUX_DRV_GetLockForTargetModule (const uint32_t instance, const trgmux_target_module_t targetModule) |
Get the Lock bit status of the TRGMUX register of a target module. More... | |
void | TRGMUX_DRV_GenSWTrigger (const uint32_t instance) |
Generate software triggers. More... | |
typedef enum trgmux_target_module_e trgmux_target_module_t |
Enumeration for target module of TRGMUX.
Describes all possible outputs (target modules) of the TRGMUX IP This enumeration depends on the supported instances in device
Implements: trgmux_target_module_t_Class
Definition at line 81 of file trgmux_driver.h.
typedef enum trgmux_trigger_source_e trgmux_trigger_source_t |
Enumeration for trigger source module of TRGMUX.
Describes all possible inputs (trigger sources) of the TRGMUX IP This enumeration depends on the supported instances in device
Implements: trgmux_trigger_source_t_Class
Definition at line 71 of file trgmux_driver.h.
status_t TRGMUX_DRV_Deinit | ( | const uint32_t | instance | ) |
Reset to default values the source triggers corresponding to all target modules, if none of the target modules is locked.
[in] | instance | The TRGMUX instance number. |
Definition at line 117 of file trgmux_driver.c.
void TRGMUX_DRV_GenSWTrigger | ( | const uint32_t | instance | ) |
Generate software triggers.
This function uses a SIM register in order to generate a software triggers to the target peripherals selected in TRGMUX
param[in] | instance The TRGMUX instance number. |
Definition at line 224 of file trgmux_driver.c.
bool TRGMUX_DRV_GetLockForTargetModule | ( | const uint32_t | instance, |
const trgmux_target_module_t | targetModule | ||
) |
Get the Lock bit status of the TRGMUX register of a target module.
This function gets the value of the LK bit from the TRGMUX register corresponding to the selected target module.
[in] | instance | The TRGMUX instance number. |
[in] | targetModule | One of the values in the trgmux_target_module_t enumeration |
Definition at line 206 of file trgmux_driver.c.
trgmux_trigger_source_t TRGMUX_DRV_GetTrigSourceForTargetModule | ( | const uint32_t | instance, |
const trgmux_target_module_t | targetModule | ||
) |
Get the source trigger configured for a target module.
This function returns the TRGMUX source trigger linked to a selected target module.
[in] | instance | The TRGMUX instance number. |
[in] | targetModule | One of the values in the trgmux_target_module_t enumeration. |
Definition at line 171 of file trgmux_driver.c.
status_t TRGMUX_DRV_Init | ( | const uint32_t | instance, |
const trgmux_user_config_t *const | trgmuxUserConfig | ||
) |
Initialize a TRGMUX instance for operation.
This function first resets the source triggers of all TRGMUX target modules to their default values, then configures the TRGMUX with all the user defined in-out mappings. If at least one of the target modules is locked, the function will not change any of the TRGMUX target modules and return error code. This example shows how to set up the trgmux_user_config_t parameters and how to call the TRGMUX_DRV_Init() function with the required parameters:
[in] | instance | The TRGMUX instance number. |
[in] | trgmuxUserConfig | Pointer to the user configuration structure. |
Definition at line 74 of file trgmux_driver.c.
void TRGMUX_DRV_SetLockForTargetModule | ( | const uint32_t | instance, |
const trgmux_target_module_t | targetModule | ||
) |
Locks the TRGMUX register of a target module.
This function sets the LK bit of the TRGMUX register corresponding to the selected target module. Please note that some TRGMUX registers can contain up to 4 SEL bitfields, meaning that these registers can be used to configure up to 4 target modules independently. Because the LK bit is only one per register, the configuration of all target modules referred from that register will be locked.
[in] | instance | The TRGMUX instance number. |
[in] | targetModule | One of the values in the trgmux_target_module_t enumeration |
Definition at line 188 of file trgmux_driver.c.
status_t TRGMUX_DRV_SetTrigSourceForTargetModule | ( | const uint32_t | instance, |
const trgmux_trigger_source_t | triggerSource, | ||
const trgmux_target_module_t | targetModule | ||
) |
Configure a source trigger for a selected target module.
This function configures a TRGMUX link between a source trigger and a target module, if the requested target module is not locked.
[in] | instance | The TRGMUX instance number. |
[in] | triggerSource | One of the values in the trgmux_trigger_source_t enumeration |
[in] | targetModule | One of the values in the trgmux_target_module_t enumeration |
Definition at line 138 of file trgmux_driver.c.