RA Flexible Software Package Documentation
Release v5.7.0
|
|
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) |
Driver for the ELC peripheral on RA MCUs. This module implements the ELC Interface.
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 interrupt triggers a timer which later triggers an ADC conversion and CTSU scan, while at the same time a serial communication interrupt automatically starts a data transfer. These tasks would be automatically handled without the need for polling or interrupt management.
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 ADC0 Group A when the GPT0 counter overflows:
The ELC HAL module can perform the following functions:
A variety of functions can be activated via events, including:
To manually link an event to a peripheral at runtime perform the following steps:
To disable the event, either use R_ELC_LinkBreak to clear the link for a specific event or R_ELC_Disable to globally disable event linking.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | ELC instance name must be g_elc to match elc_cfg_t data structure created in elc_data.c | g_elc | Module name. Fixed to g_elc. |
Developers should be aware of the following limitations when using the ELC:
Below is a basic example of minimal use of event linking in an application.
This example demonstrates how to use a software-generated event to signal a peripheral. This can be useful when the desired event source is not supported by the ELC hardware.
Data Structures | |
struct | elc_instance_ctrl_t |
struct elc_instance_ctrl_t |
ELC private control block. DO NOT MODIFY. Initialization occurs when R_ELC_Open() is called.
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.
Example:
FSP_SUCCESS | Initialization was successful |
FSP_ERR_ASSERTION | p_ctrl or p_cfg was NULL |
FSP_ERR_ALREADY_OPEN | The module is currently open |
fsp_err_t R_ELC_Close | ( | elc_ctrl_t *const | p_ctrl | ) |
Globally disable ELC linking. Implements elc_api_t::close
FSP_SUCCESS | The ELC was successfully disabled |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
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
Example:
FSP_SUCCESS | Initialization was successful |
FSP_ERR_ASSERTION | Invalid event number or p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
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
Example:
FSP_SUCCESS | Initialization was successful |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
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
FSP_SUCCESS | Event link broken |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
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
FSP_SUCCESS | ELC enabled. |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
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
FSP_SUCCESS | ELC disabled. |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |