flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
clock_utils.c File Reference
#include "clock_utils.h"
#include <stdint.h>
#include <ctype.h>
#include <string.h>
#include "ptp_core.h"
#include <flexptp_options.h>

Go to the source code of this file.

Functions

void ptp_print_clock_identity (uint64_t clockID)
 
void ptp_create_clock_identity (const uint8_t *hwa)
 
uint64_t hextoclkid (const char *str)
 

Function Documentation

◆ hextoclkid()

uint64_t hextoclkid ( const char *  str)

Convert a string containing only hexadecimal digits to a 64-bit LE clock ID representation.

Parameters
strstring repesentation of the clock ID

Definition at line 40 of file clock_utils.c.

◆ ptp_create_clock_identity()

void ptp_create_clock_identity ( const uint8_t *  hwa)

Generate clock ID based on the MAC address. It works the following way: the first 3 bytes come from the first three bytes of the MAC address, then a string of 0xFF-0xFE is appended, finally the second three bytes of the MAC-address is inserted.

Parameters
hwahardware address of the network interface

Definition at line 25 of file clock_utils.c.

◆ ptp_print_clock_identity()

void ptp_print_clock_identity ( uint64_t  clockID)

Print PTP hardware clock identity.

Parameters
clockIDclock ID in 64-bit LE representation

Definition at line 16 of file clock_utils.c.