RZT Flexible Software Package Documentation  Release v2.2.0

 
Event Link Controller (r_elc)

Functions

fsp_err_t R_ELC_Open (elc_ctrl_t *const p_ctrl, elc_cfg_t const *const p_cfg)
 
fsp_err_t R_ELC_Close (elc_ctrl_t *const p_ctrl)
 
fsp_err_t R_ELC_SoftwareEventGenerate (elc_ctrl_t *const p_ctrl, elc_software_event_t event_number)
 
fsp_err_t R_ELC_LinkSet (elc_ctrl_t *const p_ctrl, elc_peripheral_t peripheral, elc_event_t signal)
 
fsp_err_t R_ELC_LinkBreak (elc_ctrl_t *const p_ctrl, elc_peripheral_t peripheral)
 
fsp_err_t R_ELC_Enable (elc_ctrl_t *const p_ctrl)
 
fsp_err_t R_ELC_Disable (elc_ctrl_t *const p_ctrl)
 

Detailed Description

Driver for the ELC peripheral on RZ microprocessor. This module implements the ELC Interface.

Overview

The event link controller (ELC) uses the event requests generated by various peripheral modules as source signals to connect (link) them to different modules, allowing direct cooperation between the modules without central processing unit (CPU) intervention. The conceptual diagram below illustrates a potential setup where a pin input triggers a timer which later triggers an ADC conversion. These tasks would be automatically handled without the need for polling or interrupt management.

r_elc_concept.svg
Event Link Controller Conceptual Diagram

In essence, the ELC is an array of multiplexers to route a wide variety of interrupt signals to a subset of peripheral functions. Events are linked by setting the multiplexer for the desired function to the desired signal (through R_ELC_LinkSet). The diagram below illustrates one peripheral output of the ELC. In this example, a conversion start is triggered for ADC120 Group A when the GPT0 counter overflows:

r_elc_eventset.svg
ELC Example

Features

The ELC HAL module can perform the following functions:

A variety of functions can be activated via events, including:

Note
The available sources and peripherals may differ between devices. A full list of selectable peripherals and events is available in the User's Manual for your device.
Some peripherals have specific settings related to ELC event generation and/or reception. Details on how to enable event functionality for each peripheral are located in the usage notes for the related module(s) as well as in the User's Manual for your device.

Configuration

Note
Event links will be automatically generated based on the selections made in module properties. To view the currently linked events check the Event Links tab in the FSP Configuration editor.

To manually link an event to a peripheral at runtime perform the following steps:

  1. Configure the operation of the destination peripheral (including any configuration necessary to receive events)
  2. Use R_ELC_LinkSet to set the desired event link to the peripheral
  3. Configure the signaling module to output the desired event (typically an interrupt)

To disable the event, either use R_ELC_LinkBreak to clear the link for a specific event.

Note
The ELC module needs no pin, clocking or interrupt configuration; it is merely a mechanism to connect signals between peripherals. However, when linking I/O Ports via the ELC the relevant I/O pins need to be configured as inputs or outputs, and more ELC module I/O port settings. Also, when linking MTU as the ELC destination, need to select the operation of MTU when an event is input.

Build Time Configurations for r_elc

The following build time configurations are defined in fsp_cfg/r_elc_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.
GPT/MTU3 Combined Event SelectMCU Specific OptionsSupport for GPT/MTU3 Combined ELC Event Mask Register

Configurations for System > Event Link Controller (r_elc)

This module can be added to the Stacks tab via New Stack > System > Event Link Controller (r_elc).

ConfigurationOptionsDefaultDescription
GPT/MTU3 Event Select > GPT00 Event Select > GPT00_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT00_0_INT4.
GPT/MTU3 Event Select > GPT00 Event Select > GPT00_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT00_1_INT4.
GPT/MTU3 Event Select > GPT00 Event Select > GPT00_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT00_2_INT4.
GPT/MTU3 Event Select > GPT00 Event Select > GPT00_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT00_3_INT4.
GPT/MTU3 Event Select > GPT00 Event Select > GPT00_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT00_4_INT4.
GPT/MTU3 Event Select > GPT01 Event Select > GPT01_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT01_0_INT4.
GPT/MTU3 Event Select > GPT01 Event Select > GPT01_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT01_1_INT4.
GPT/MTU3 Event Select > GPT01 Event Select > GPT01_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT01_2_INT4.
GPT/MTU3 Event Select > GPT01 Event Select > GPT01_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT01_3_INT4.
GPT/MTU3 Event Select > GPT01 Event Select > GPT01_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT01_4_INT4.
GPT/MTU3 Event Select > GPT02 Event Select > GPT02_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT02_0_INT4.
GPT/MTU3 Event Select > GPT02 Event Select > GPT02_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT02_1_INT4.
GPT/MTU3 Event Select > GPT02 Event Select > GPT02_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT02_2_INT4.
GPT/MTU3 Event Select > GPT02 Event Select > GPT02_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT02_3_INT4.
GPT/MTU3 Event Select > GPT02 Event Select > GPT02_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT02_4_INT4.
GPT/MTU3 Event Select > GPT03 Event Select > GPT03_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT03_0_INT4.
GPT/MTU3 Event Select > GPT03 Event Select > GPT03_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT03_1_INT4.
GPT/MTU3 Event Select > GPT03 Event Select > GPT03_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT03_2_INT4.
GPT/MTU3 Event Select > GPT03 Event Select > GPT03_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT03_3_INT4.
GPT/MTU3 Event Select > GPT03 Event Select > GPT03_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT03_4_INT4.
GPT/MTU3 Event Select > GPT04 Event Select > GPT04_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT04_0_INT4.
GPT/MTU3 Event Select > GPT04 Event Select > GPT04_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT04_1_INT4.
GPT/MTU3 Event Select > GPT04 Event Select > GPT04_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT04_2_INT4.
GPT/MTU3 Event Select > GPT04 Event Select > GPT04_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT04_3_INT4.
GPT/MTU3 Event Select > GPT04 Event Select > GPT04_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT04_4_INT4.
GPT/MTU3 Event Select > GPT05 Event Select > GPT05_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT05_0_INT4.
GPT/MTU3 Event Select > GPT05 Event Select > GPT05_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT05_1_INT4.
GPT/MTU3 Event Select > GPT05 Event Select > GPT05_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT05_2_INT4.
GPT/MTU3 Event Select > GPT05 Event Select > GPT05_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT05_3_INT4.
GPT/MTU3 Event Select > GPT05 Event Select > GPT05_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT05_4_INT4.
GPT/MTU3 Event Select > GPT06 Event Select > GPT06_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT06_0_INT4.
GPT/MTU3 Event Select > GPT06 Event Select > GPT06_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT06_1_INT4.
GPT/MTU3 Event Select > GPT06 Event Select > GPT06_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT06_2_INT4.
GPT/MTU3 Event Select > GPT06 Event Select > GPT06_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT06_3_INT4.
GPT/MTU3 Event Select > GPT06 Event Select > GPT06_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT06_4_INT4.
GPT/MTU3 Event Select > GPT07 Event Select > GPT07_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT07_0_INT4.
GPT/MTU3 Event Select > GPT07 Event Select > GPT07_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT07_1_INT4.
GPT/MTU3 Event Select > GPT07 Event Select > GPT07_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT07_2_INT4.
GPT/MTU3 Event Select > GPT07 Event Select > GPT07_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT07_3_INT4.
GPT/MTU3 Event Select > GPT07 Event Select > GPT07_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT07_4_INT4.
GPT/MTU3 Event Select > GPT08 Event Select > GPT08_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT08_0_INT4.
GPT/MTU3 Event Select > GPT08 Event Select > GPT08_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT08_1_INT4.
GPT/MTU3 Event Select > GPT08 Event Select > GPT08_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT08_2_INT4.
GPT/MTU3 Event Select > GPT08 Event Select > GPT08_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT08_3_INT4.
GPT/MTU3 Event Select > GPT08 Event Select > GPT08_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT08_4_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_0_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_0_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_1_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_1_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_2_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_2_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_3_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_3_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_4_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_4_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_5_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_5_INT4.
GPT/MTU3 Event Select > GPT09 Event Select > GPT09_6_INT4 Event SelectMCU Specific OptionsGPT/MTU3 combined ELC event select for GPT09_6_INT4.
NameELC instance name must be g_elc to match elc_cfg_t data structure created in elc_data.cg_elc Module name. Fixed to g_elc.

Usage Notes

Limitations

Developers should be aware of the following limitations when using the ELC:

Examples

Basic Example

Below is a basic example of minimal use of event linking in an application.

/* This struct is automatically generated based on the events configured by peripherals in the FSP Configuration editor. */
static const elc_cfg_t g_elc_cfg =
{
.link[ELC_PERIPHERAL_MTU0] = ELC_EVENT_INTCPU0,
.link[ELC_PERIPHERAL_SINGLEPORT0] = ELC_EVENT_GPT0_OVF
};
void elc_basic_example (void)
{
fsp_err_t err = FSP_SUCCESS;
/* Initializes the software and sets the links defined in the control structure. */
err = R_ELC_Open(&g_elc_ctrl, &g_elc_cfg);
/* Handle any errors. This function should be defined by the user. */
handle_error(err);
/* Create or modify a link between a peripheral function and an event source. */
err = R_ELC_LinkSet(&g_elc_ctrl, ELC_PERIPHERAL_ADC0_A, ELC_EVENT_GPT0_OVF);
handle_error(err);
}

Data Structures

struct  elc_instance_ctrl_t
 

Enumerations

enum  elc_gpt_event_mask_t
 

Data Structure Documentation

◆ elc_instance_ctrl_t

struct elc_instance_ctrl_t

ELC private control block. DO NOT MODIFY. Initialization occurs when R_ELC_Open() is called.

Enumeration Type Documentation

◆ elc_gpt_event_mask_t

GPT/MTU event source definitions.

Enumerator
ELC_GPT_EVENT_MASK_OFF 

GPT Event not selected.

ELC_GPT_EVENT_MASK_GPTX_BIT_0 

GPT2n Event BIT0 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_1 

GPT2n Event BIT1 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_2 

GPT2n Event BIT2 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_3 

GPT2n Event BIT3 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_4 

GPT2n Event BIT4 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_5 

GPT2n Event BIT5 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_6 

GPT2n Event BIT6 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_7 

GPT2n Event BIT7 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_8 

GPT2n Event BIT8 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_9 

GPT2n Event BIT9 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_10 

GPT2n Event BIT10 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_11 

GPT2n Event BIT11 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_12 

GPT2n Event BIT12 mask.

ELC_GPT_EVENT_MASK_GPTX_BIT_13 

GPT2n Event BIT13 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_0 

GPT2n+1 Event BIT0 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_1 

GPT2n+1 Event BIT1 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_2 

GPT2n+1 Event BIT2 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_3 

GPT2n+1 Event BIT3 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_4 

GPT2n+1 Event BIT4 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_5 

GPT2n+1 Event BIT5 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_6 

GPT2n+1 Event BIT6 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_7 

GPT2n+1 Event BIT7 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_8 

GPT2n+1 Event BIT8 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_9 

GPT2n+1 Event BIT9 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_10 

GPT2n+1 Event BIT10 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_11 

GPT2n+1 Event BIT11 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_12 

GPT2n+1 Event BIT12 mask.

ELC_GPT_EVENT_MASK_GPTY_BIT_13 

GPT2n+1 Event BIT13 mask.

Function Documentation

◆ R_ELC_Open()

fsp_err_t R_ELC_Open ( elc_ctrl_t *const  p_ctrl,
elc_cfg_t const *const  p_cfg 
)

Initialize all the links in the Event Link Controller. Implements elc_api_t::open

The configuration structure passed in to this function includes links for every event source included in the ELC and sets them all at once. To set or clear an individual link use R_ELC_LinkSet and R_ELC_LinkBreak respectively.

Return values
FSP_SUCCESSInitialization was successful
FSP_ERR_ASSERTIONp_ctrl or p_cfg was NULL
FSP_ERR_ALREADY_OPENThe module is currently open

◆ R_ELC_Close()

fsp_err_t R_ELC_Close ( elc_ctrl_t *const  p_ctrl)

Globally disable ELC linking. Implements elc_api_t::close

Return values
FSP_SUCCESSThe ELC was successfully disabled
FSP_ERR_ASSERTIONp_ctrl was NULL
FSP_ERR_NOT_OPENThe module has not been opened

◆ R_ELC_SoftwareEventGenerate()

fsp_err_t R_ELC_SoftwareEventGenerate ( elc_ctrl_t *const  p_ctrl,
elc_software_event_t  event_number 
)

Generate a software event in the Event Link Controller. Implements elc_api_t::softwareEventGenerate

Return values
FSP_ERR_UNSUPPORTEDAPI not supported.

◆ R_ELC_LinkSet()

fsp_err_t R_ELC_LinkSet ( elc_ctrl_t *const  p_ctrl,
elc_peripheral_t  peripheral,
elc_event_t  signal 
)

Create a single event link. Implements elc_api_t::linkSet

Return values
FSP_SUCCESSInitialization was successful
FSP_ERR_ASSERTIONp_ctrl was NULL
FSP_ERR_NOT_OPENThe module has not been opened

◆ R_ELC_LinkBreak()

fsp_err_t R_ELC_LinkBreak ( elc_ctrl_t *const  p_ctrl,
elc_peripheral_t  peripheral 
)

Break an event link. Implements elc_api_t::linkBreak

Return values
FSP_SUCCESSEvent link broken
FSP_ERR_ASSERTIONp_ctrl was NULL
FSP_ERR_NOT_OPENThe module has not been opened

◆ R_ELC_Enable()

fsp_err_t R_ELC_Enable ( elc_ctrl_t *const  p_ctrl)

Enable the operation of the Event Link Controller. Implements elc_api_t::enable

Return values
FSP_ERR_UNSUPPORTEDAPI not supported.

◆ R_ELC_Disable()

fsp_err_t R_ELC_Disable ( elc_ctrl_t *const  p_ctrl)

Disable the operation of the Event Link Controller. Implements elc_api_t::disable

Return values
FSP_ERR_UNSUPPORTEDAPI not supported.