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 <inttypes.h>
#include <string.h>
#include "minmax.h"

Go to the source code of this file.

Macros

#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

◆ 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 217 of file master.c.

Function Documentation

◆ ptp_init_announce_header()

static void ptp_init_announce_header ( )
static

Definition at line 40 of file master.c.

◆ ptp_init_follow_up_message()

static void ptp_init_follow_up_message ( )
static

Definition at line 96 of file master.c.

◆ ptp_init_sync_header()

static void ptp_init_sync_header ( )
static

Definition at line 67 of file master.c.

◆ ptp_master_commence_mpd_computation()

static void ptp_master_commence_mpd_computation ( )
static

Definition at line 277 of file master.c.

◆ ptp_master_destroy()

void ptp_master_destroy ( )

Destroy th eMaster module.

Definition at line 377 of file master.c.

◆ ptp_master_disable()

void ptp_master_disable ( )

Disable the master module.

Definition at line 428 of file master.c.

◆ ptp_master_enable()

void ptp_master_enable ( )

Enable the master module.

Definition at line 404 of file master.c.

◆ ptp_master_init()

void ptp_master_init ( )

Initialize the Master module.

Definition at line 372 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 225 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 299 of file master.c.

◆ ptp_master_reset()

void ptp_master_reset ( )

Reset the Master module.

Definition at line 381 of file master.c.

◆ ptp_master_tick()

void ptp_master_tick ( )

Pass ticks to the Master module.

Definition at line 432 of file master.c.

◆ ptp_send_announce_message()

static void ptp_send_announce_message ( )
static

Definition at line 105 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 174 of file master.c.

◆ ptp_send_follow_up()

static void ptp_send_follow_up ( const RawPtpMessage pMsg)
static

Definition at line 126 of file master.c.

◆ ptp_send_sync_message()

static void ptp_send_sync_message ( )
static

Definition at line 155 of file master.c.

Variable Documentation

◆ announce

RawPtpMessage announce
static

Definition at line 34 of file master.c.

◆ announceHeader

PtpHeader announceHeader
static

Definition at line 33 of file master.c.

◆ followUp

RawPtpMessage followUp
static

Definition at line 37 of file master.c.

◆ P2P_SLAVE_STATE_HINTS

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

Definition at line 212 of file master.c.

◆ sync_

RawPtpMessage sync_
static

Definition at line 36 of file master.c.

◆ syncHeader

PtpHeader syncHeader
static

Definition at line 35 of file master.c.

◆ tlvChain

const PtpProfileTlvElement* tlvChain
static

Definition at line 38 of file master.c.