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, uint32_t 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 (PtpTransportType tp, PtpDelayMechanism dm)
 
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)
 
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_EVENT = NULL
 
static struct udp_pcb * PTP_L4_GENERAL = NULL
 
static PtpTransportType TP = -1
 
static PtpDelayMechanism DM = -1
 

Macro Definition Documentation

◆ ETHERNET_HEADER_LENGTH

#define ETHERNET_HEADER_LENGTH   (14)

Definition at line 153 of file nsd_lwip.c.

Function Documentation

◆ hook_unknown_ethertype()

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

Definition at line 156 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 149 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 27 of file nsd_lwip.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 40 of file nsd_lwip.c.

◆ ptp_nsd_transmit_msg()

void ptp_nsd_transmit_msg ( RawPtpMessage pMsg)

Transmit a PTP message.

Parameters
pMsgpointer to a RawPtpMessage

Definition at line 112 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 85 of file nsd_lwip.c.

◆ ptp_transmit_cb()

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

Definition at line 93 of file nsd_lwip.c.

◆ ptp_transmit_free()

void ptp_transmit_free ( struct pbuf *  pPBuf)

Definition at line 145 of file nsd_lwip.c.

Variable Documentation

◆ DM

PtpDelayMechanism DM = -1
static

Definition at line 22 of file nsd_lwip.c.

◆ PTP_L4_EVENT

struct udp_pcb* PTP_L4_EVENT = NULL
static

Definition at line 17 of file nsd_lwip.c.

◆ PTP_L4_GENERAL

struct udp_pcb* PTP_L4_GENERAL = NULL
static

Definition at line 18 of file nsd_lwip.c.

◆ TP

PtpTransportType TP = -1
static

Definition at line 21 of file nsd_lwip.c.