|
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 *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) |
|
fsp_err_t | R_IOPORT_SDVoltageModeCfg (ioport_ctrl_t *const p_ctrl, ioport_sd_channel_t channel, ioport_sd_voltage_t voltage) |
|
fsp_err_t | R_IOPORT_QSPIVoltageModeCfg (ioport_ctrl_t *const p_ctrl, ioport_qspi_channel_t channel, ioport_qspi_voltage_t voltage) |
|
fsp_err_t | R_IOPORT_EthernetVoltageModeCfg (ioport_ctrl_t *const p_ctrl, ioport_ethernet_channel_t channel, ioport_ethernet_voltage_t voltage) |
|
Driver for the I/O Ports peripheral on RZ MPUs. 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, or bus control pins.
Features
The IOPORT HAL module can configure the following pin settings:
- Pin direction (Hi-Z, Input, Output, Output (Input enable))
- Default output state
- Pull-up/Down (No Pull-Up/Down, Pull-Up, Pull-Down)
- Drive strength
- Whether the pin is to be used as an IRQ pin (as peripheral connection)
- Whether the pin is to be used as an TINT pin
- Peripheral connection
- Slew rate setting (Slow, Fast)
The module also provides the following functionality:
- Read/write GPIO pins/ports
- Select operation voltage of SD, QSPI and ETHER.
- Select ETHER operation mode.
- Enable / Disable noise filter and set noise filter number and noise filter clock.
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 RZ Configuraton 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:
Configuration | Options | Default | Description |
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 Driver on r_ioport
This module can be added to the Stacks tab via New Stack > System > I/O Port Driver on r_ioport.
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | g_ioport | Module name. |
Pin Configuration Name | Name must be a valid C symbol | g_bsp_pin_cfg | Name for pin configuration structure |
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
Examples
Basic Example
This is a basic example of minimal use of the IOPORT in an application.
void basic_example ()
{
handle_error(err);
handle_error(err);
handle_error(err);
handle_error(err);
}
Blinky Example
This example uses IOPORT to configure and toggle a pin to blink an LED.
#define DELAY_TIME (100)
void blinky_example ()
{
handle_error(err);
handle_error(err);
while (1)
{
{
}
else
{
}
handle_error(err);
}
}
◆ ioport_instance_ctrl_t
struct ioport_instance_ctrl_t |
IOPORT private control block. DO NOT MODIFY. Initialization occurs when R_IOPORT_Open() is called.
◆ ioport_port_pin_t
Superset list of all possible IO port pins.
Enumerator |
---|
IOPORT_PORT_00_PIN_00 | IO port 0 pin 0.
|
IOPORT_PORT_00_PIN_01 | IO port 0 pin 1.
|
IOPORT_PORT_00_PIN_02 | IO port 0 pin 2.
|
IOPORT_PORT_00_PIN_03 | IO port 0 pin 3.
|
IOPORT_PORT_01_PIN_00 | IO port 1 pin 0.
|
IOPORT_PORT_01_PIN_01 | IO port 1 pin 1.
|
IOPORT_PORT_01_PIN_02 | IO port 1 pin 2.
|
IOPORT_PORT_01_PIN_03 | IO port 1 pin 3.
|
IOPORT_PORT_01_PIN_04 | IO port 1 pin 4.
|
IOPORT_PORT_02_PIN_00 | IO port 2 pin 0.
|
IOPORT_PORT_02_PIN_01 | IO port 2 pin 1.
|
IOPORT_PORT_02_PIN_02 | IO port 2 pin 2.
|
IOPORT_PORT_02_PIN_03 | IO port 2 pin 3.
|
IOPORT_PORT_03_PIN_00 | IO port 3 pin 0.
|
IOPORT_PORT_03_PIN_01 | IO port 3 pin 1.
|
IOPORT_PORT_03_PIN_02 | IO port 3 pin 2.
|
IOPORT_PORT_03_PIN_03 | IO port 3 pin 3.
|
IOPORT_PORT_04_PIN_00 | IO port 4 pin 0.
|
IOPORT_PORT_04_PIN_01 | IO port 4 pin 1.
|
IOPORT_PORT_04_PIN_02 | IO port 4 pin 2.
|
IOPORT_PORT_04_PIN_03 | IO port 4 pin 3.
|
IOPORT_PORT_04_PIN_04 | IO port 4 pin 4.
|
IOPORT_PORT_04_PIN_05 | IO port 4 pin 5.
|
IOPORT_PORT_05_PIN_00 | IO port 5 pin 0.
|
IOPORT_PORT_05_PIN_01 | IO port 5 pin 1.
|
IOPORT_PORT_05_PIN_02 | IO port 5 pin 2.
|
IOPORT_PORT_05_PIN_03 | IO port 5 pin 3.
|
IOPORT_PORT_05_PIN_04 | IO port 5 pin 4.
|
IOPORT_PORT_06_PIN_00 | IO port 6 pin 0.
|
IOPORT_PORT_06_PIN_01 | IO port 6 pin 1.
|
IOPORT_PORT_06_PIN_02 | IO port 6 pin 2.
|
IOPORT_PORT_06_PIN_03 | IO port 6 pin 3.
|
IOPORT_PORT_06_PIN_04 | IO port 6 pin 4.
|
IOPORT_PORT_07_PIN_00 | IO port 7 pin 0.
|
IOPORT_PORT_07_PIN_01 | IO port 7 pin 1.
|
IOPORT_PORT_07_PIN_02 | IO port 7 pin 2.
|
IOPORT_PORT_07_PIN_03 | IO port 7 pin 3.
|
IOPORT_PORT_07_PIN_04 | IO port 7 pin 4.
|
IOPORT_PORT_08_PIN_00 | IO port 8 pin 0.
|
IOPORT_PORT_08_PIN_01 | IO port 8 pin 1.
|
IOPORT_PORT_08_PIN_02 | IO port 8 pin 2.
|
IOPORT_PORT_08_PIN_03 | IO port 8 pin 3.
|
IOPORT_PORT_08_PIN_04 | IO port 8 pin 4.
|
IOPORT_PORT_09_PIN_00 | IO port 9 pin 0.
|
IOPORT_PORT_09_PIN_01 | IO port 9 pin 1.
|
IOPORT_PORT_09_PIN_02 | IO port 9 pin 2.
|
IOPORT_PORT_09_PIN_03 | IO port 9 pin 3.
|
IOPORT_PORT_10_PIN_00 | IO port 10 pin 0.
|
IOPORT_PORT_10_PIN_01 | IO port 10 pin 1.
|
IOPORT_PORT_10_PIN_02 | IO port 10 pin 2.
|
IOPORT_PORT_10_PIN_03 | IO port 10 pin 3.
|
IOPORT_PORT_10_PIN_04 | IO port 10 pin 4.
|
IOPORT_PORT_11_PIN_00 | IO port 11 pin 0.
|
IOPORT_PORT_11_PIN_01 | IO port 11 pin 1.
|
IOPORT_PORT_11_PIN_02 | IO port 11 pin 2.
|
IOPORT_PORT_11_PIN_03 | IO port 11 pin 3.
|
IOPORT_PORT_12_PIN_00 | IO port 12 pin 0.
|
IOPORT_PORT_12_PIN_01 | IO port 12 pin 1.
|
IOPORT_PORT_13_PIN_00 | IO port 13 pin 0.
|
IOPORT_PORT_13_PIN_01 | IO port 13 pin 1.
|
IOPORT_PORT_13_PIN_02 | IO port 13 pin 2.
|
IOPORT_PORT_13_PIN_03 | IO port 13 pin 3.
|
IOPORT_PORT_13_PIN_04 | IO port 13 pin 4.
|
IOPORT_PORT_14_PIN_00 | IO port 14 pin 0.
|
IOPORT_PORT_14_PIN_01 | IO port 14 pin 1.
|
IOPORT_PORT_14_PIN_02 | IO port 14 pin 2.
|
IOPORT_PORT_15_PIN_00 | IO port 15 pin 0.
|
IOPORT_PORT_15_PIN_01 | IO port 15 pin 1.
|
IOPORT_PORT_15_PIN_02 | IO port 15 pin 2.
|
IOPORT_PORT_15_PIN_03 | IO port 15 pin 3.
|
IOPORT_PORT_16_PIN_00 | IO port 16 pin 0.
|
IOPORT_PORT_16_PIN_01 | IO port 16 pin 1.
|
IOPORT_PORT_17_PIN_00 | IO port 17 pin 0.
|
IOPORT_PORT_17_PIN_01 | IO port 17 pin 1.
|
IOPORT_PORT_17_PIN_02 | IO port 17 pin 2.
|
IOPORT_PORT_17_PIN_03 | IO port 17 pin 3.
|
IOPORT_PORT_18_PIN_00 | IO port 18 pin 0.
|
IOPORT_PORT_18_PIN_01 | IO port 18 pin 1.
|
IOPORT_PORT_18_PIN_02 | IO port 18 pin 2.
|
IOPORT_PORT_18_PIN_03 | IO port 18 pin 3.
|
IOPORT_PORT_18_PIN_04 | IO port 18 pin 4.
|
IOPORT_PORT_18_PIN_05 | IO port 18 pin 5.
|
IOPORT_NMI | NMI.
|
IOPORT_TMS_SWDIO | TMS_SWDIO.
|
IOPORT_TDO | TDO.
|
IOPORT_AUDIO_CLK1 | AUDIO_CLK1.
|
IOPORT_AUDIO_CLK2 | AUDIO_CLK2.
|
IOPORT_SD0_CLK | CD0_CLK.
|
IOPORT_SD0_CMD | CD0_CMD.
|
IOPORT_SD0_RST_N | CD0_RST_N.
|
IOPORT_SD0_DATA0 | SD0_DATA0.
|
IOPORT_SD0_DATA1 | SD0_DATA1.
|
IOPORT_SD0_DATA2 | SD0_DATA2.
|
IOPORT_SD0_DATA3 | SD0_DATA3.
|
IOPORT_SD0_DATA4 | SD0_DATA4.
|
IOPORT_SD0_DATA5 | SD0_DATA5.
|
IOPORT_SD0_DATA6 | SD0_DATA6.
|
IOPORT_SD0_DATA7 | SD0_DATA7.
|
IOPORT_SD1_CLK | SD1_CLK.
|
IOPORT_SD1_CMD | SD1_CMD.
|
IOPORT_SD1_DATA0 | SD1_DATA0.
|
IOPORT_SD1_DATA1 | SD1_DATA1.
|
IOPORT_SD1_DATA2 | SD1_DATA2.
|
IOPORT_SD1_DATA3 | SD1_DATA3.
|
IOPORT_QSPI0_SPCLK | QSPI0_SPCLK.
|
IOPORT_QSPI0_IO0 | QSPI0_IO0.
|
IOPORT_QSPI0_IO1 | QSPI0_IO1.
|
IOPORT_QSPI0_IO2 | QSPI0_IO2.
|
IOPORT_QSPI0_IO3 | QSPI0_IO3.
|
IOPORT_QSPI0_SSL | QSPI0_SSL.
|
IOPORT_OM_CS1_N | OM_CS1_N.
|
IOPORT_OM_DQS | OM_DQS.
|
IOPORT_OM_SIO4 | OM_SIO4.
|
IOPORT_OM_SIO5 | OM_SIO5.
|
IOPORT_OM_SIO6 | OM_SIO6.
|
IOPORT_OM_SIO7 | OM_SIO7.
|
IOPORT_QSPI_RESET_N | QSPI_RESET_N.
|
IOPORT_QSPI_WP_N | QSPI_WP_N.
|
IOPORT_WDTOVF_PERROUT_N | WDTOVF_PERROUT_N.
|
IOPORT_RIIC0_SDA | RIIC0_SDA.
|
IOPORT_RIIC0_SCL | RIIC0_SCL.
|
IOPORT_RIIC1_SDA | RIIC1_SDA.
|
IOPORT_RIIC1_SCL | RIIC1_SCL.
|
◆ R_IOPORT_Open()
Initializes internal driver data, then calls pin configuration function to configure pins.
- Return values
-
FSP_SUCCESS | Pin configuration data written to PFS register(s) |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_ALREADY_OPEN | Module is already open. |
◆ R_IOPORT_Close()
Resets IOPORT registers. Implements ioport_api_t::close
- Return values
-
FSP_SUCCESS | The IOPORT was successfully uninitialized |
FSP_ERR_ASSERTION | p_ctrl was NULL |
FSP_ERR_NOT_OPEN | The module has not been opened |
◆ R_IOPORT_PinsCfg()
Configures the functions of multiple pins by loading configuration data into each registers. Implements ioport_api_t::pinsCfg.
This function initializes the supplied list of each registers with the supplied values. This data define in pin_data.c. Different pin configurations can be loaded for different situations such as low power modes and testing.
- Return values
-
FSP_SUCCESS | Pin configuration data written to each registers |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
◆ R_IOPORT_PinCfg()
Configures the settings of a pin. Implements ioport_api_t::pinCfg.
- Return values
-
FSP_SUCCESS | Pin configured |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL 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()
This API function has NOT been supported because RZ/A does not have an ELC.
- Return values
-
FSP_ERR_UNSUPPORTED | R_IOPORT_PinEventInputRead is not supported on this device. |
◆ R_IOPORT_PinEventOutputWrite()
This API function has NOT been supported because RZ/A does not have an ELC.
- Return values
-
FSP_ERR_UNSUPPORTED | R_IOPORT_PinEventOutputWrite is not supported on this device. |
◆ R_IOPORT_PinRead()
Reads the level on a pin. Implements ioport_api_t::pinRead.
- Return values
-
FSP_SUCCESS | Pin read |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_NOT_OPEN | The module has not been opened |
- Note
- This function is re-entrant for different pins.
◆ R_IOPORT_PinWrite()
Sets a pin's output either high or low. Implements ioport_api_t::pinWrite.
- Return values
-
FSP_SUCCESS | Pin written to |
FSP_ERR_INVALID_ARGUMENT | The pin and/or level not valid |
FSP_ERR_NOT_OPEN | The module has not been opene |
FSP_ERR_ASSERTION | NULL pointerd |
- Note
- This function is re-entrant for different pins.
◆ R_IOPORT_PortDirectionSet()
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[9:8] corresponds to pin 4, bit[7:6] to pin 3, and so on. If bits are set to b'11 then the corresponding pin will be changed to an input or an output or Hi-Z as specified by the direction values. If a mask bits are set to b'00 then the direction of the pin will not be changed.
- Return values
-
FSP_SUCCESS | Port direction updated |
FSP_ERR_INVALID_ARGUMENT | The port and/or mask not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_PortEventInputRead()
This API function has NOT been supported because RZ/A does not have an ELC.
- Return values
-
FSP_ERR_UNSUPPORTED | R_IOPORT_PortEventInputRead is not supported on this device. |
◆ R_IOPORT_PortEventOutputWrite()
This API function has NOT been supported because RZ/A does not have an ELC.
- Return values
-
FSP_ERR_UNSUPPORTED | R_IOPORT_PortEventOutputWrite is not supported on this device. |
◆ R_IOPORT_PortRead()
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. Each bit in the returned value corresponds to a pin on the port. For example, bit 4 corresponds to pin 4, bit 3 to pin 3, and so on.
- Return values
-
FSP_SUCCESS | Port read |
FSP_ERR_ASSERTION | NULL pointer |
FSP_ERR_NOT_OPEN | The module has not been opened |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_PortWrite()
Writes to multiple pins on a port. Implements ioport_api_t::portWrite.
The input value will be written to the specified port. Each bit in the value parameter corresponds to a bit on the port. For example, bit 4 corresponds to pin 4, bit 3 to pin 3, 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 = 0xFFFF, mask = 0x0003 results in only bits 0 and 1 being updated.
- Return values
-
FSP_SUCCESS | Port written to |
FSP_ERR_INVALID_ARGUMENT | The port and/or mask not valid |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointerd |
- Note
- This function is re-entrant for different ports.
◆ R_IOPORT_SDVoltageModeCfg()
Configures SD channel voltage mode. Implements ioport_api_t::pinSDVoltageModeCfg.
- Return values
-
FSP_SUCCESS | SD voltage mode set |
FSP_ERR_INVALID_ARGUMENT | Channel or voltage not valid |
FSP_ERR_UNSUPPORTED | SD voltage configuration not supported on this device. |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is not re-entrant.
◆ R_IOPORT_QSPIVoltageModeCfg()
Configures QSPI channel voltage mode. Implements ioport_api_t::pinQSPIVoltageModeCfg.
- Return values
-
FSP_SUCCESS | QSPI voltage mode set |
FSP_ERR_INVALID_ARGUMENT | Channel or voltage not valid |
FSP_ERR_UNSUPPORTED | QSPI voltage configuration not supported on this device. |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is not re-entrant.
◆ R_IOPORT_EthernetVoltageModeCfg()
Configures Ethernet channel voltage mode. Implements ioport_api_t::pinEthernetVoltageModeCfg.
- Return values
-
FSP_SUCCESS | Ethernet voltage mode set |
FSP_ERR_INVALID_ARGUMENT | Channel or voltage not valid |
FSP_ERR_UNSUPPORTED | Ethernet voltage configuration not supported on this device. |
FSP_ERR_NOT_OPEN | The module has not been opened |
FSP_ERR_ASSERTION | NULL pointer |
- Note
- This function is not re-entrant.