Provides API for using Ethernet Switch. This module implements the Ethernet Switch Interface.
Overview
With the HSR/PRP Switch function, this LSI enables to build the network topology such as line type without external switching hub.
Features
- If start this module, it has behevia following as two mode.
- 1) Redbox mode
- 2) Dun mode
- The mode is decided by connecting network. etc..
Configuration
Build Time Configurations for r_hpsw
The following build time configurations are defined in fsp_cfg/r_hpsw_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 Networking > HSR/PRP Switch (r_hpsw)
This module can be added to the Stacks tab via New Stack > Networking > HSR/PRP Switch (r_hpsw).
| Configuration | Options | Default | Description |
| Name | Name must be a valid C symbol | g_hpsw0 | Module name. |
| Channel | 0 | 0 | Select the HPSW module channel number. |
| Operating Profile |
| No profile | Select the operating profile. |
Usage Notes
Then use this modules, set to start the Adjustable Clock on the application.
Limitations
Developers should be aware of the following limitations when using the HPSW:
- Non-averable the pulse generater.
- The HPSW module does not support timers other than the HPSW timer (ETHSW or ESWM timers). While the input timer clock can be configured in the "Timer Signal and Clock Selection Register," selecting a timer other than the HPSW timer will prevent the HPSW from functioning correctly in slave mode according to the product specifications.
Examples
Basic Example
This is a basic example of minimal use of the HPSW in an application.
void hpsw_basic_example (void)
{
hpsw_cfg.time_val = 0x1;
hpsw_cfg.ptp_tc_profile_val = 0x1;
hpsw_cfg.ptp_tc_default_data_1 = HPSW_EXAMPLE_TC_DEFAULT_DATA_1;
hpsw_cfg.ptp_tc_default_data_2 = HPSW_EXAMPLE_TC_DEFAULT_DATA_2;
hpsw_cfg.ptp_tc_clock_id_val = 0x1;
hpsw_cfg.ptp_oc_dis_offset_correction = 0x1;
hpsw_cfg.ptp_oc_profile_val = 0x1;
hpsw_cfg.ptp_oc_default_data_1 = HPSW_EXAMPLE_OC_DEFAULT_DATA_1;
hpsw_cfg.ptp_oc_default_data_2 = HPSW_EXAMPLE_OC_DEFAULT_DATA_2;
hpsw_cfg.ptp_oc_clock_id_val = 0x1;
hpsw_cfg.mac1 = HPSW_EXAMPLE_MAC_1;
hpsw_cfg.mac2 = HPSW_EXAMPLE_MAC_2;
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
}
◆ RZT::st_hpsw_cfg
HPSW configuration data for loading into registers by R_HPSW_Enable()
| Class Members |
|
uint32_t |
time_val |
Time Adjustment Valid. |
|
uint32_t |
offset_val |
Offset Adjustment Valid. |
|
uint32_t |
drift_val |
Drift Adjustment Valid. |
|
uint32_t |
servo_val |
Servo Parameters Valid. |
|
hpsw_clock_select_t |
clk_select |
Source for Clock Adjustments. |
|
uint32_t |
clock_time_adj_value_H |
Clock time adjustment value (High) |
|
uint32_t |
clock_time_adj_value_L |
Clock time adjustment value (Low) |
|
hpsw_ptp_tc_profile_t |
ptp_tc_profile |
Profile. |
|
uint32_t |
ptp_tc_twostep |
Twostep for PDelay. |
|
hpsw_ptp_tc_layer_t |
ptp_tc_layer |
Layer. |
|
hpsw_ptp_tc_delay_mechanism_t |
ptp_tc_delay_mechanism |
Delay Mechanism. |
|
hpsw_ptp_tc_delay_e2e_uni_t |
ptp_tc_delay_E2E_uni |
Delay E2E uni-cast. |
|
uint32_t |
ptp_tc_profile_val |
Profile valid. |
|
uint32_t |
ptp_tc_vlan_val |
VLAN valid. |
|
uint32_t |
ptp_tc_ip_val |
IP valid. |
|
uint32_t |
ptp_tc_dscp_val |
DSCP valid. |
|
uint32_t |
ptp_tc_clock_id_val |
Clock Identity Valid. |
|
uint32_t |
ptp_tc_domain_num_val |
Domain Number Valid. |
|
uint32_t |
ptp_tc_default_data_1 |
Default data 1. |
|
uint32_t |
ptp_tc_default_data_2 |
Default data 2. |
|
hpsw_ptp_oc_profile_t |
ptp_oc_profile |
Profile. |
|
uint32_t |
ptp_oc_twostep |
Twostep for PDelay. |
|
uint32_t |
ptp_oc_signaling |
Signaling. |
|
hpsw_ptp_oc_layer_t |
ptp_oc_layer |
Layer. |
|
hpsw_ptp_oc_master_slave_only_t |
ptp_oc_master_slave |
Master or slave select. |
|
uint32_t |
ptp_oc_dis_offset_correction |
Disable offset correction. |
|
uint32_t |
ptp_oc_allow_uni_slave |
Only allow uni-cast slaves previously added to the uni-cast dataset. |
|
hpsw_ptp_oc_delay_mechanism_t |
ptp_oc_delay_mechanism |
Delay Mechanism. |
|
hpsw_ptp_oc_delay_e2e_uni_t |
ptp_oc_delay_E2E_uni |
Delay E2E uni-cast. |
|
uint32_t |
ptp_oc_profile_val |
Profile valid. |
|
uint32_t |
ptp_oc_vlan_val |
VLAN valid. |
|
uint32_t |
ptp_oc_ip_val |
IP valid. |
|
uint32_t |
ptp_oc_dscp_val |
DSCP valid. |
|
uint32_t |
ptp_oc_clock_id_val |
Clock ID valid. |
|
uint32_t |
ptp_oc_domain_num_val |
Domain number valid. |
|
uint32_t |
ptp_oc_clock_qualiry_val |
Clock quality valid. |
|
uint32_t |
ptp_oc_priority1_val |
Priority1 valid. |
|
uint32_t |
ptp_oc_priority2_val |
Priority2 valid. |
|
uint32_t |
ptp_oc_gm_id_val |
Grand master short ID valid. |
|
uint32_t |
ptp_oc_gm_time_inac_val |
Grand master time Inaccuracy valid. |
|
uint32_t |
ptp_oc_max_steps_rem_val |
Max steps removed valid. |
|
uint32_t |
ptp_oc_local_priority_val |
Local priority valid. |
|
uint32_t |
ptp_oc_default_data_1 |
Default data 1. |
|
uint32_t |
ptp_oc_default_data_2 |
Default data 2. |
|
uint8_t |
ptp_oc_priority1 |
Priority1. |
|
uint8_t |
ptp_oc_priority2 |
Priority2. |
|
uint32_t |
delay_mechanism_val |
Delay mechanism valid. |
|
uint32_t |
msg_interval_val |
Message intervals valid. |
|
uint32_t |
asymmetry_val |
Asymmetry valid. |
|
uint32_t |
max_pdelay_val |
Maximum peer delay valid. |
|
uint32_t |
local_priority_val |
Local priority valid. |
|
uint32_t |
ptp_oc_announce_interval |
Signed announce log interval. |
|
uint32_t |
ptp_oc_announce_timeout |
Announce timeout. |
|
uint32_t |
vlan_val |
Vlan valid. |
|
uint32_t |
vlan |
Vlan. |
|
uint32_t |
vlan_enable |
Enable vlan. |
|
uint32_t |
mac1 |
MAC 1. |
|
uint32_t |
mac2 |
MAC 2. |
◆ RZT::st_hpsw_status
| struct RZT::st_hpsw_status |
◆ RZT::st_hpsw_counter
| struct RZT::st_hpsw_counter |
HPSW send/receive frame counter
| Class Members |
|
uint32_t |
TX_counter |
TX counter. |
|
uint32_t |
TX_error_counter |
TX error counter. |
|
uint32_t |
RX_counter |
RX counter. |
|
uint32_t |
RX_error_counter |
RX error counter. |
◆ RZT::st_hpsw_ptp_dataset
| struct RZT::st_hpsw_ptp_dataset |
| Class Members |
|
uint32_t |
ptp_tc_default_data_1 |
Default data 1. |
|
uint32_t |
ptp_tc_default_data_2 |
Default data 2. |
|
uint32_t |
ptp_tc_default_data_3 |
Default data 3. |
|
uint32_t |
ptp_tc_default_data_4 |
Default data 4. |
|
uint32_t |
ptp_tc_port_data_1 |
Port data 1. |
|
uint32_t |
ptp_tc_port_data_2 |
Port data 2. |
|
uint32_t |
ptp_tc_port_data_3 |
Port data 3. |
|
uint32_t |
ptp_tc_port_data_4 |
Port data 4. |
|
uint32_t |
ptp_tc_port_data_5 |
Port data 5. |
|
uint32_t |
ptp_tc_port_data_6 |
Port data 6. |
|
uint32_t |
ptp_oc_default_data_1 |
Default data 1. |
|
uint32_t |
ptp_oc_default_data_2 |
Default data 2. |
|
uint32_t |
ptp_oc_default_data_3 |
Default data 3. |
|
uint32_t |
ptp_oc_default_data_4 |
Default data 4. |
|
uint32_t |
ptp_oc_default_data_5 |
Default data 5. |
|
uint32_t |
ptp_oc_default_data_6 |
Default data 6. |
|
uint32_t |
ptp_oc_default_data_7 |
Default data 7. |
|
uint32_t |
ptp_oc_port_data_1 |
Port data 1. |
|
uint32_t |
ptp_oc_port_data_2 |
Port data 2. |
|
uint32_t |
ptp_oc_port_data_3 |
Port data 3. |
|
uint32_t |
ptp_oc_port_data_4 |
Port data 4. |
|
uint32_t |
ptp_oc_port_data_5 |
Port data 5. |
|
uint32_t |
ptp_oc_port_data_6 |
Port data 6. |
|
uint32_t |
ptp_oc_port_data_7 |
Port data 7. |
|
uint32_t |
ptp_oc_port_data_8 |
Port data 8. |
|
uint32_t |
ptp_oc_current_data_1 |
Current data 1. |
|
uint32_t |
ptp_oc_current_data_2 |
Current data 2. |
|
uint32_t |
ptp_oc_current_data_3 |
Current data 3. |
|
uint32_t |
ptp_oc_current_data_4 |
Current data 4. |
|
uint32_t |
ptp_oc_current_data_5 |
Current data 5. |
|
uint32_t |
ptp_oc_parent_data_1 |
Parent data 1. |
|
uint32_t |
ptp_oc_parent_data_2 |
Parent data 2. |
|
uint32_t |
ptp_oc_parent_data_3 |
Parent data 3. |
|
uint32_t |
ptp_oc_parent_data_4 |
Parent data 4. |
|
uint32_t |
ptp_oc_parent_data_5 |
Parent data 5. |
|
uint32_t |
ptp_oc_parent_data_6 |
Parent data 6. |
|
uint32_t |
ptp_oc_parent_data_7 |
Parent data 7. |
|
uint32_t |
ptp_oc_parent_data_8 |
Parent data 8. |
|
uint32_t |
ptp_oc_parent_data_9 |
Parent data 9. |
|
uint32_t |
ptp_oc_time_propertie_data_1 |
Time properties data 1. |
|
uint32_t |
ptp_oc_time_propertie_data_2 |
Time properties data 2. |
|
uint32_t |
ptp_oc_time_propertie_data_3 |
Time properties data 3. |
|
uint32_t |
ptp_oc_time_propertie_data_4 |
Time properties data 4. |
|
uint32_t |
ptp_oc_time_propertie_data_5 |
Time properties data 5. |
|
uint32_t |
ptp_oc_time_propertie_data_6 |
Time properties data 6. |
|
uint32_t |
ptp_oc_time_propertie_data_7 |
Time properties data 7. |
|
uint32_t |
ptp_oc_time_propertie_data_8 |
Time properties data 8. |
|
uint32_t |
ptp_oc_time_propertie_data_9 |
Time properties data 9. |
◆ RZT::st_hpsw_extend_cfg
| struct RZT::st_hpsw_extend_cfg |
Extend Configuration parameters.
◆ RZT::st_hpsw_instance_ctrl
| struct RZT::st_hpsw_instance_ctrl |
HPSW control block. DO NOT INITIALIZE. Initialization occurs when hpsw_instance_ctrl_t::open is called.
| Class Members |
|
uint32_t |
open |
Used to determine if the channel is configured. |
|
ether_switch_cfg_t const * |
p_hpsw_cfg |
Pointer to initial configurations. |
|
R_HPSW_INI_Type * |
p_hpsw_ini_reg |
Pointer to HPSW init registers. |
|
R_HPSW_Type * |
p_hpsw_reg |
Pointer to HPSW registers. |
◆ hpsw_cfg_t
HPSW configuration data for loading into registers by R_HPSW_Enable() Please refer to the struct st_hpsw_cfg.
◆ hpsw_status_t
◆ hpsw_counter_t
HPSW send/receive frame counter Please refer to the struct st_hpsw_counter.
◆ hpsw_ptp_dataset_t
◆ hpsw_extend_cfg_t
◆ hpsw_instance_ctrl_t
◆ hpsw_c_clock_t
C clock select
| Enumerator |
|---|
| HPSW_c_clock_0_MBPS | 0
|
| HPSW_c_clock_10_MBPS | 10Mbit/s(2.5MHz)
|
| HPSW_c_clock_100_MBPS | 100Mbit/s(25MHz)
|
| HPSW_c_clock_1000_MBPS | 1000Mbit/s(125MHz)
|
◆ hpsw_port_timeout_t
port timeout
| Enumerator |
|---|
| HPSW_PORT_NOT_TIMEOUT | Not port timeout occured.
|
| HPSW_PORT_TIMEOUT | Port timeout occured.
|
◆ hpsw_port_link_t
port link
| Enumerator |
|---|
| HPSW_PORT_UNLINK | Port unlink.
|
| HPSW_PORT_LINK | Port link.
|
◆ hpsw_clock_select_t
clock select
| Enumerator |
|---|
| HPSW_CLOCK_NONE | NONE.
|
| HPSW_CLOCK_TOD | TOD.
|
| HPSW_CLOCK_LRIG | LRIG.
|
| HPSW_CLOCK_PPS | PPS.
|
| HPSW_CLOCK_PTP | PTP.
|
| HPSW_CLOCK_RTC | RTC.
|
| HPSW_CLOCK_DCF | DCF.
|
| HPSW_CLOCK_NTP | NTP.
|
| HPSW_CLOCK_REGS | REGS.
|
| HPSW_CLOCK_EXT | EXT.
|
◆ hpsw_mode_t
mode select
| Enumerator |
|---|
| HPSW_MODE_NONE | None.
|
| HPSW_MODE_PRP | PRP.
|
| HPSW_MODE_HSR | HSR.
|
◆ hpsw_ptp_tc_profile_t
ptp tc profile
| Enumerator |
|---|
| HPSW_PTP_TC_DEFAULT | Default profile.
|
| HPSW_PTP_TC_ELECTRIC | Electric power profile.
|
| HPSW_PTP_TC_UTILITY | Utility profile.
|
| HPSW_PTP_TC_TSN | TSN Profile.
|
◆ hpsw_ptp_tc_layer_t
ptp tc layer
| Enumerator |
|---|
| HPSW_PTP_TC_LAYER_802 | 802.3
|
| HPSW_PTP_TC_LAYER_IPv4 | IPv4.
|
◆ hpsw_ptp_tc_delay_mechanism_t
ptp tc delay mechanism
| Enumerator |
|---|
| HPSW_PTP_TC_DELAY_P2P | P2P.
|
| HPSW_PTP_TC_DELAY_E2E | E2E.
|
◆ hpsw_ptp_tc_delay_e2e_uni_t
ptp tc E2E unicast or multicast
| Enumerator |
|---|
| HPSW_PTP_TC_DELAY_E2E_MULTI | Muliticast.
|
| HPSW_PTP_TC_DELAY_E2E_UNI | Unicast.
|
◆ hpsw_ptp_oc_profile_t
ptp oc profile
| Enumerator |
|---|
| HPSW_PTP_OC_DEFAULT | Default profile.
|
| HPSW_PTP_OC_ELECTRIC | Electric power profile.
|
| HPSW_PTP_OC_UTILITY | Utility profile.
|
| HPSW_PTP_OC_TSN | TSN Profile.
|
| HPSW_PTP_OC_ITU_G8265_1 | ITU G8265.1 Profile.
|
| HPSW_PTP_OC_ITU_G8275_1 | ITU G8275.1 Profile.
|
| HPSW_PTP_OC_ITU_G8275_2 | ITU G8275.2 Profile.
|
◆ hpsw_ptp_oc_layer_t
ptp oc layer
| Enumerator |
|---|
| HPSW_PTP_OC_LAYER_802 | 802.3
|
| HPSW_PTP_OC_LAYER_IPv4 | IPv4.
|
| HPSW_PTP_OC_LAYER_IPv6 | IPv6.
|
◆ hpsw_ptp_oc_master_slave_only_t
ptp oc master or slave select
| Enumerator |
|---|
| HPSW_PTP_OC_MASTER_SLAVE | Master and slave.
|
| HPSW_PTP_OC_SLAVE | Slave only.
|
| HPSW_PTP_OC_MASTER | Master only.
|
◆ hpsw_ptp_oc_delay_mechanism_t
ptp oc delay mechanism
| Enumerator |
|---|
| HPSW_PTP_OC_DELAY_P2P | P2P.
|
| HPSW_PTP_OC_DELAY_E2E | E2E.
|
◆ hpsw_ptp_oc_delay_e2e_uni_t
ptp oc E2E unicast or multicast
| Enumerator |
|---|
| HPSW_PTP_OC_DELAY_E2E_MULTI | Muliticast.
|
| HPSW_PTP_OC_DELAY_E2E_UNI | Unicast.
|
◆ R_HPSW_Open()
Initializes the HPSW module instance. Implements ether_switch_api_t::open.
- Return values
-
| FSP_SUCCESS | HPSW configuration set successfully. |
| FSP_ERR_ASSERTION | Pointer to HPSW control block or configuration structure is NULL. |
| FSP_ERR_ALREADY_OPEN | R_HPSW_Open has already been called for this p_ctrl. |
◆ R_HPSW_Close()
Close driver data. Implements ether_switch_api_t::close.
- Return values
-
| FSP_SUCCESS | HPSW closed. |
| FSP_ERR_ASSERTION | p_ctrl is NULL. |
| FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
◆ R_HPSW_EnableSet()
Set the converter speed and duplex after initilaize. Speed 1000Mbps is valid for only RGMII.
- 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. |
◆ R_HPSW_StatusGet()
Retrieves the current state and counter value stores them in p_status.
- Return values
-
| FSP_SUCCESS | Current status and counter value provided in p_status. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
◆ R_HPSW_CounterGet()
Retrieves the current state and counter value stores them in p_status.
- Return values
-
| FSP_SUCCESS | Current status and counter value provided in p_status. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
◆ R_HPSW_CounterClear()
Retrieves the current state and counter value stores them in p_status.
- Return values
-
| FSP_SUCCESS | Current status and counter value provided in p_status. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
◆ R_HPSW_PtpDataGet()
Retrieves the current state and counter value stores them in p_status.
- Return values
-
| FSP_SUCCESS | Current status and counter value provided in p_status. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | The instance control structure is not opened. |
| FSP_ERR_TIMEOUT | Read data set wait timeout. |