Step 3.1: EMAC hardware timestamps for PTP over UDP/IPv4
- aes67_ptp/ptp_hw.c: start the EMAC IEEE 1588 clock (IDF
ETH_MAC_ESP_CMD_PTP_ENABLE) and additionally enable snapshots for
PTP over UDP/IPv4 (IDF only enables PTP over Ethernet/L2). An RX hook
on the driver's info input path records {type, seq, sourcePortId, HW
timestamp} of port-319 PTPv2 event messages, then hands every frame to
lwIP unchanged.
- aes67_ptp.c: temporary 3.1 logger joins 224.0.1.129:319/320 and pairs
Sync HW RX timestamps with Follow_Up origin timestamps.
- Checked against linuxptp ptp4l (-4 -E -H, Intel igb) as GM: every Sync
has a HW timestamp; HW Sync intervals track the GM intervals with a
constant -39.8 us/s (+-0.3 us), i.e. local clock -39.8 ppm vs GM.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// EMAC IEEE 1588 clock and hardware timestamps for PTP over UDP/IPv4.
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "esp_eth_driver.h"
|
||||
#include "esp_eth_mac.h"
|
||||
#include "esp_netif.h"
|
||||
|
||||
#define PTP_MSG_SYNC 0x0
|
||||
#define PTP_MSG_DELAY_REQ 0x1
|
||||
#define PTP_MSG_FOLLOW_UP 0x8
|
||||
#define PTP_MSG_DELAY_RESP 0x9
|
||||
#define PTP_MSG_ANNOUNCE 0xB
|
||||
|
||||
// Start the EMAC PTP clock, enable IPv4/UDP timestamping and hook the RX path.
|
||||
esp_err_t ptp_hw_init(esp_eth_handle_t eth, esp_netif_t *netif);
|
||||
// Hardware RX timestamp of an event message (UDP port 319), looked up by type,
|
||||
// sequence ID and sourcePortIdentity (10 bytes). Each record is returned once.
|
||||
bool ptp_hw_rx_ts(uint8_t msg_type, uint16_t seq, const uint8_t *src_port_id, eth_mac_time_t *ts);
|
||||
esp_err_t ptp_hw_get_time(eth_mac_time_t *t);
|
||||
Reference in New Issue
Block a user