flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
nsd_etherlib.c File Reference
#include "../../network_stack_driver.h"
#include "../../ptp_defs.h"
#include "../../ptp_types.h"
#include "../../task_ptp.h"
#include "etherlib/cbd_table.h"
#include "etherlib/connection_block.h"
#include "etherlib/eth_interface.h"
#include "etherlib/global_state.h"
#include "etherlib/prefab/conn_blocks/custom_ethertype_connblock.h"
#include "etherlib/prefab/conn_blocks/igmp_connblock.h"
#include "etherlib/prefab/packet_parsers/ethernet_frame.h"
#include "etherlib/prefab/packet_parsers/ipv4_types.h"
#include "etherlib/timestamping.h"
#include <stdbool.h>
#include <string.h>

Go to the source code of this file.

Macros

#define CLOSE_CONNECTION_IF_EXISTS(d)   if (d >= CBD_LOWEST_DESCRIPTOR) { close_connection(d); d = 0; }
 

Functions

static void ptp_transmit_cb (uint32_t ts_s, uint32_t ts_ns, uint32_t tag)
 
static int ptp_receive_cb (const Pckt *packet, PcktSieveLayerTag tag)
 
void ptp_nsd_igmp_join_leave (bool join)
 
void ptp_nsd_init (PtpTransportType tp, PtpDelayMechanism dm)
 
void ptp_nsd_transmit_msg (RawPtpMessage *pMsg)
 
void ptp_nsd_get_interface_address (uint8_t *hwa)
 

Variables

static cbd PTP_L4_EVENT = 0
 
static cbd PTP_L4_GENERAL = 0
 
static cbd PTP_L2 = 0
 
static PtpTransportType TP = -1
 
static PtpDelayMechanism DM = -1
 

Macro Definition Documentation

◆ CLOSE_CONNECTION_IF_EXISTS

#define CLOSE_CONNECTION_IF_EXISTS (   d)    if (d >= CBD_LOWEST_DESCRIPTOR) { close_connection(d); d = 0; }

Definition at line 48 of file nsd_etherlib.c.

Function Documentation

◆ ptp_nsd_get_interface_address()

void ptp_nsd_get_interface_address ( uint8_t *  hwa)

Fetch the Ethernet network interface hardware address.

Parameters
hwapointer to a 6-byte array where the hardware address is going to be stored to

Definition at line 150 of file nsd_etherlib.c.

◆ ptp_nsd_igmp_join_leave()

void ptp_nsd_igmp_join_leave ( bool  join)

Join or leave IGMP groups associated with the current PTP profile.

Definition at line 32 of file nsd_etherlib.c.

◆ ptp_nsd_init()

void ptp_nsd_init ( PtpTransportType  tp,
PtpDelayMechanism  dm 
)

Initialize or reinitialize the Network Stack Driver.

Parameters
tpPTP transport type
dmPTP delay mechanism

Definition at line 50 of file nsd_etherlib.c.

◆ ptp_nsd_transmit_msg()

void ptp_nsd_transmit_msg ( RawPtpMessage pMsg)

Transmit a PTP message.

Parameters
pMsgpointer to a RawPtpMessage

Definition at line 135 of file nsd_etherlib.c.

◆ ptp_receive_cb()

static int ptp_receive_cb ( const Pckt *  packet,
PcktSieveLayerTag  tag 
)
static

Definition at line 95 of file nsd_etherlib.c.

◆ ptp_transmit_cb()

static void ptp_transmit_cb ( uint32_t  ts_s,
uint32_t  ts_ns,
uint32_t  tag 
)
static

Definition at line 119 of file nsd_etherlib.c.

Variable Documentation

◆ DM

PtpDelayMechanism DM = -1
static

Definition at line 27 of file nsd_etherlib.c.

◆ PTP_L2

cbd PTP_L2 = 0
static

Definition at line 23 of file nsd_etherlib.c.

◆ PTP_L4_EVENT

cbd PTP_L4_EVENT = 0
static

Definition at line 21 of file nsd_etherlib.c.

◆ PTP_L4_GENERAL

cbd PTP_L4_GENERAL = 0
static

Definition at line 22 of file nsd_etherlib.c.

◆ TP

PtpTransportType TP = -1
static

Definition at line 26 of file nsd_etherlib.c.