RZV Flexible Software Package Documentation  Release v3.0.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 MPUs. 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 ADC when the GPT00 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.
Interrupt and event signals are exclusive output controlled. Signals that can be handled as either interrupt signals or event signals are no longer output as interrupt signals when linked to peripherals by the ELC module. Interrupt and/or event signals are listed in the User's Manual for your device.

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.

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
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 RZ Configuration editor. */
static const elc_cfg_t g_elc_cfg =
{
.link[ELC_PERIPHERAL_GPT0_ACT0] = ELC_EVENT_SW_EVENT_0,
.link[ELC_PERIPHERAL_GPT0_ACT1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT0_ACT2] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT0_ACT3] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT0_ACT4] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT0_ACT5] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT0_ACT6] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT0_ACT7] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT2] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT3] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT4] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT5] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT6] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GPT1_ACT7] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ADC0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_TSU0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_TSU1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_INPORTGR1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_INPORTGR0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_SINGLEPORT0] = ELC_EVENT_GPT_U0_GPT_ELCOVF_0,
.link[ELC_PERIPHERAL_SINGLEPORT1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_SINGLEPORT2] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_SINGLEPORT3] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_OUTPORTGR0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_OUTPORTGR1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH0_TGR0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH0_TGR1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH0_TGR2] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH0_TGR3] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH1_TGR0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH1_TGR1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH1_TGR2] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_GBETH1_TGR3] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC0] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC1] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC2] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC3] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC4] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC5] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC6] = ELC_EVENT_NONE,
.link[ELC_PERIPHERAL_ICU_DMAC7] = ELC_EVENT_NONE
};
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, ELC_EVENT_GPT_U0_GPT_ELCOVF_0);
handle_error(err);
}

Data Structures

struct  elc_instance_ctrl_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.

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_SUCCESSInitialization was successful
FSP_ERR_ASSERTIONInvalid event number or p_ctrl was NULL
FSP_ERR_NOT_OPENThe module has not been opened

◆ 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.