flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
slave.c File Reference
#include "slave.h"
#include "common.h"
#include "format_utils.h"
#include "msg_utils.h"
#include "portmacro.h"
#include "ptp_types.h"
#include "settings_interface.h"
#include "stats.h"
#include "task_ptp.h"
#include "timeutils.h"
#include "ptp_core.h"
#include "ptp_defs.h"
#include <math.h>

Go to the source code of this file.

Macros

#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 

Functions

static void ptp_perform_correction ()
 
static void ptp_commence_e2e_correction ()
 
static void ptp_commence_p2p_correction (uint32_t pdelRespSeqId)
 
void ptp_slave_process_message (RawPtpMessage *pRawMsg, PtpHeader *pHeader)
 
void ptp_slave_init ()
 
void ptp_slave_destroy ()
 
void ptp_slave_reset ()
 
void ptp_slave_tick ()
 
void ptp_slave_enable ()
 
void ptp_slave_disable ()
 

Macro Definition Documentation

◆ MAX

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 27 of file slave.c.

◆ MIN

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 21 of file slave.c.

Function Documentation

◆ ptp_commence_e2e_correction()

static void ptp_commence_e2e_correction ( )
static

Initiate the E2E correction. This piece of code has been extracted from the ptp_slave_process_message() to prevent code duplication.

Definition at line 158 of file slave.c.

◆ ptp_commence_p2p_correction()

static void ptp_commence_p2p_correction ( uint32_t  pdelRespSeqId)
static

Initiate the P2P correction. This piece of code has been extracted from the ptp_slave_process_message() to prevent code duplication.

Parameters
pdelRespSeqIdsequence ID of the last completed PDel_Req...PDel_Resp(_Follow_Up) cycle

Definition at line 187 of file slave.c.

◆ ptp_perform_correction()

static void ptp_perform_correction ( )
static

Perform clock correction based on gathered timestamps.

Definition at line 38 of file slave.c.

◆ ptp_slave_destroy()

void ptp_slave_destroy ( )

Destroy the PTP slave.

Definition at line 365 of file slave.c.

◆ ptp_slave_disable()

void ptp_slave_disable ( )

Stop PTP slave (autonomous) operation.

Definition at line 416 of file slave.c.

◆ ptp_slave_enable()

void ptp_slave_enable ( )

Start PTP slave (autonomous) operation.

Definition at line 408 of file slave.c.

◆ ptp_slave_init()

void ptp_slave_init ( )

Initialize the PTP slave.

Definition at line 357 of file slave.c.

◆ ptp_slave_process_message()

void ptp_slave_process_message ( RawPtpMessage pRawMsg,
PtpHeader pHeader 
)

Process PTP packet addressed to a slave clock.

Parameters
pRawMsgpointer to the raw PTP message
pHeaderpointer to the extracted PTP header

Definition at line 200 of file slave.c.

◆ ptp_slave_reset()

void ptp_slave_reset ( )

Reset the PTP slave.

Definition at line 369 of file slave.c.

◆ ptp_slave_tick()

void ptp_slave_tick ( )

Tick the slave module.

Definition at line 381 of file slave.c.