#include #include #include #include "ptp_core.h" #define S (gPtpCoreState) // print clock identity void ptp_print_clock_identity(uint64_t clockID) { uint8_t *p = (uint8_t *) & clockID; uint8_t i; for (i = 0; i < 8; i++) { // reverse byte order due to Network->Host byte order conversion MSG("%02x", p[7 - i]); } } // create clock identity based on MAC address void ptp_create_clock_identity() { uint8_t *p = (uint8_t *) & S.hwoptions.clockIdentity; // construct clockIdentity memcpy(p, netif_default->hwaddr, 3); // first 3 octets of MAC address p[3] = 0xff; p[4] = 0xfe; memcpy(&p[5], &netif_default->hwaddr[3], 3); // last 3 octets of MAC address // display ID MSG("Own clock ID: "); ptp_print_clock_identity(S.hwoptions.clockIdentity); MSG("\n"); }