RZ/A Flexible Software Package Documentation  Release v3.0.0

 
External IRQ (r_intc_tint)

Functions

fsp_err_t R_INTC_TINT_ExternalIrqOpen (external_irq_ctrl_t *const p_api_ctrl, external_irq_cfg_t const *const p_cfg)
 
fsp_err_t R_INTC_TINT_ExternalIrqEnable (external_irq_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_INTC_TINT_ExternalIrqDisable (external_irq_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_INTC_TINT_ExternalIrqCallbackSet (external_irq_ctrl_t *const p_api_ctrl, void(*p_callback)(external_irq_callback_args_t *), void const *const p_context, external_irq_callback_args_t *const p_callback_memory)
 
fsp_err_t R_INTC_TINT_ExternalIrqClose (external_irq_ctrl_t *const p_api_ctrl)
 

Detailed Description

Driver for the INTC_TINT peripheral on RZ MPUs. This module implements the External IRQ Interface.

Overview

The Interrupt Controller controls which event signals are linked to the GIC module. The R_INTC_TINT software module only implements the External IRQ Interface. The interface is for configuring interrupts to fire when a trigger condition is detected on a TINT pin.

Note
Multiple instances are used when more than one external interrupt is needed. Configure each instance with different channels and properties as needed for the specific interrupt.

Features

Configuration

Build Time Configurations for r_intc_tint

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

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

Configurations for Input > External IRQ Driver on r_intc_tint

This module can be added to the Stacks tab via New Stack > Input > External IRQ Driver on r_intc_tint.

ConfigurationOptionsDefaultDescription
NameName must be a valid C symbolg_external_irq0 Module name.
ChannelValue must be an integer between 0 and 310 Specify the hardware channel.
GPIOINT Mapping GPIO PinMCU Specific OptionsSpecify the GPIOINT mapping GPIO pin.
Trigger
  • Rising
  • Falling
  • High Level
  • Low Level
Rising Select the signal edge or state that triggers an interrupt.
CallbackName must be a valid C symbolNULL A user callback function can be provided here. If this callback function is provided, it is called from the interrupt service routine (ISR) each time the IRQn triggers
Pin Interrupt PriorityValue must be an integer between 0 and 3124 Select the PIN interrupt priority(0-31). Note: If you specify the lowest priority (i.e.,31), no interrupt will occur.

Clock Configuration

The INTC_TINT peripheral module doesn't require any specific clock settings.

Pin Configuration

The pin for the external interrupt channel must be configured as an input with TINT Input Enabled.

Limitation

Pin configuration does not show conflicts when same TINT is used by multiple pins.

Usage Notes

Examples

Basic Example

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

#define INTC_TINT_PIN BSP_IO_PORT_00_PIN_03
#define INTC_TINT 1
/* Called from r_intc_tint_isr */
void external_irq_callback (external_irq_callback_args_t * p_args)
{
(void) p_args;
g_external_irq_complete = 1;
}
void simple_example ()
{
/* Example Configuration */
const intc_tint_extended_cfg_t g_external_irq_extend =
{
.gpioint = 3,
.tint_trigger = INTC_TINT_TRIGGER_RISING,
};
external_irq_cfg_t g_external_irq_cfg =
{
.channel = INTC_TINT,
.filter_enable = false,
.clock_source_div = EXTERNAL_IRQ_CLOCK_SOURCE_DIV_1,
.p_callback = external_irq_callback,
.p_context = 0,
.p_extend = &g_external_irq_extend,
.ipl = 24,
.irq = GPIO_TINT1_IRQn,
};
/* Configure the external interrupt. */
fsp_err_t err = R_INTC_TINT_ExternalIrqOpen(&g_external_irq_ctrl, &g_external_irq_cfg);
assert(FSP_SUCCESS == err);
/* Enable the external interrupt. */
err = R_INTC_TINT_ExternalIrqEnable(&g_external_irq_ctrl);
assert(FSP_SUCCESS == err);
while (0 == g_external_irq_complete)
{
/* Wait for interrupt. */
}
}

Data Structures

struct  intc_tint_instance_ctrl_t
 
struct  intc_tint_extended_cfg_t
 

Typedefs

typedef uint8_t intc_tint_gpioint_t
 

Enumerations

enum  intc_tint_trigger_t
 

Data Structure Documentation

◆ intc_tint_instance_ctrl_t

struct intc_tint_instance_ctrl_t

INTC_TINT private control block. DO NOT MODIFY. Initialization occurs when R_INTC_TINT_ExternalIrqOpen is called.

Data Fields

uint32_t open
 Used to determine if channel control block is in use.
 
IRQn_Type irq
 Interrupt number.
 
uint8_t channel
 Channel.
 
void const * p_context
 

Field Documentation

◆ p_context

void const* intc_tint_instance_ctrl_t::p_context

Placeholder for user data. Passed to the user callback in external_irq_callback_args_t.

◆ intc_tint_extended_cfg_t

struct intc_tint_extended_cfg_t

INTC_TINT configuration extension.

Data Fields
intc_tint_gpioint_t gpioint GPIOINT number.
intc_tint_trigger_t tint_trigger TINT trigger.

Typedef Documentation

◆ intc_tint_gpioint_t

typedef uint8_t intc_tint_gpioint_t

INTC_TINT GPIOINT number.

Enumeration Type Documentation

◆ intc_tint_trigger_t

TINT trigger condition.

Enumerator
INTC_TINT_TRIGGER_RISING 

Rising edge trigger.

INTC_TINT_TRIGGER_FALLING 

Falling edge trigger.

INTC_TINT_TRIGGER_LEVEL_HIGH 

High level trigger.

INTC_TINT_TRIGGER_LEVEL_LOW 

Low level trigger.

Function Documentation

◆ R_INTC_TINT_ExternalIrqOpen()

fsp_err_t R_INTC_TINT_ExternalIrqOpen ( external_irq_ctrl_t *const  p_api_ctrl,
external_irq_cfg_t const *const  p_cfg 
)

Configure a TINT input pin for use with the external interrupt interface. Implements external_irq_api_t::open.

The Open function is responsible for preparing a TINT pin for operation.

Return values
FSP_SUCCESSOpen successful.
FSP_ERR_ASSERTIONOne of the following is invalid:
  • p_ctrl or p_cfg is NULL
FSP_ERR_ALREADY_OPENThe channel specified has already been opened. No configurations were changed. Call the associated Close function to reconfigure the channel.
FSP_ERR_IP_CHANNEL_NOT_PRESENTThe channel requested in p_cfg is not available on the device selected in r_bsp_cfg.h.
Note
This function is reentrant for different channels. It is not reentrant for the same channel.

◆ R_INTC_TINT_ExternalIrqEnable()

fsp_err_t R_INTC_TINT_ExternalIrqEnable ( external_irq_ctrl_t *const  p_api_ctrl)

Enable external interrupt for specified channel. Implements external_irq_api_t::enable.

Return values
FSP_SUCCESSInterrupt Enabled successfully.
FSP_ERR_ASSERTIONThe p_ctrl parameter was null.
FSP_ERR_NOT_OPENThe channel is not opened.
FSP_ERR_IRQ_BSP_DISABLEDRequested IRQ is not defined in this system.

◆ R_INTC_TINT_ExternalIrqDisable()

fsp_err_t R_INTC_TINT_ExternalIrqDisable ( external_irq_ctrl_t *const  p_api_ctrl)

Disable external interrupt for specified channel. Implements external_irq_api_t::disable.

Return values
FSP_SUCCESSInterrupt disabled successfully.
FSP_ERR_ASSERTIONThe p_ctrl parameter was null.
FSP_ERR_NOT_OPENThe channel is not opened.
FSP_ERR_IRQ_BSP_DISABLEDRequested IRQ is not defined in this system.

◆ R_INTC_TINT_ExternalIrqCallbackSet()

fsp_err_t R_INTC_TINT_ExternalIrqCallbackSet ( external_irq_ctrl_t *const  p_api_ctrl,
void(*)(external_irq_callback_args_t *)  p_callback,
void const *const  p_context,
external_irq_callback_args_t *const  p_callback_memory 
)

Updates the user callback and has option of providing memory for callback structure. Implements external_irq_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_INTC_TINT_ExternalIrqClose()

fsp_err_t R_INTC_TINT_ExternalIrqClose ( external_irq_ctrl_t *const  p_api_ctrl)

Close the external interrupt channel. Implements external_irq_api_t::close.

Return values
FSP_SUCCESSSuccessfully closed.
FSP_ERR_ASSERTIONThe parameter p_ctrl is NULL.
FSP_ERR_NOT_OPENThe channel is not opened.