RZT Flexible Software Package Documentation  Release v2.2.0

 
I/O Ports (r_ioport)

Functions

fsp_err_t R_IOPORT_Open (ioport_ctrl_t *const p_ctrl, const ioport_cfg_t *p_cfg)
 
fsp_err_t R_IOPORT_Close (ioport_ctrl_t *const p_ctrl)
 
fsp_err_t R_IOPORT_PinsCfg (ioport_ctrl_t *const p_ctrl, const ioport_cfg_t *p_cfg)
 
fsp_err_t R_IOPORT_PinCfg (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, uint32_t cfg)
 
fsp_err_t R_IOPORT_PinEventInputRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t *p_pin_event)
 
fsp_err_t R_IOPORT_PinEventOutputWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t pin_value)
 
fsp_err_t R_IOPORT_PinRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t *p_pin_value)
 
fsp_err_t R_IOPORT_PinWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_pin_t pin, bsp_io_level_t level)
 
fsp_err_t R_IOPORT_PortDirectionSet (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t direction_values, ioport_size_t mask)
 
fsp_err_t R_IOPORT_PortEventInputRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t *p_event_data)
 
fsp_err_t R_IOPORT_PortEventOutputWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t event_data, ioport_size_t mask_value)
 
fsp_err_t R_IOPORT_PortRead (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t *p_port_value)
 
fsp_err_t R_IOPORT_PortWrite (ioport_ctrl_t *const p_ctrl, bsp_io_port_t port, ioport_size_t value, ioport_size_t mask)
 

Detailed Description

Driver for the I/O Ports peripheral on RZ microprocessors. This module implements the I/O Port Interface.

Overview

The I/O port pins operate as general I/O port pins, I/O pins for peripheral modules, interrupt input pins, analog I/O, memory region for safety region or non safety region.

Features

The IOPORT HAL module can configure the following pin settings:

The module also provides the following functionality:

Configuration

The I/O PORT HAL module must be configured by the user for the desired operation. The operating state of an I/O pin can be set via the FSP Configuration tool. When the project is built a pin configuration file is created. The BSP will automatically configure the MPU IO ports accordingly at startup using the same API functions mentioned in this document.

Build Time Configurations for r_ioport

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

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

Configurations for System > I/O Port (r_ioport)

This module can be added to the Stacks tab via New Stack > System > I/O Port (r_ioport).

ConfigurationOptionsDefaultDescription
General > NameName must be a valid C symbolg_ioport Module name.
ELC Output Port Group 1 > Trigger SourceMCU Specific OptionsELC source that will trigger Output port group 1
ELC Output Port Group 1 > Port Selection
  • PIN0
  • PIN1
  • PIN2
  • PIN3
  • PIN4
  • PIN5
  • PIN6
  • PIN7
Select multiple port number that specify in Ouput port group 1
ELC Output Port Group 1 > Output Operation
  • Low output
  • High output
  • Toggle output
  • Buffer output
Low output Select output operation for Output port group 1. When select toggle output, the target Port m Mode register should be set to 11b: Output (Output data is input to input buffer)
ELC Output Port Group 2 > Trigger SourceMCU Specific OptionsELC source that will trigger Output port group 2
ELC Output Port Group 2 > Port Selection
  • PIN0
  • PIN1
  • PIN2
  • PIN3
  • PIN4
  • PIN5
  • PIN6
  • PIN7
Select multiple port number that specify in Ouput port group 2
ELC Output Port Group 2 > Output Operation
  • Low output
  • High output
  • Toggle output
  • Buffer output
Low output Select output operation for Output port group 2. When select toggle output, the target Port m Mode register should be set to 11b: Output (Output data is input to input buffer)
ELC Input Port Group 1 > Buffer Initial Value > PIN0MCU Specific OptionsSet initial input state for group1 pin0
ELC Input Port Group 1 > Buffer Initial Value > PIN1MCU Specific OptionsSet initial input state for group1 pin1
ELC Input Port Group 1 > Buffer Initial Value > PIN2MCU Specific OptionsSet initial input state for group1 pin2
ELC Input Port Group 1 > Buffer Initial Value > PIN3MCU Specific OptionsSet initial input state for group1 pin3
ELC Input Port Group 1 > Buffer Initial Value > PIN4MCU Specific OptionsSet initial input state for group1 pin4
ELC Input Port Group 1 > Buffer Initial Value > PIN5MCU Specific OptionsSet initial input state for group1 pin5
ELC Input Port Group 1 > Buffer Initial Value > PIN6MCU Specific OptionsSet initial input state for group1 pin6
ELC Input Port Group 1 > Buffer Initial Value > PIN7MCU Specific OptionsSet initial input state for group1 pin7
ELC Input Port Group 1 > Trigger SourceMCU Specific OptionsELC source that will trigger Input port group 1
ELC Input Port Group 1 > Event Link Control
  • Disabled
  • Enabled
Disabled Set input port group 1 enablement
ELC Input Port Group 1 > Port Selection
  • PIN0
  • PIN1
  • PIN2
  • PIN3
  • PIN4
  • PIN5
  • PIN6
  • PIN7
Select multiple port number that specify in Input port group 1
ELC Input Port Group 1 > Edge Detection
  • Rising edge
  • Falling edge
  • Both edge
Rising edge Select edge detection that will trigger Input port group 1
ELC Input Port Group 1 > Buffer Overwrite
  • Disabled
  • Enabled
Disabled Set whether preventing overwriting ELC Port Buffer Register before reading it
ELC Input Port Group 2 > Buffer Initial Value > PIN0MCU Specific OptionsSet initial input state for group2 pin0
ELC Input Port Group 2 > Buffer Initial Value > PIN1MCU Specific OptionsSet initial input state for group2 pin1
ELC Input Port Group 2 > Buffer Initial Value > PIN2MCU Specific OptionsSet initial input state for group2 pin2
ELC Input Port Group 2 > Buffer Initial Value > PIN3MCU Specific OptionsSet initial input state for group2 pin3
ELC Input Port Group 2 > Buffer Initial Value > PIN4MCU Specific OptionsSet initial input state for group2 pin4
ELC Input Port Group 2 > Buffer Initial Value > PIN5MCU Specific OptionsSet initial input state for group2 pin5
ELC Input Port Group 2 > Buffer Initial Value > PIN6MCU Specific OptionsSet initial input state for group2 pin6
ELC Input Port Group 2 > Buffer Initial Value > PIN7MCU Specific OptionsSet initial input state for group2 pin7
ELC Input Port Group 2 > Trigger SourceMCU Specific OptionsELC source that will trigger Input port group 2
ELC Input Port Group 2 > Event Link Control
  • Disabled
  • Enabled
Disabled Set input port group 2 enablement
ELC Input Port Group 2 > Port Selection
  • PIN0
  • PIN1
  • PIN2
  • PIN3
  • PIN4
  • PIN5
  • PIN6
  • PIN7
Select multiple port number that specify in Input port group 2
ELC Input Port Group 2 > Edge Detection
  • Rising edge
  • Falling edge
  • Both edge
Rising edge Select edge detection that will trigger Input port group 2
ELC Input Port Group 2 > Buffer Overwrite
  • Disabled
  • Enabled
Disabled Set whether preventing overwriting ELC Port Buffer Register before reading it
ELC Single Port 0 > Common > Event Link Control
  • Disabled
  • Enabled
Disabled Set single port 0 enablement
ELC Single Port 0 > Common > Event Direction
  • Output direction
  • Input direction
Output direction Select event direction for Single port 0
ELC Single Port 0 > Common > Port selectionMCU Specific OptionsSelect port number for Single port 0
ELC Single Port 0 > Output Direction Setting > Trigger SourceMCU Specific OptionsELC source that will trigger Single output port 0
ELC Single Port 0 > Output Direction Setting > Output Operation
  • Low output
  • High output
  • Toggle output
Low output Select output operation for Single output port 0. When select toggle output, the target Port m Mode register should be set to 11b: Output (Output data is input to input buffer)
ELC Single Port 0 > Input Direction Setting > Edge Detection
  • Rising edge
  • Falling edge
  • Both edge
Rising edge Select edge detection that will trigger Single input port 0
ELC Single Port 1 > Common > Event Link Control
  • Disabled
  • Enabled
Disabled Set single port 1 enablement
ELC Single Port 1 > Common > Event Direction
  • Output direction
  • Input direction
Output direction Select event direction for Single port 1
ELC Single Port 1 > Common > Port selectionMCU Specific OptionsSelect port number for Single port 1
ELC Single Port 1 > Output Direction Setting > Trigger SourceMCU Specific OptionsELC source that will trigger Single output port 1
ELC Single Port 1 > Output Direction Setting > Output Operation
  • Low output
  • High output
  • Toggle output
Low output Select output operation for Single output port 1. When select toggle output, the target Port m Mode register should be set to 11b: Output (Output data is input to input buffer)
ELC Single Port 1 > Input Direction Setting > Edge Detection
  • Rising edge
  • Falling edge
  • Both edge
Rising edge Select edge detection that will trigger Single input port 1
ELC Single Port 2 > Common > Event Link Control
  • Disabled
  • Enabled
Disabled Set single port 2 enablement
ELC Single Port 2 > Common > Event Direction
  • Output direction
  • Input direction
Output direction Select event direction for Single port 2
ELC Single Port 2 > Common > Port selectionMCU Specific OptionsSelect port number for Single port 2
ELC Single Port 2 > Output Direction Setting > Trigger SourceMCU Specific OptionsELC source that will trigger Single output port 2
ELC Single Port 2 > Output Direction Setting > Output Operation
  • Low output
  • High output
  • Toggle output
Low output Select output operation for Single output port 2. When select toggle output, the target Port m Mode register should be set to 11b: Output (Output data is input to input buffer)
ELC Single Port 2 > Input Direction Setting > Edge Detection
  • Rising edge
  • Falling edge
  • Both edge
Rising edge Select edge detection that will trigger Single input port 2
ELC Single Port 3 > Common > Event Link Control
  • Disabled
  • Enabled
Disabled Set single port 3 enablement
ELC Single Port 3 > Common > Event Direction
  • Output direction
  • Input direction
Output direction Select event direction for Single port 3
ELC Single Port 3 > Common > Port selectionMCU Specific OptionsSelect port number for Single port 3
ELC Single Port 3 > Output Direction Setting > Trigger SourceMCU Specific OptionsELC source that will trigger Single output port 3
ELC Single Port 3 > Output Direction Setting > Output Operation
  • Low output
  • High output
  • Toggle output
Low output Select output operation for Single output port 3. When select toggle output, the target Port m Mode register should be set to 11b: Output (Output data is input to input buffer)
ELC Single Port 3 > Input Direction Setting > Edge Detection
  • Rising edge
  • Falling edge
  • Both edge
Rising edge Select edge detection that will trigger Single input port 3

Clock Configuration

The I/O PORT HAL module does not require a specific clock configuration.

Pin Configuration

The IOPORT module is used for configuring pins.

Usage notes

Port Group Function for ELC

Depending on pin configuration, the IOPORT module can perform automatic reads or writes on ports 16 or 18 on receipt of an ELC event. Multiple pins can be specified from ports 16 or 18 as port group function by the user.

In the input port group function, when an event is received by a port, the state of the input pins on the port is saved in a hardware register. The functions R_IOPORT_PinEventInputRead and R_IOPORT_PortEventInputRead allow reading the last event input state of pins specified to the input port group. In addition, the function can be configured to trigger an ELC event on rising, falling or both edges. This event can be used to activate other modules when the pin changes state.

In the output port group function, when an event is received by a port, the state of output pins on the port is set high, low, toggle or buffer value based on settings configured by the user. The event-triggered pin output can be configured to high or low output through R_IOPORT_PortEventOutputWrite.

Single Port Function for ELC

Depending on pin configuration, the IOPORT module can perform automatic writes or links to other module on single pin of ports 16 or 18 on receipt of an ELC event. Pins on ports 16 or 18 can be configured to four single port function by the user.

When the single port function is received an event from other modules, the state of an output pin specified as the single port function is set high, low or toggle output based on settings configured by the user. The event-triggered pin output can be configured to high or low output through R_IOPORT_PinEventOutputWrite.

In addition, a pin specified as the single port function can be configured to trigger an ELC event on rising, falling or both edges. This event can be used to activate other modules when the pin changes state.

Note
If a pin is specified as both a single port and a member of a port group, the single port function is disabled and only the port group function is enabled when the relevant pin is output.

Examples

Basic Example

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

void basic_example ()
{
bsp_io_level_t readLevel;
fsp_err_t err;
/* Initialize the IOPORT module and configure the pins
* Note: The default pin configuration name in the RZ microprocessor Configuration tool is g_bsp_pin_cfg */
err = R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
/* Handle any errors. This function should be defined by the user. */
handle_error(err);
/* Call R_IOPORT_PinsCfg if the configuration was not part of initial configurations made in open */
err = R_IOPORT_PinsCfg(&g_ioport_ctrl, &g_runtime_pin_cfg);
handle_error(err);
/* Set Pin 6 of Port 19 to High */
handle_error(err);
/* Read Pin 6 of Port 19 */
err = R_IOPORT_PinRead(&g_ioport_ctrl, BSP_IO_PORT_19_PIN_6, &readLevel);
handle_error(err);
}

Blinky Example

This example uses IOPORT to configure and toggle a pin to blink an LED.

void blinky_example ()
{
fsp_err_t err;
/* Initialize the IOPORT module and configure the pins */
err = R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
/* Handle any errors. This function should be defined by the user. */
handle_error(err);
/* Configure Pin as output
* Call the R_IOPORT_PinCfg if the configuration was not part of initial configurations made in open */
err = R_IOPORT_PinCfg(&g_ioport_ctrl, USER_LED_PORT, IOPORT_CFG_PORT_DIRECTION_OUTPUT);
handle_error(err);
while (1)
{
/* Determine the next state of the LEDs */
if (BSP_IO_LEVEL_LOW == level)
{
}
else
{
}
/* Update LED on RZ microprocessor RSK board */
err = R_IOPORT_PinWrite(&g_ioport_ctrl, USER_LED_PORT, level);
handle_error(err);
/* Delay */
}
}

ELC Example

This is an example of using IOPORT with ELC events. The ELC event system allows toggling an output pin without intervention from processor.

static elc_instance_ctrl_t g_elc_ctrl;
static elc_cfg_t g_elc_cfg;
void ioport_elc_example ()
{
fsp_err_t err;
/* Initializes the software and sets the links defined in the control structure. */
err = R_ELC_Open(&g_elc_ctrl, &g_elc_cfg);
/* Handle any errors. This function should be defined by the user. */
handle_error(err);
/* Create or modify a link between a peripheral function and an event source. */
err = R_ELC_LinkSet(&g_elc_ctrl, ELC_PERIPHERAL_SINGLEPORT1, ELC_EVENT_IOPORT_SINGLE0);
handle_error(err);
const ioport_extend_cfg_t g_ioport_cfg_extend_with_elc =
{
.single_port_cfg[IOPORT_SINGLE_PORT_0] =
{
.port_num = (uint16_t) SINGLE_INPUT_PORT0,
},
.single_port_cfg[IOPORT_SINGLE_PORT_1] =
{
.event_control = IOPORT_EVENT_CONTROL_ENABLE,
.port_num = (uint16_t) SINGLE_OUTPUT_PORT1,
},
};
const ioport_cfg_t g_bsp_with_elc_pin_cfg =
{
.number_of_pins = g_bsp_pin_cfg.number_of_pins,
.p_pin_cfg_data = g_bsp_pin_cfg.p_pin_cfg_data,
.p_extend = &g_ioport_cfg_extend_with_elc,
};
/* Initialize the IOPORT module and configure the pins with ELC configs */
err = R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_with_elc_pin_cfg);
handle_error(err);
/* Call R_IOPORT_PinsCfg if the configuration was not part of initial configurations made in open */
err = R_IOPORT_PinsCfg(&g_ioport_ctrl, &g_runtime_pin_cfg);
handle_error(err);
while (1)
{
/* ELC SINGLE_INPUT_PORT0 setting is both edge detection.
* When SINGLE_INPUT_PORT0 input is high -> low (for example, press SW on the board), high signal is output from SINGLE_OUTPUT_PORT1.
* When SINGLE_INPUT_PORT0 input is low -> high (for example, release SW on the board), low signal is output from SINGLE_OUTPUT_PORT1.
*
* This is done without intervention from processor */
;
}
}
#endif

Data Structures

struct  ioport_event_single_t
 
struct  ioport_event_group_output_t
 
struct  ioport_event_group_input_t
 
struct  ioport_extend_cfg_t
 
struct  ioport_instance_ctrl_t
 

Enumerations

enum  ioport_event_pin_selection_t
 
enum  ioport_event_output_operation_t
 
enum  ioport_event_control_t
 
enum  ioport_event_direction_t
 
enum  ioport_event_detection_t
 
enum  ioport_event_initial_buffer_value_t
 

Data Structure Documentation

◆ ioport_event_single_t

struct ioport_event_single_t

Single port configuration

Note
Event link must be configured by the ELC
Data Fields
ioport_event_control_t event_control Event link control for single port.
ioport_event_direction_t direction Event direction for single port.
uint16_t port_num Port number specified to single port.
ioport_event_output_operation_t operation Single port operation select.
ioport_event_detection_t edge_detection Edge detection select.

◆ ioport_event_group_output_t

struct ioport_event_group_output_t

Output port group configuration

Note
Event link must be configured by the ELC
Data Fields
uint8_t pin_select Port number specified to output port group.
ioport_event_output_operation_t operation Port group operation select.

◆ ioport_event_group_input_t

struct ioport_event_group_input_t

Input port group configuration

Note
Event link must be configured by the ELC
Data Fields
ioport_event_control_t event_control Event link control for input port group.
ioport_event_detection_t edge_detection Edge detection select.
ioport_event_control_t overwrite_control Buffer register overwrite control.
uint8_t pin_select Port number specified to input port group.
uint8_t buffer_init_value Buffer register initial value.

◆ ioport_extend_cfg_t

struct ioport_extend_cfg_t

IOPORT extended configuration for event link function

Note
Event link must be configured by the ELC
Data Fields
ioport_event_group_output_t port_group_output_cfg[IOPORT_PORT_GROUP_NUM] Output port group configuration.
ioport_event_group_input_t port_group_input_cfg[IOPORT_PORT_GROUP_NUM] Input port group configuration.
ioport_event_single_t single_port_cfg[IOPORT_SINGLE_PORT_NUM] Single input port configuration.

◆ ioport_instance_ctrl_t

struct ioport_instance_ctrl_t

IOPORT private control block. DO NOT MODIFY. Initialization occurs when R_IOPORT_Open() is called.

Enumeration Type Documentation

◆ ioport_event_pin_selection_t

Pin selection for port group

Note
Event link must be configured by the ELC
Enumerator
IOPORT_EVENT_PIN_SELECTION_NONE 

No pin selection for port group.

IOPORT_EVENT_PIN_SELECTION_PIN_0 

Select pin 0 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_1 

Select pin 1 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_2 

Select pin 2 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_3 

Select pin 3 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_4 

Select pin 4 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_5 

Select pin 5 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_6 

Select pin 6 to port group.

IOPORT_EVENT_PIN_SELECTION_PIN_7 

Select pin 7 to port group.

◆ ioport_event_output_operation_t

Port group operation

Note
Event link must be configured by the ELC
Enumerator
IOPORT_EVENT_OUTPUT_OPERATION_LOW 

Set Low output to output operation.

IOPORT_EVENT_OUTPUT_OPERATION_HIGH 

Set High output to output operation.

IOPORT_EVENT_OUTPUT_OPERATION_TOGGLE 

Set toggle output to output operation.

IOPORT_EVENT_OUTPUT_OPERATION_BUFFER 

Set buffer value output to output operation.

◆ ioport_event_control_t

Input port group event control

Note
Event link must be configured by the ELC
Enumerator
IOPORT_EVENT_CONTROL_DISABLE 

Disable function related with event link.

IOPORT_EVENT_CONTROL_ENABLE 

Enable function related with event link.

◆ ioport_event_direction_t

Single port event direction

Note
Event link must be configured by the ELC
Enumerator
IOPORT_EVENT_DIRECTION_OUTPUT 

Set output direction to single port.

IOPORT_EVENT_DIRECTION_INPUT 

Set input direction to single port.

◆ ioport_event_detection_t

Input event edge detection

Note
Event link must be configured by the ELC
Enumerator
IOPORT_EVENT_DETECTION_RISING_EDGE 

Set rising edge to event detection for input event.

IOPORT_EVENT_DETECTION_FALLING_EDGE 

Set falling edge to event detection for input event.

IOPORT_EVENT_DETECTION_BOTH_EGDE 

Set both edges to event detection for input event.

◆ ioport_event_initial_buffer_value_t

Initial value for buffer register

Note
Event link must be configured by the ELC
Enumerator
IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW 

Set low input to initial value of buffer register for input port group.

IOPORT_EVENT_INITIAL_BUFFER_VALUE_HIGH 

Set high input to initial value of buffer register for input port group.

Function Documentation

◆ R_IOPORT_Open()

fsp_err_t R_IOPORT_Open ( ioport_ctrl_t *const  p_ctrl,
const ioport_cfg_t p_cfg 
)

Initializes internal driver data, then calls pin configuration function to configure pins.

Return values
FSP_SUCCESSPin configuration data written to the multiple registers
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_ALREADY_OPENModule is already open.

◆ R_IOPORT_Close()

fsp_err_t R_IOPORT_Close ( ioport_ctrl_t *const  p_ctrl)

Resets IOPORT registers. Implements ioport_api_t::close

Return values
FSP_SUCCESSThe IOPORT was successfully uninitialized
FSP_ERR_ASSERTIONp_ctrl was NULL
FSP_ERR_NOT_OPENThe module has not been opened

◆ R_IOPORT_PinsCfg()

fsp_err_t R_IOPORT_PinsCfg ( ioport_ctrl_t *const  p_ctrl,
const ioport_cfg_t p_cfg 
)

Configures the functions of multiple pins by loading configuration data into the multiple registers. Implements ioport_api_t::pinsCfg.

This function initializes the supplied list of the multiple registers with the supplied values. This data can be generated by the Pins tab of the RZ/T2M Configuration editor or manually by the developer. Different pin configurations can be loaded for different situations such as low power modes and testing.

Return values
FSP_SUCCESSPin configuration data written to the multiple registers
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer

◆ R_IOPORT_PinCfg()

fsp_err_t R_IOPORT_PinCfg ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
uint32_t  cfg 
)

Configures the settings of a pin. Implements ioport_api_t::pinCfg.

Return values
FSP_SUCCESSPin configured
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different pins. This function will change the configuration of the pin with the new configuration. For example it is not possible with this function to change the drive strength of a pin while leaving all the other pin settings unchanged. To achieve this the original settings with the required change will need to be written using this function.

◆ R_IOPORT_PinEventInputRead()

fsp_err_t R_IOPORT_PinEventInputRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t p_pin_event 
)

Reads the value of the event input data of a specific pin. Implements ioport_api_t::pinEventInputRead.

The pin event data is captured in response to a trigger from the ELC. This function enables this data to be read. Using the event system allows the captured data to be stored when it occurs and then read back at a later time.

Return values
FSP_SUCCESSPin read
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_INVALID_ARGUMENTPort is not valid ELC PORT.

◆ R_IOPORT_PinEventOutputWrite()

fsp_err_t R_IOPORT_PinEventOutputWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t  pin_value 
)

This function writes the event output data value to a pin. Implements ioport_api_t::pinEventOutputWrite.

Using the event system enables a pin state to be stored by this function in advance of being output on the pin. The output to the pin will occur when the ELC event occurs.

Return values
FSP_SUCCESSPin event data written
FSP_ERR_INVALID_ARGUMENTPort or Pin or value not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer

◆ R_IOPORT_PinRead()

fsp_err_t R_IOPORT_PinRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t p_pin_value 
)

Reads the level on a pin. Implements ioport_api_t::pinRead.

The level for the specifed pin will be reterned by PINm register.

Return values
FSP_SUCCESSPin read
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
Note
This function is re-entrant for different pins.

◆ R_IOPORT_PinWrite()

fsp_err_t R_IOPORT_PinWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_pin_t  pin,
bsp_io_level_t  level 
)

Sets a pin's output either high or low. Implements ioport_api_t::pinWrite.

Return values
FSP_SUCCESSPin written to
FSP_ERR_INVALID_ARGUMENTThe pin and/or level not valid
FSP_ERR_NOT_OPENThe module has not been opene
FSP_ERR_ASSERTIONNULL pointerd
Note
This function is re-entrant for different pins. This function makes use of the Pm register to atomically modify the level on the specified pin on a port.

◆ R_IOPORT_PortDirectionSet()

fsp_err_t R_IOPORT_PortDirectionSet ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t  direction_values,
ioport_size_t  mask 
)

Sets the direction of individual pins on a port. Implements ioport_api_t::portDirectionSet().

Multiple pins on a port can be set to inputs or outputs at once. Each bit in the mask parameter corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. If a mask bit is set to 1 then the corresponding pin will be changed to an input or an output as specified by the direction values. If a mask bit is set to 0 then the direction of the pin will not be changed.

Return values
FSP_SUCCESSPort direction updated
FSP_ERR_INVALID_ARGUMENTThe port and/or mask not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortEventInputRead()

fsp_err_t R_IOPORT_PortEventInputRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t p_event_data 
)

Reads the value of the event input data. Implements ioport_api_t::portEventInputRead().

The event input data for the port will be read. Each bit in the returned value corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on.

The port event data is captured in response to a trigger from the ELC. This function enables this data to be read. Using the event system allows the captured data to be stored when it occurs and then read back at a later time.

Return values
FSP_SUCCESSPort read
FSP_ERR_INVALID_ARGUMENTPort not a valid ELC port
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened

◆ R_IOPORT_PortEventOutputWrite()

fsp_err_t R_IOPORT_PortEventOutputWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t  event_data,
ioport_size_t  mask_value 
)

This function writes the set and reset event output data for a port. Implements ioport_api_t::portEventOutputWrite.

Using the event system enables a port state to be stored by this function in advance of being output on the port. The output to the port will occur when the ELC event occurs.

The input value will be written to the specified port when an ELC event configured for that port occurs. Each bit in the value parameter corresponds to a bit on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. Each bit in the mask parameter corresponds to a pin on the port.

Return values
FSP_SUCCESSPort event data written
FSP_ERR_INVALID_ARGUMENTPort or Mask not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointer

◆ R_IOPORT_PortRead()

fsp_err_t R_IOPORT_PortRead ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t p_port_value 
)

Reads the value on an IO port. Implements ioport_api_t::portRead.

The specified port will be read, and the levels for all the pins will be returned by PINm register. Each bit in the returned value corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on.

Return values
FSP_SUCCESSPort read
FSP_ERR_ASSERTIONNULL pointer
FSP_ERR_NOT_OPENThe module has not been opened
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortWrite()

fsp_err_t R_IOPORT_PortWrite ( ioport_ctrl_t *const  p_ctrl,
bsp_io_port_t  port,
ioport_size_t  value,
ioport_size_t  mask 
)

Writes to multiple pins on a port. Implements ioport_api_t::portWrite.

The output value will be written to the specified port. Each bit in the value parameter corresponds to a bit on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. Each bit in the mask parameter corresponds to a pin on the port.

Only the bits with the corresponding bit in the mask value set will be updated. For example, value = 0x00FF, mask = 0x0003 results in only bits 0 and 1 being updated.

Return values
FSP_SUCCESSPort written to
FSP_ERR_INVALID_ARGUMENTThe port and/or mask not valid
FSP_ERR_NOT_OPENThe module has not been opened
FSP_ERR_ASSERTIONNULL pointerd
Note
This function is re-entrant for different ports. This function makes use of the Pm register to atomically modify the levels on the specified pins on a port.