RZV Flexible Software Package Documentation  Release v3.0.0

 
Port Output Enable for GPT (r_poeg)

Functions

fsp_err_t R_POEG_Open (poeg_ctrl_t *const p_ctrl, poeg_cfg_t const *const p_cfg)
 
fsp_err_t R_POEG_StatusGet (poeg_ctrl_t *const p_ctrl, poeg_status_t *const p_status)
 
fsp_err_t R_POEG_CallbackSet (poeg_ctrl_t *const p_ctrl, void(*p_callback)(poeg_callback_args_t *), void const *const p_context, poeg_callback_args_t *const p_callback_memory)
 
fsp_err_t R_POEG_OutputDisable (poeg_ctrl_t *const p_ctrl)
 
fsp_err_t R_POEG_Reset (poeg_ctrl_t *const p_ctrl)
 
fsp_err_t R_POEG_Close (poeg_ctrl_t *const p_ctrl)
 

Detailed Description

Driver for the POEG peripheral on RZ MPUs. This module implements the POEG Interface.

Overview

The POEG module can be used to configure events to disable GPT GTIOC output pins.

Features

The POEG module has the following features:

Configuration

Build Time Configurations for r_poeg

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

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.

Configurations for Timers > Port Output Enable for GPT (r_poeg)

ConfigurationOptionsDefaultDescription
General > NameName must be a valid C symbolg_poeg0 Module name.
General > ChannelChannel number must be a positive integer0 Specify the hardware channel.
General > TriggerMCU Specific OptionsSelect the trigger sources that will enable POEG. Software disable is always supported. This configuration can only be set once after reset. It cannot be modified after the initial setting.
Input > GTETRG Polarity
  • Active High
  • Active Low
Active High Select the polarity of the GTETRG pin. Only applicable if GTETRG pin is selected under Trigger.
Input > GTETRG Noise Filter
  • Disabled
  • Clock source / 1
  • Clock source / 8
  • Clock source / 32
  • Clock source / 128
module.driver.poeg.noise_filter.gtetrg_noise_filter_p0_div_1 Configure the noise filter for the GTETRG pin. Only applicable if GTETRG pin is selected under Trigger.
Interrupts > CallbackName must be a valid C symbolNULL A user callback function can be specified here. If this callback function is provided, it will be called from the interrupt service routine (ISR) when GPT output pins are disabled by POEG.
Interrupts > POEG Interrupt EnableMCU Specific OptionsEnable the POEG interrupt.
Interrupts > Interrupt PriorityValue must be an integer between 0 and 2554 Select the POEG interrupt priority.

Clock Configuration

The POEG clock is based on the P0 clock frequency.

Pin Configuration

This module can use GTETRGA, GTETRGB, GTETRGC, or GTETRGD as an input signal to disable GPT output pins.

Usage Notes

POEG GTETRG Pin and Channel

The POEG channel number corresponds to the GTETRG input pin that can be used with the channel. GTETRGA must be used with POEG channel 0, GTETRGB must be used with POEG channel 1, etc.

Limitations

The user should be aware of the following limitations when using POEG:

Examples

POEG Basic Example

This is a basic example of minimal use of the POEG in an application.

void poeg_basic_example (void)
{
fsp_err_t err = FSP_SUCCESS;
/* Initializes the POEG. */
err = R_POEG_Open(&g_poeg0_ctrl, &g_poeg0_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
}

POEG Callback Example

This is an example of a using the POEG callback to restore GPT output operation.

/* Example callback called when POEG disables GPT output pins. */
void poeg_callback (poeg_callback_args_t * p_args)
{
/* (Optional) Determine the cause of the POEG event. */
poeg_status_t status;
(void) R_POEG_StatusGet(&g_poeg0_ctrl, &status);
/* Correct the cause of the POEG event before resetting POEG. */
/* Reset the POEG before exiting the callback. */
(void) R_POEG_Reset(&g_poeg0_ctrl);
/* Wait for the status to clear after reset before exiting the callback to ensure the interrupt does not fire
* again. */
do
{
(void) R_POEG_StatusGet(&g_poeg0_ctrl, &status);
} while (POEG_STATE_NO_DISABLE_REQUEST != status.state);
/* Alternatively, if the POEG cannot be reset, disable the POEG interrupt to prevent it from firing continuously.
* Update the 0 in the macro below to match the POEG channel number. */
NVIC_DisableIRQ(BSP_VECTOR_IRQ_POEG_GROUP0);
}

Data Structures

struct  poeg_instance_ctrl_t
 

Data Structure Documentation

◆ poeg_instance_ctrl_t

struct poeg_instance_ctrl_t

Channel control block. DO NOT INITIALIZE. Initialization occurs when poeg_api_t::open is called.

Function Documentation

◆ R_POEG_Open()

fsp_err_t R_POEG_Open ( poeg_ctrl_t *const  p_ctrl,
poeg_cfg_t const *const  p_cfg 
)

Initializes the POEG module and applies configurations. Implements poeg_api_t::open.

Note
The poeg_cfg_t::trigger setting can only be configured once after reset. Reopening with a different trigger configuration is not possible.
Return values
FSP_SUCCESSInitialization was successful.
FSP_ERR_ASSERTIONA required input pointer is NULL or the source divider is invalid.
FSP_ERR_ALREADY_OPENModule is already open.
FSP_ERR_IRQ_BSP_DISABLEDpoeg_cfg_t::p_callback is not NULL, but ISR is not enabled. ISR must be enabled to use callback.
FSP_ERR_IP_CHANNEL_NOT_PRESENTThe channel requested in the p_cfg parameter is not available on this device.

◆ R_POEG_StatusGet()

fsp_err_t R_POEG_StatusGet ( poeg_ctrl_t *const  p_ctrl,
poeg_status_t *const  p_status 
)

Get current POEG status and store it in provided pointer p_status. Implements poeg_api_t::statusGet.

Return values
FSP_SUCCESSCurrent POEG state stored successfully.
FSP_ERR_ASSERTIONp_ctrl or p_status was NULL.
FSP_ERR_NOT_OPENThe instance is not opened.

◆ R_POEG_CallbackSet()

fsp_err_t R_POEG_CallbackSet ( poeg_ctrl_t *const  p_ctrl,
void(*)(poeg_callback_args_t *)  p_callback,
void const *const  p_context,
poeg_callback_args_t *const  p_callback_memory 
)

Updates the user callback with the option to provide memory for the callback argument structure. Implements poeg_api_t::callbackSet.

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_NO_CALLBACK_MEMORYp_callback is non-secure and p_callback_memory is either secure or NULL.

◆ R_POEG_OutputDisable()

fsp_err_t R_POEG_OutputDisable ( poeg_ctrl_t *const  p_ctrl)

Disables GPT output pins. Implements poeg_api_t::outputDisable.

Return values
FSP_SUCCESSGPT output pins successfully disabled.
FSP_ERR_ASSERTIONp_ctrl was NULL.
FSP_ERR_NOT_OPENThe instance is not opened.

◆ R_POEG_Reset()

fsp_err_t R_POEG_Reset ( poeg_ctrl_t *const  p_ctrl)

Resets status flags. Implements poeg_api_t::reset.

Note
Status flags are only reset if the original POEG trigger is resolved. Check the status using R_POEG_StatusGet after calling this function to verify the status is cleared.
Return values
FSP_SUCCESSFunction clear status flags successfully.
FSP_ERR_ASSERTIONp_ctrl was NULL.
FSP_ERR_NOT_OPENThe instance is not opened.
FSP_ERR_NOT_INITIALIZEDThe GPT status flags was not clear before the attempt to clear IOCF flag.

◆ R_POEG_Close()

fsp_err_t R_POEG_Close ( poeg_ctrl_t *const  p_ctrl)

Disables POEG interrupt. Implements poeg_api_t::close.

Note
This function does not disable the POEG.
Return values
FSP_SUCCESSSuccessful close.
FSP_ERR_ASSERTIONp_ctrl was NULL.
FSP_ERR_NOT_OPENThe instance is not opened.