Driver for the Ether Selector peripheral on RZ microprocessor. This module implements the Ethernet Selector Interface.
Overview
The control target is the MODCTRL, PHYLNK, and CONVCTRLn registers of the Ethernet Subsystem. There are three Ethernet functional blocks in RZ microprocessor. Gigabit Ethernet MAC (GMAC), Ethernet Switch (ETHSW), EtherCAT Slave Controller (ESC).
These Ethernet functional blocks and PHY are connected via an RGMII converter. For connection with the RGMII converter, GMAC and ETHSW support MII / GMII, and ESC supports MII. From the Ethernet functional block, the port selected by the multiplexer is connected to the port of the RGMII converter. The combination of ports that can be selected is predetermined, and in addition to selecting all ports as ESC or ETHSW, it is possible to select a combination of ESC and GMAC or a mixture of ESC and ETHSW ports.
Features
The main functions of ETHER_SELECTOR are as follows.
- Set Ethernet port configuration
- Ethernet Switch
- Ethernet MAC
- EtherCAT
- Set converter mode
- MII
- RMII
- RGMII
- Speed
- Duplex
- Supports 3ports
- Set the polarity of the PHY link signal
Configuration
Build Time Configurations for r_ether_selector
The following build time configurations are defined in fsp_cfg/r_ether_selector_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. |
Ethernet Mode | MCU Specific Options | | Select Ethernet Port Mode |
Configurations for Networking > Ethernet (r_ether_selector)
This module can be added to the Stacks tab via New Stack > Networking > Ethernet (r_ether_selector).
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | g_ether_selector0 | Module name. |
Port |
| 0 | Select the Ethernet port number. |
PHY Link Signal Polarity |
| Active-Low | Specify whether to use Active-Low or Active-High. |
Interface Type |
| RGMII | Specify whether to use MII or RMII or RGMII. |
Converter Speed |
| 1000Mbps | Specify whether to use 100Mbps or 1000Mbps or 10Mbps. (1000Mbps is valid only for RGMII) |
Converter Duplex |
| full duplex | Specify whether to full duplex or half duplex. |
Reference Clock |
| input | Specify whether to use the RMII reference clock. |
Clock Configuration
This module is used to configure the system clocks. There are no module specific clock configurations required to use it.
Pin Configuration
The ETHER_SELECTOR module is used for configuring pins.
Usage Notes
Examples
ETHER SELECTOR Basic Example
This is a basic example of minimal use of the ETHER SELECTOR in an application.
void ether_selector_basic_example (void)
{
g_ether_selector0_ctrl.open = 0U;
handle_error(err);
err =
handle_error(err);
}
◆ ether_selector_instance_ctrl_t
struct ether_selector_instance_ctrl_t |
ETHER SELECTOR control block. DO NOT INITIALIZE. Initialization occurs when ether_selector_api_t::open is called.
Data Fields |
uint32_t |
open |
Used to determine if the channel is configured. |
ether_selector_cfg_t const * |
p_cfg |
Pointer to initial configurations. |
R_ETHSS_Type * |
p_reg |
Pointer to Ethernet Subsystem peripheral registers. |
◆ R_ETHER_SELECTOR_Open()
Initializes the ETHER_SELECTOR module instance. Implements ether_selector_api_t::open.
- Return values
-
FSP_SUCCESS | Ethernet port configuration set successfully. |
FSP_ERR_ASSERTION | Pointer to ETHER_SELECTOR control block or configuration structure is NULL. |
FSP_ERR_INVALID_CHANNEL | Invalid channel number is given. |
FSP_ERR_INVALID_ARGUMENT | Configuration parameter error. |
FSP_ERR_ALREADY_OPEN | R_ETHER_SELECTOR_Open has already been called for this p_ctrl. |
◆ R_ETHER_SELECTOR_Close()
Close driver data. Implements ether_selector_api_t::close.
- Return values
-
FSP_SUCCESS | Ethernet selector closed. |
FSP_ERR_ASSERTION | p_ctrl is NULL. |
FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
◆ R_ETHER_SELECTOR_ConverterSet()
Set the converter speed and duplex after initilaize. Speed 1000Mbps is valid for only RGMII. Implements ether_selector_api_t::converterSet.
- Return values
-
FSP_SUCCESS | Speed adn duplex seetings successfully changed. |
FSP_ERR_ASSERTION | p_ctrl was NULL. |
FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
FSP_ERR_INVALID_ARGUMENT | Invalid parameter in the argument. |