flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
master.c File Reference
#include "master.h"
#include "common.h"
#include "flexptp_options.h"
#include "format_utils.h"
#include "msg_utils.h"
#include "ptp_core.h"
#include "ptp_defs.h"
#include "ptp_profile_presets.h"
#include "ptp_sync_cycle_data.h"
#include "ptp_types.h"
#include "task_ptp.h"
#include "timeutils.h"
#include "tlv.h"
#include <string.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))
 
#define PTP_MASTER_P2P_SLAVE_STATE_LOG()    CLILOG(S.logging.def && (si->state != prevState), "%s -> %s\n", P2P_SLAVE_STATE_HINTS[prevState], P2P_SLAVE_STATE_HINTS[si->state])
 

Functions

static void ptp_init_announce_header ()
 
static void ptp_init_sync_header ()
 
static void ptp_init_follow_up_message ()
 
static void ptp_send_announce_message ()
 
static void ptp_send_follow_up (const RawPtpMessage *pMsg)
 
static void ptp_send_sync_message ()
 
static void ptp_send_delay_resp_message (const RawPtpMessage *pRawMsg, const PtpHeader *pHeader)
 
static void ptp_master_p2p_slave_reported (uint64_t slClockId)
 
static void ptp_master_commence_mpd_computation ()
 
void ptp_master_process_message (RawPtpMessage *pRawMsg, PtpHeader *pHeader)
 
void ptp_master_init ()
 
void ptp_master_destroy ()
 
void ptp_master_reset ()
 
void ptp_master_enable ()
 
void ptp_master_disable ()
 
void ptp_master_tick ()
 

Variables

static PtpHeader announceHeader
 
static RawPtpMessage announce
 
static PtpHeader syncHeader
 
static RawPtpMessage sync
 
static RawPtpMessage followUp
 
static const PtpProfileTlvElementtlvChain
 
static char * P2P_SLAVE_STATE_HINTS []
 

Macro Definition Documentation

◆ MAX

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

Definition at line 28 of file master.c.

◆ MIN

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

Definition at line 22 of file master.c.

◆ PTP_MASTER_P2P_SLAVE_STATE_LOG

#define PTP_MASTER_P2P_SLAVE_STATE_LOG ( )     CLILOG(S.logging.def && (si->state != prevState), "%s -> %s\n", P2P_SLAVE_STATE_HINTS[prevState], P2P_SLAVE_STATE_HINTS[si->state])

Definition at line 222 of file master.c.

Function Documentation

◆ ptp_init_announce_header()

static void ptp_init_announce_header ( )
static

Definition at line 49 of file master.c.

◆ ptp_init_follow_up_message()

static void ptp_init_follow_up_message ( )
static

Definition at line 103 of file master.c.

◆ ptp_init_sync_header()

static void ptp_init_sync_header ( )
static

Definition at line 75 of file master.c.

◆ ptp_master_commence_mpd_computation()

static void ptp_master_commence_mpd_computation ( )
static

Definition at line 282 of file master.c.

◆ ptp_master_destroy()

void ptp_master_destroy ( )

Destroy th eMaster module.

Definition at line 369 of file master.c.

◆ ptp_master_disable()

void ptp_master_disable ( )

Disable the master module.

Definition at line 417 of file master.c.

◆ ptp_master_enable()

void ptp_master_enable ( )

Enable the master module.

Definition at line 393 of file master.c.

◆ ptp_master_init()

void ptp_master_init ( )

Initialize the Master module.

Definition at line 364 of file master.c.

◆ ptp_master_p2p_slave_reported()

static void ptp_master_p2p_slave_reported ( uint64_t  slClockId)
static

Function to track what's going on with the slave.

Parameters
slClockIdclock ID of the slave that responded to our PDelay_Req message

Definition at line 230 of file master.c.

◆ ptp_master_process_message()

void ptp_master_process_message ( RawPtpMessage pRawMsg,
PtpHeader pHeader 
)

Process a message by the master module.

Parameters
pRawMsgPointer to the raw PTP message.
pHeaderPointer to the extracted PTP message header.

Definition at line 304 of file master.c.

◆ ptp_master_reset()

void ptp_master_reset ( )

Reset the Master module.

Definition at line 373 of file master.c.

◆ ptp_master_tick()

void ptp_master_tick ( )

Pass ticks to the Master module.

Definition at line 421 of file master.c.

◆ ptp_send_announce_message()

static void ptp_send_announce_message ( )
static

Definition at line 112 of file master.c.

◆ ptp_send_delay_resp_message()

static void ptp_send_delay_resp_message ( const RawPtpMessage pRawMsg,
const PtpHeader pHeader 
)
static

Definition at line 181 of file master.c.

◆ ptp_send_follow_up()

static void ptp_send_follow_up ( const RawPtpMessage pMsg)
static

Definition at line 134 of file master.c.

◆ ptp_send_sync_message()

static void ptp_send_sync_message ( )
static

Definition at line 161 of file master.c.

Variable Documentation

◆ announce

RawPtpMessage announce
static

Definition at line 43 of file master.c.

◆ announceHeader

PtpHeader announceHeader
static

Definition at line 42 of file master.c.

◆ followUp

RawPtpMessage followUp
static

Definition at line 46 of file master.c.

◆ P2P_SLAVE_STATE_HINTS

char* P2P_SLAVE_STATE_HINTS[]
static
Initial value:
= {
"NONE",
"CANDIDATE",
"ESTABLISHED"}

Definition at line 217 of file master.c.

◆ sync

RawPtpMessage sync
static

Definition at line 45 of file master.c.

◆ syncHeader

PtpHeader syncHeader
static

Definition at line 44 of file master.c.

◆ tlvChain

const PtpProfileTlvElement* tlvChain
static

Definition at line 47 of file master.c.