![]() |
RX Flexible Software Package Documentation
Release v1.0.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 RX 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 |
|---|---|---|---|
| General > Event Link Option Settings > CMT > CMT1 | MCU Specific Options | Event Link Option Setting Register CMT | |
| General > Event Link Option Settings > CMTW > CMTW0 | MCU Specific Options | Event Link Option Setting Register CMTW | |
| General > Event Link Option Settings > TMR > TMR0 | MCU Specific Options | Event Link Option Setting Register TMR | |
| General > Event Link Option Settings > TMR > TMR1 | MCU Specific Options | Event Link Option Setting Register TMR | |
| General > Event Link Option Settings > TMR > TMR2 | MCU Specific Options | Event Link Option Setting Register TMR | |
| General > Event Link Option Settings > TMR > TMR3 | MCU Specific Options | Event Link Option Setting Register TMR | |
| General > 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. |
| Interrupts > ELC1 Interrupt Priority | MCU Specific Options | Select the ELC interrupt 1 priority. | |
| Interrupts > ELC2 Interrupt Priority | MCU Specific Options | Select the ELC interrupt 2 priority. | |
| Interrupts > ELC3 Interrupt Priority | MCU Specific Options | Select the ELC interrupt 3 priority. | |
| Interrupts > ELC4 Interrupt Priority | MCU Specific Options | Select the ELC interrupt 4 priority. | |
| Interrupts > Callback | Name must be a valid C symbol | NULL | A user callback function can be provided. If this callback function is provided, it will be called from the interrupt service routine (ISR). |
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_callback_args_t |
| struct | elc_cfg_extend_t |
| struct | elc_instance_ctrl_t |
Enumerations | |
| enum | elc_operation_option_t |
| struct elc_callback_args_t |
Event link callback arguments definitions
| Data Fields | ||
|---|---|---|
| elc_interrupt_t | event | ELC interrupt event. |
| void * | p_context | Placeholder for user data. |
| struct elc_cfg_extend_t |
Extended configuration for ELC.
Data Fields | |
| elc_operation_option_t | cmt1_md |
| CMT1 Operation Select (placed at ELOPA[3:2]) | |
| elc_operation_option_t | cmtw0_md |
| CMTW0 Operation Select (placed at ELOPB[1:0]) | |
| elc_operation_option_t | tmr0_md |
| TMR0 Operation Select (placed at ELOPC[1:0]) | |
| elc_operation_option_t | tmr1_md |
| TMR1 Operation Select (placed at ELOPC[3:2]) | |
| elc_operation_option_t | tmr2_md |
| TMR2 Operation Select (placed at ELOPD[1:0]) | |
| elc_operation_option_t | tmr3_md |
| TMR3 Operation Select (placed at ELOPD[3:2]) | |
| uint32_t | ipl [ELC_INTERRUPT_NUM] |
| ELC interrupt priority. | |
| IRQn_Type | irq [ELC_INTERRUPT_NUM] |
| ELC interrupt IRQ number. | |
| void(* | p_callback )(elc_callback_args_t *p_args) |
| Pointer to callback function. | |
| void * | p_context |
| User defined context passed into callback function. | |
| 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 |