flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
nsd_lwip.c File Reference
#include "../../network_stack_driver.h"
#include "../../ptp_defs.h"
#include "../../task_ptp.h"
#include "lwip/err.h"
#include "lwip/igmp.h"
#include "lwip/ip4_addr.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/udp.h"
#include "netif/ethernet.h"
#include <string.h>

Go to the source code of this file.

Macros

#define ETHERNET_HEADER_LENGTH   (14)
 

Functions

static void ptp_transmit_cb (uint32_t ts_s, uint32_t ts_ns, void *tag)
 
static void ptp_receive_cb (void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
 
void ptp_nsd_igmp_join_leave (bool join)
 
void ptp_nsd_init (const NsdInitSettings *init)
 
static void ptp_receive_cb (void *pArg, struct udp_pcb *pPCB, struct pbuf *pP, const ip_addr_t *pAddr, uint16_t port)
 
void ptp_nsd_transmit_msg (RawPtpMessage *pMsg, uint32_t uid)
 
void ptp_transmit_free (struct pbuf *pPBuf)
 
void ptp_nsd_get_interface_address (uint8_t *hwa)
 
err_t hook_unknown_ethertype (struct pbuf *pbuf, struct netif *netif)
 

Variables

static struct udp_pcb * PTP_L4_PRIMARY_EVENT = NULL
 
static struct udp_pcb * PTP_L4_PRIMARY_GENERAL = NULL
 
static struct udp_pcb * PTP_L4_PDELAY_EVENT = NULL
 
static struct udp_pcb * PTP_L4_PDELAY_GENERAL = NULL
 
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

◆ ETHERNET_HEADER_LENGTH

#define ETHERNET_HEADER_LENGTH   (14)

Definition at line 227 of file nsd_lwip.c.

Function Documentation

◆ hook_unknown_ethertype()

err_t hook_unknown_ethertype ( struct pbuf *  pbuf,
struct netif *  netif 
)

Definition at line 230 of file nsd_lwip.c.

◆ 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 223 of file nsd_lwip.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 35 of file nsd_lwip.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 48 of file nsd_lwip.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 153 of file nsd_lwip.c.

◆ ptp_receive_cb() [1/2]

static void ptp_receive_cb ( void *  arg,
struct udp_pcb *  pcb,
struct pbuf *  p,
const ip_addr_t *  addr,
u16_t  port 
)
static

◆ ptp_receive_cb() [2/2]

static void ptp_receive_cb ( void *  pArg,
struct udp_pcb *  pPCB,
struct pbuf *  pP,
const ip_addr_t *  pAddr,
uint16_t  port 
)
static

Definition at line 141 of file nsd_lwip.c.

◆ ptp_transmit_cb()

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

Definition at line 149 of file nsd_lwip.c.

◆ ptp_transmit_free()

void ptp_transmit_free ( struct pbuf *  pPBuf)

Definition at line 219 of file nsd_lwip.c.

Variable Documentation

◆ custom_p2p_8023_pdel_dest

uint8_t custom_p2p_8023_pdel_dest[6] = {}
static

Definition at line 28 of file nsd_lwip.c.

◆ custom_p2p_8023_pdel_dest_valid

bool custom_p2p_8023_pdel_dest_valid = false
static

Definition at line 27 of file nsd_lwip.c.

◆ custom_p2p_8023_primary_dest

uint8_t custom_p2p_8023_primary_dest[6] = {}
static

Definition at line 26 of file nsd_lwip.c.

◆ custom_p2p_8023_primary_dest_valid

bool custom_p2p_8023_primary_dest_valid = false
static

Definition at line 25 of file nsd_lwip.c.

◆ DM

PtpDelayMechanism DM = -1
static

Definition at line 24 of file nsd_lwip.c.

◆ PTP_L4_PDELAY_EVENT

struct udp_pcb* PTP_L4_PDELAY_EVENT = NULL
static

Definition at line 19 of file nsd_lwip.c.

◆ PTP_L4_PDELAY_GENERAL

struct udp_pcb* PTP_L4_PDELAY_GENERAL = NULL
static

Definition at line 20 of file nsd_lwip.c.

◆ PTP_L4_PRIMARY_EVENT

struct udp_pcb* PTP_L4_PRIMARY_EVENT = NULL
static

Definition at line 17 of file nsd_lwip.c.

◆ PTP_L4_PRIMARY_GENERAL

struct udp_pcb* PTP_L4_PRIMARY_GENERAL = NULL
static

Definition at line 18 of file nsd_lwip.c.

◆ TP

PtpTransportType TP = -1
static

Definition at line 23 of file nsd_lwip.c.

◆ zero_mac

const uint8_t zero_mac[6] = {}
static

Definition at line 30 of file nsd_lwip.c.