flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
task_ptp.c File Reference
#include "task_ptp.h"
#include <string.h>
#include "config.h"
#include "event.h"
#include "network_stack_driver.h"
#include "portmacro.h"
#include "profiles.h"
#include "projdefs.h"
#include "ptp_core.h"
#include "ptp_raw_msg_circbuf.h"
#include "settings_interface.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include <flexptp_options.h>

Go to the source code of this file.

Macros

#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define RX_PACKET_FIFO_LENGTH   (32)
 Receive packet FIFO length.
 
#define TX_PACKET_FIFO_LENGTH   (16)
 Transmit packet FIFO length.
 
#define EVENT_FIFO_LENGTH   (32)
 Event FIFO length.
 

Functions

static void ptp_create_message_queues ()
 
static void ptp_destroy_message_queues ()
 
void reg_task_ptp ()
 
void unreg_task_ptp ()
 
bool ptp_event_enqueue (const PtpCoreEvent *event)
 
void ptp_receive_enqueue (const void *pPayload, uint32_t len, uint32_t ts_sec, uint32_t ts_ns, int tp)
 
bool ptp_transmit_enqueue (const RawPtpMessage *pMsg)
 
static void task_ptp (void *pParam)
 
bool task_ptp_is_operating ()
 

Macro Definition Documentation

◆ EVENT_FIFO_LENGTH

#define EVENT_FIFO_LENGTH   (32)

Event FIFO length.

Definition at line 45 of file task_ptp.c.

◆ MIN

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 26 of file task_ptp.c.

◆ RX_PACKET_FIFO_LENGTH

#define RX_PACKET_FIFO_LENGTH   (32)

Receive packet FIFO length.

Definition at line 43 of file task_ptp.c.

◆ TX_PACKET_FIFO_LENGTH

#define TX_PACKET_FIFO_LENGTH   (16)

Transmit packet FIFO length.

Definition at line 44 of file task_ptp.c.

Function Documentation

◆ ptp_create_message_queues()

static void ptp_create_message_queues ( )
static

Definition at line 60 of file task_ptp.c.

◆ ptp_destroy_message_queues()

static void ptp_destroy_message_queues ( )
static

Definition at line 76 of file task_ptp.c.

◆ ptp_event_enqueue()

bool ptp_event_enqueue ( const PtpCoreEvent event)

Post an event.

Parameters
eventpointer to a filled event object
Returns
sucessful posting

Definition at line 136 of file task_ptp.c.

◆ ptp_receive_enqueue()

void ptp_receive_enqueue ( const void *  pPayload,
uint32_t  len,
uint32_t  ts_sec,
uint32_t  ts_ns,
int  tp 
)

Enqueue PTP message.

Parameters
pPayloadmessage payload
lenmessage length
ts_secreception timestamp seconds part
ts_nsreceptiopn timestamp nanoseconds part
tptransport portocol (L2/L4)

Definition at line 141 of file task_ptp.c.

◆ ptp_transmit_enqueue()

bool ptp_transmit_enqueue ( const RawPtpMessage pMsg)

Put a PTP message into the transmit queue.

Parameters
pMsgpointer to raw PTP message. Can be discarded after the function has returned.
Returns
successful insertion

Definition at line 171 of file task_ptp.c.

◆ reg_task_ptp()

void reg_task_ptp ( )

Register PTP task.

Definition at line 90 of file task_ptp.c.

◆ task_ptp()

static void task_ptp ( void *  pParam)
static

Definition at line 193 of file task_ptp.c.

◆ task_ptp_is_operating()

bool task_ptp_is_operating ( )

Is the PTP task operating?

Definition at line 237 of file task_ptp.c.

◆ unreg_task_ptp()

void unreg_task_ptp ( )

Unreg PTP task.

Definition at line 128 of file task_ptp.c.