RZT Flexible Software Package Documentation  Release v2.2.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 microprocessor. 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.
Multiplex Interrupt
  • Enabled
  • Disabled
Disabled Enable multiplex interrupt for a single driver.

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

This module can be added to the Stacks tab via New Stack > Timers > Port Output Enable for GPT (r_poeg).

ConfigurationOptionsDefaultDescription
General > NameName must be a valid C symbolg_poeg0 Module name.
General > ChannelMust be a valid POEG channel0 Specify the hardware channel.
General > Group
  • A
  • B
  • C
  • D
A Specify the hardware channel grpup.
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(Base clock CH0=PCLKH, Other=PCLKL)
  • Disabled
  • DIV 1
  • DIV 8
  • DIV 32
  • DIV 128
Disabled 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 > Interrupt PriorityMCU Specific OptionsSelect the POEG interrupt priority.

Clock Configuration

The POEG clock is based on the PCLKL/PCLKH frequency. (PCLKH for LLPP and PCLKL for NONSAFETY and SAFETY).

Pin Configuration

This module can use GTETRGA, GTETRGB, GTETRGC, or GTETRGD and GTETRGSA, GTETRGSB 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, GTETRGB, GTETRGC, or GTETRGD must be used with POEG channel 0, 1(LLPP, NONSAFETY), GTETRGSA, GTETRGSB must be used with POEG channel 2(SAFETY), etc.

Limitations

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

NOTE

The POEG interrupt type is a level interrupt. Please do the following: When clearing the interrupt status in interrupt processing, Check the interrupt status is cleared before terminating interrupt processing.

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. */
handle_error(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);
}

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.
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.
FSP_ERR_IP_UNIT_NOT_PRESENTThe Unit 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.

◆ 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 attempted to clear status flags.
FSP_ERR_ASSERTIONp_ctrl was NULL.
FSP_ERR_NOT_OPENThe instance is not opened.

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