RA Flexible Software Package Documentation  Release v6.4.0

 
gPTP Ethernet Switch Module(rm_gptp_eswm)

Overview

This module provides time synchronization based on the standard IEEE 802.1AS-2020.

Features

Usage Notes

Limitations

The supported clock are 200/250 MHz for ESW clock and 25MHz for ETHPHY clock.

Examples

Baremetal Example

This is a example of minimal use of the gPTP Ethernet switch module in the baremetal application.

void rm_gptp_eswm_baremetal_example (void)
{
fsp_err_t err;
/* Initialize gPTP ESWM module. */
err = rm_gptp_eswm_init(&g_gptp_eswm0_ctrl, &g_gptp_eswm0_cfg);
assert(FSP_SUCCESS == err);
while (1)
{
/* Read a gPTP packet. */
gptp_read();
/* Check timer expired. */
gptp_timer_check();
/* Send a gPTP packet. */
gptp_send();
/* Detect timer counts. */
while (!(gptp_detect_count()))
{
;
}
}
}

FreeRTOS Example

This is a example of minimal use of the gPTP Ethernet switch module in the freertos application.

void rm_gptp_eswm_freertos_example (void)
{
fsp_err_t err;
/* Initialize gPTP ESWM module. */
err = rm_gptp_eswm_init(&g_gptp_eswm0_ctrl, &g_gptp_eswm0_cfg);
assert(FSP_SUCCESS == err);
/* Create ptp task. */
rm_gptp_sys_freertos_create_ptp_task(g_gptp_eswm0_ctrl.p_cfg->p_gptp_sys_port_instance->p_ctrl);
/* Create ptp message generation task. */
rm_gptp_sys_freertos_create_ptp_message_gen_task(g_gptp_eswm0_ctrl.p_cfg->p_gptp_sys_port_instance->p_ctrl);
/* Create ptp read task. */
rm_gptp_sys_freertos_create_ptp_read_task(g_gptp_eswm0_ctrl.p_cfg->p_gptp_sys_port_instance->p_ctrl);
while (1)
{
vTaskDelay(1);
}
}

Configuration API

The configuration application programming interface (configuration-api) can be used to change dedicated functions of the synchronization software stack during runtime. The interface has the following functions and is located in module r_ptp_configuration_api:

Function name Brief description
set_priority1 Set the priority 1 value for the PTP instance
set_priority2 Set the priority 2 value for the PTP instance
set_domain_number Set the domain number for the PTP instance
set_instance_enable Enable or disable a PTP instance
set_enable_ptp_port Enable a port for PTP
set_delay_mechanism Set a delay mechanism for a PTP port
set_mean_link_delay_threshold Set the mean link delay threshold for a PTP port
set_mgt_settable_log_announce_interval Set the log announce message interval for a PTP port
set_use_mgt_settable_log_announce_interval Use the settable log announce message interval for a PTP port
set_announce_receipt _timeout Set the announce receipt timeout value for a PTP port
set_initial_log_sync_interval Set the initial log sync interval
set_mgt_settable_log_sync_interval Set the log sync message interval for a PTP port
set_use_mgt_settale_log_sync_interval Use the settable log sync message interval for a PTP port
set_sync_receipt _timeout Set the sync receipt timeout value for a PTP port
set_initial_log_pdelay_req_interval Set the initial log Pdelay request interval
set_use_mgt_settable_log_pdelay_req_interval Use the managementt settable log pdelay request intervalfor a PTP port
set_mgt_settable_log_pdelay_req_interval Set the log Pdelay request interval for a PTP port
set_allowed_lost_responses Set the number of allowed lost Pdelay responses for a PTP port
set_initial_log_gptp_capable_message_ineterval Set the initial log gptp capable message interval
set_use_mgt_settable_log_gptp_capable_message_interval Use the management settable log gptp capable message interval for a PTP port
set_mgt_settable_log_gptp_capable_message_interval Set the management settable log gptp capable message interval
set_time_value Set the management settable log gptp capable message interval

Diagnosis API

The diagnosis application programming interface (diagnosis-api) can be used to monitor dedicated functions of the synchronization software stack. The interface has the following functions and is located at r_ptp_diagnosis_api:

Function name Brief description
get_clock_class Get the clock class value for a PTP instance
get_clock_accuracy Get the clock accuracy value for a PTP instance
get_offset_scaled_log_variance Get the offset scaled log variance value for a PTP instance
get_priority1 Get the priority 1 value for a PTP instance
get_priority2 Get the priority 2 value for a PTP instance
get_domain_number Get the domain number value for a PTP instance
get_offset_from_master Get the current offset from master for a PTP instance
get_cumulative_rate_ratio Get the cumulative rate ratio value for a PTP instance
get_grandmaster_clock_class Get the grandmaster clock class value for a PTP instance
get_grandmaster_clock_accuracy Get the grandmaster clock accuracy value for a PTP instance
get_grandmaster_offset_scaled_log_variance Get_the grandmaster offset scaled log variance value for a PTP instance
get_grandmaster_priority1 Get the grandmaster priority1 value for a PTP instance
get_grandmaster_priority2 Get the grandmaster priority2 value for a PTP instance
get_ptp_port_enabled Get the PTP port enabled status for a PTP port
get_delay_measurement Get the delay measurement method for a PTP port
get_mean_link_delay_threshold Get the mean link delay threshold value for a PTP port
get_mean_link_delay_threshold Get the initial log announce interval value for a PTP port
get_current_log_announce_interval Get the current log announce interval value for a PTP port
get_use_mgt_settable_log_announce_interval Get the management settable log announce interval use status for a PTP port
get_announce_receipt_timeout Get the announce receipt timeout value for a PTP port
get_initial_log_sync_interval Get the initial log sync interval value for a PTP port
get_initial_log_sync_interval Get the current log sync interval value for a PTP port
get_use_mgt_settable_log_sync_interval Get the management settable log sync interval use state for a PTP port
get_sync_receipt_timeout Get the sync receipt timeout value for a PTP port
get_initial_log_pdelay_req_interval Get the initial log Pdelay request interval value
get_current_log_pdelay_req_interval Get the current log Pdelay request interval value
get_use_mgt_settable_log_pdelay_req_interval Get the management settable log Pdelay request interval use status value for a PTP port
get_allowed_lost_responses Get the value of allowed lost Pdelay responses for a PTP port
get_initial_log_gptp_capable_message_interval Get the initial log gptp capable signaling message interval
get_current_log_gptp_capable_message_interval Get the current gptp capable signaling message interval
get_use_mgt_settable_log_gptp_capable_messag_interval Get the management settable log gptp capable message interval use state
get_mgt_settable_log_gptp_capble_message_interval Get the management settable log gptp capable message interval
get_cmlds_link_port_enable Get the cmlds link port enable status for a PTP port
get_rx_sync_count Get the counter value for received Sync messages for a PTP port
get_rx_one_step_sync_count Get the counter value for received one step Sync messages for a PTP port
get_rx_follow_up_count Get the counter value for received Follow-Up messages for a PTP port
get_rx_pdelay_request_count Get the counter value for received Pdelay request messages for a PTP port
get_rx_pdelay_resp_count Get the counter value for received Pdelay response messages for a PTP port
get_rx_pdelay_resp_fu_count Get the counter value for received Pdelay response follow up messages for a PTP port
get_rx_announce_count Get the counter value for received Announce messages for a PTP port
get_rx_packet_discard_count Get the counter value for discarded PTP packets for a PTP port
get_sync_receipt_timeout_count Get the counter value for Sync receipt timeouts for a PTP port
get_announce_receipt_timeout_count Get the counter value for Announce receipt timeouts for a PTP port
get_pdelay_allowed_lost_responses_exceeded_count Get the counter value for lost responses exceeded for a PTP port
get_sync_tx_count Get the counter value for transmitted Sync messages for a PTP port
get_tx_one_step_sync_count Get the counter value for transmitted one step Sync messages for a PTP port
get_tx_follow_up_count Get the counter value for transmitted Follow-Up messages for a PTP port
get_tx_pdelay_request_count Get the counter value for transmitted Pdelay request messages for a PTP port
get_tx_Pdelay_response_count Get the counter value for transmitted Pdelay response messages for a PTP port
get_tx_Pdelay_response_follow_up_count Get the counter value for transmitted Pdelay response follow up messages for a PTP port
get_tx_announce_count Get the counter value for transmitted Announce messages for a PTP port
get_cmlds_rx_pdelay_request_count Get the counter value for received Pdelay request messages with CMLDS tag for a PTP port
get_cmlds_rx_pdelay_response_count Get the counter value for received Pdelay response messages with CMLDS tag for a PTP port
get_cmlds_rx_pdelay_response_fu_count Get the counter value for received Pdelay response follow up messages with CMLDS tag for a PTP port
get_cmlds_rx_ptp_packet_discard_count Get the counter value for discarded PTP packetes with CMLDS tag for a PTP port
get_cmlds_pdelay_allowed_lost_responses_exceeded_count Get the counter value for lost responses exceeded with CMLDS tag for a PTP port
get_cmlds_tx_pdelay_request_count Get the counter value for transmitted Pdelay request messages with CMLDS tag for a PTP port
get_cmlds_tx_pdelay_response_count Get the counter value for transmitted Pdelay response messages with CMLDS tag for a PTP port
get_cmlds_tx_pdelay_response_fu_count Get the counter value for transmitted Pdelay response follow up messages with CMLDS tag for a PTP port
get_time_value Get the current time value of the timer (PTP clock)