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)
 

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 (const NsdInitSettings *init)
 
void ptp_nsd_transmit_msg (RawPtpMessage *pMsg, uint32_t uid)
 
void ptp_nsd_get_interface_address (uint8_t *hwa)
 

Variables

static cbd PTP_L4_PRIMARY_EVENT = 0
 
static cbd PTP_L4_PRIMARY_GENERAL = 0
 
static cbd PTP_L4_PDELAY_EVENT = 0
 
static cbd PTP_L4_PDELAY_GENERAL = 0
 
static cbd PTP_L2 = 0
 
static PtpTransportType TP = -1
 
static PtpDelayMechanism DM = -1
 
static bool custom_p2p_8023_primary_dest_valid = false
 
static uint8_t custom_p2p_8023_primary_dest [6] = {}
 
static bool custom_p2p_8023_pdel_dest_valid = false
 
static uint8_t custom_p2p_8023_pdel_dest [6] = {}
 
static const uint8_t zero_mac [6] = {}
 

Macro Definition Documentation

◆ CLOSE_CONNECTION_IF_EXISTS

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

Definition at line 57 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 178 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 40 of file nsd_etherlib.c.

◆ ptp_nsd_init()

void ptp_nsd_init ( const NsdInitSettings *  init)

Initialize or reinitialize the Network Stack Driver.

Parameters
initNSD initialization settings

Definition at line 63 of file nsd_etherlib.c.

◆ ptp_nsd_transmit_msg()

void ptp_nsd_transmit_msg ( RawPtpMessage *  pMsg,
uint32_t  uid 
)

Transmit a PTP message.

Parameters
pMsgpointer to a RawPtpMessage
uidUID of the message

Definition at line 159 of file nsd_etherlib.c.

◆ ptp_receive_cb()

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

Definition at line 131 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 155 of file nsd_etherlib.c.

Variable Documentation

◆ custom_p2p_8023_pdel_dest

uint8_t custom_p2p_8023_pdel_dest[6] = {}
static

Definition at line 33 of file nsd_etherlib.c.

◆ custom_p2p_8023_pdel_dest_valid

bool custom_p2p_8023_pdel_dest_valid = false
static

Definition at line 32 of file nsd_etherlib.c.

◆ custom_p2p_8023_primary_dest

uint8_t custom_p2p_8023_primary_dest[6] = {}
static

Definition at line 31 of file nsd_etherlib.c.

◆ custom_p2p_8023_primary_dest_valid

bool custom_p2p_8023_primary_dest_valid = false
static

Definition at line 30 of file nsd_etherlib.c.

◆ DM

PtpDelayMechanism DM = -1
static

Definition at line 29 of file nsd_etherlib.c.

◆ PTP_L2

cbd PTP_L2 = 0
static

Definition at line 25 of file nsd_etherlib.c.

◆ PTP_L4_PDELAY_EVENT

cbd PTP_L4_PDELAY_EVENT = 0
static

Definition at line 23 of file nsd_etherlib.c.

◆ PTP_L4_PDELAY_GENERAL

cbd PTP_L4_PDELAY_GENERAL = 0
static

Definition at line 24 of file nsd_etherlib.c.

◆ PTP_L4_PRIMARY_EVENT

cbd PTP_L4_PRIMARY_EVENT = 0
static

Definition at line 21 of file nsd_etherlib.c.

◆ PTP_L4_PRIMARY_GENERAL

cbd PTP_L4_PRIMARY_GENERAL = 0
static

Definition at line 22 of file nsd_etherlib.c.

◆ TP

PtpTransportType TP = -1
static

Definition at line 28 of file nsd_etherlib.c.

◆ zero_mac

const uint8_t zero_mac[6] = {}
static

Definition at line 35 of file nsd_etherlib.c.