![]() |
flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
|
This module defines format conversion functions between network and host byte order and conversion functions between PTP logarithmic interval designator and time duration value. More...
#include <stdint.h>
Go to the source code of this file.
Functions | |
uint16_t | ptp_logi2ms (int8_t logi) |
int8_t | ptp_ms2logi (uint16_t ms) |
uint64_t | FLEXPTP_ntohll (uint64_t in) |
uint64_t | FLEXPTP_htonll (uint64_t in) |
This module defines format conversion functions between network and host byte order and conversion functions between PTP logarithmic interval designator and time duration value.
Definition in file format_utils.h.
uint64_t FLEXPTP_htonll | ( | uint64_t | in | ) |
Function to swap byte order, convert LE representation to BE. The naming complies with other flexPTP host->network conversion function namings.
in | value in BE representation |
Definition at line 35 of file format_utils.c.
uint64_t FLEXPTP_ntohll | ( | uint64_t | in | ) |
Function to swap byte order, convert BE representation to LE. The naming complies with other flexPTP network->host conversion function namings.
in | value in BE representation |
Definition at line 30 of file format_utils.c.
uint16_t ptp_logi2ms | ( | int8_t | logi | ) |
Convert logarithmic interval designator code to a milliseconds value. Input must be in the inclusive range of [-6, 3].
The function emulates the execution of the following computation: 2^(n) * 1000
logi | PTP-defined logarithmic interval code |
Definition at line 14 of file format_utils.c.
int8_t ptp_ms2logi | ( | uint16_t | ms | ) |
Convert millisecond period value to PTP-defined logarithmic interval designator code. Input must be a value from the following set: (15, 31, 62, 125, 250, 500, 1000, 2000, 4000, 8000).
This function mimics the following computation: round(log2(T/1000))
ms | period in milliseconds. Values of above valid input set must be respected. |
Definition at line 19 of file format_utils.c.