PDK API Guide for J721E
|
Data Structures | |
struct | TimeSync_VlanConfig |
TimeSync VLAN configuration structure. More... | |
struct | TimeSync_PpsConfig |
TimeSync PPS configuration structure. More... | |
struct | TimeSync_ProtocolConfig |
TimeSync protocol configuration structure. More... | |
struct | TimeSync_FrameNotifyConfig |
TimeSync frame notify configuration structure. More... | |
struct | TimeSync_SocConfig |
TimeSync SoC configuration structure. More... | |
struct | TimeSync_Config |
Time synchronization configuration structure. More... | |
Functions | |
TimeSync_Handle | TimeSync_open (TimeSync_Config *timeSyncConfig) |
Function to configure low-level network driver. More... | |
int32_t | TimeSync_getRxTimestamp (TimeSync_Handle timeSyncHandle, TimeSync_FrameType rxFrameType, uint8_t rxPort, uint16_t seqId, uint32_t *nanoseconds, uint64_t *seconds) |
Reads and provides timestamp of a received event message. More... | |
int32_t | TimeSync_getTxTimestamp (TimeSync_Handle timeSyncHandle, TimeSync_FrameType txFrameType, uint8_t txPort, uint16_t seqId, uint32_t *nanoseconds, uint64_t *seconds) |
Reads and provides timestamp of a transmitted event message. More... | |
int32_t | TimeSync_adjTimeSlowComp (TimeSync_Handle timeSyncHandle, int32_t adjOffset, uint32_t syncInterval) |
Adjusts the clock by the drift value over one Sync interval. More... | |
int32_t | TimeSync_setClockTime (TimeSync_Handle timeSyncHandle, uint32_t nanoseconds, uint64_t seconds) |
Changes the timer value. More... | |
void | TimeSync_getCurrentTime (TimeSync_Handle timeSyncHandle, uint32_t *nanoseconds, uint64_t *seconds) |
Returns the current time on device. More... | |
int32_t | TimeSync_getPtpFrame (TimeSync_Handle timeSyncHandle, uint8_t *frame, uint32_t *size, uint8_t *rxPort) |
Receive the PTP frame from hardware queue. More... | |
int32_t | TimeSync_sendPtpFrame (TimeSync_Handle timeSyncHandle, uint8_t *frame, uint32_t size, uint8_t txPort) |
Transmit the PTP frame to the directed port. More... | |
int32_t | TimeSync_isSingleStepSupported (TimeSync_Handle timeSyncHandle) |
Helper function to check if single step mode is supported or not. More... | |
int32_t | TimeSync_getPpsTs (TimeSync_Handle timeSyncHandle, uint32_t *nanoseconds, uint64_t *seconds) |
Get PPS timestamp value. More... | |
void | TimeSync_recalibratePps (TimeSync_Handle timeSyncHandle) |
Re-calibrate PPS compare values to align with timer's second increment. This recalibration is required when there is a huge jump in timer's value because of correction/adjustment. More... | |
int8_t | TimeSync_isPortLinkUp (TimeSync_Handle timeSyncHandle, uint8_t portNum) |
Time sync port link status helper function. More... | |
void | TimeSync_reset (TimeSync_Handle timeSyncHandle) |
Time sync module reset. More... | |
void | TimeSync_close (TimeSync_Handle timeSyncHandle) |
Time sync module close. More... | |
void | TimeSync_updateParentAddress (TimeSync_Handle timeSyncHandle, uint8_t *parentMac) |
Write the MAC ID of PTP master to Firmware. BMC Algorithm calls this API. More... | |
void | TimeSync_setRcf (TimeSync_Handle timeSyncHandle, uint32_t rcfValue) |
Set rate compensation factor value. This is used to communicate path rate compensation factor value to ICSS firmware, for other devices this function returns without doing anything. More... | |
void | TimeSync_setPathDelay (TimeSync_Handle timeSyncHandle, uint32_t pathDelay, uint8_t portNum) |
Set path delay for port. This is used to communicate path delay to ICSS firmware, for other devices this function returns without doing anything. More... | |
void | TimeSync_writeTsSingleStepSync (TimeSync_Handle timeSyncHandle, uint8_t portNum) |
For single step master, computation of Tx seconds and nanoseconds timestamp requires some techniques to avoid a long division in firmware. More... | |
void | TimeSync_addWord (uint8_t *src, uint32_t word) |
Add a word to the packet stream. More... | |
void | TimeSync_addHalfWord (volatile uint8_t *src, uint16_t halfWord) |
Add a half word to the packet stream. More... | |
void | TimeSync_convEndianess (volatile void *src, volatile void *dst, uint8_t numBytes) |
Convert specified number of bytes in source from big endian bytes to little endian and vice versa. Assumption : More... | |
uint32_t | TimeSync_calcChecksum (uint8_t *packet, uint16_t len) |
Compute checksum used in IP/UDP packets for a given stream. More... | |
void | TimeSync_calcIpChecksum (uint8_t *packet) |
Compute checksum for IP Header and modify in place. More... | |
void | TimeSync_calcUdpChecksum (uint8_t *packet) |
Compute checksum for UDP Header and modify in place. More... | |
void | TimeSync_getMacId (uint8_t *packet, uint8_t *macId) |
Get the MAC Id from the network stream, convert it to little endian format and return it assumption : MAC is present in big endian byte format and starts from zero offset. More... | |
void | TimeSync_addMacID (uint8_t *src, uint8_t *macID) |
Copy MAC ID to a stream. More... | |
uint32_t | TimeSync_convBigEndianToLittleEndianWord (uint8_t *byte) |
Get a word from the network stream, convert it to little endian format and return it assumption word is present in big endian byte format and starts from zero offset. More... | |
uint16_t | TimeSync_convBigEndianToLittleEndianHalfWord (uint8_t *byte) |
get a halfword from the network stream, convert it to little endian format and return it assumption halfword is present in big endian byte format and starts from zero offset More... | |
void | TimeSync_convEnd6to8 (volatile void *src, void *dst) |
Takes in a 6 byte reverse byte endian source and puts it in an 64 bit double word with correct endianness. This function is specific to PTP Assumption : More... | |
Typedefs | |
typedef void(* | TimeSync_txNotifyCb) (void *cbArg, uint8_t portNum, uint8_t frameType, uint16_t seqId) |
Transmit callback function. More... | |
typedef void(* | TimeSync_rxNotifyCb) (void *cbArg) |
Receive callback function. More... | |
typedef void(* | TimeSync_ppsNotifyCb) (void *cbArg) |
PTP PPS callback function. More... | |
typedef struct TimeSync_Obj_s * | TimeSync_Handle |
TimeSync handle. More... | |
Macros | |
#define | TIMESYNC_OK (0) |
Success. More... | |
#define | TIMESYNC_UNABLE_TO_INIT_HAL (-1) |
Time Sync feature not supported. More... | |
#define | TIMESYNC_UNABLE_TO_CREATE_TASK (-2) |
Time Sync module is unable to create a Task. More... | |
#define | TIMESYNC_UNABLE_TO_CREATE_SEMAPHORE (-3) |
Time Sync module is unable to create a Semaphore. More... | |
#define | TIMESYNC_UNABLE_TO_CREATE_INTERRUPT (-4) |
Time Sync module is unable to create an interrupt. More... | |
#define | TIMESYNC_UNABLE_TO_ALLOC_MEM (-5) |
Time Sync module is unable to allocate memory. More... | |
#define | TIMESYNC_UNABLE_TO_CREATE_CLOCK (-6) |
Time Sync module is unable to create timer. More... | |
#define | TIMESYNC_UNABLE_TO_CREATE_MAILBOX (-7) |
Time Sync module is unable to create a mailbox. More... | |
#define | TIMESYNC_UNABLE_TO_CREATE_EVENT (-8) |
Time Sync module is unable to create an event. More... | |
#define | TIMESYNC_UNSUPPORTED_FORMAT (-9) |
Time Sync unsupported format. More... | |
#define | TIMESYNC_DMA_INIT_FAILED (-10) |
Time Sync not able to initialize DMA. More... | |
#define | TIMESYNC_FEATURE_NOT_ENABLED (-11) |
Time Sync feature disabled. More... | |
#define | TIMESYNC_HANDLE_NOT_INITIALIZED (-12) |
Time Sync handle uninitialized. More... | |
#define | TIMESYNC_TX_FRAMETYPE_NOTVALID (-13) |
Time Sync Tx frame type invalid. More... | |
#define | TIMESYNC_TX_PORTNUMBER_NOTVALID (-14) |
Time Sync Tx port number invalid. More... | |
#define | TIMESYNC_RX_FRAMETYPE_NOTVALID (-15) |
Time Sync Rx frame type invalid. More... | |
#define | TIMESYNC_RX_PORTNUMBER_NOTVALID (-16) |
Time Sync Rx port number invalid. More... | |
#define | TIMESYNC_PARAM_INVALID (-17) |
Time Sync invalid parameter. More... | |
#define | TIMESYNC_FEATURE_NOT_SUPPORTED (-18) |
Time Sync feature not supported. More... | |
#define | TIMESYNC_FRAME_NOT_AVAILABLE (-19) |
Time Sync frame not available. More... | |
#define | TIMESYNC_NUM_DOMAINS (2U) |
#define | TIMESYNC_SET_BIT(n) (1U << (n)) |
#define | TIMESYNC_GET_BIT(val, n) ((val & (1U << n)) >> n) |
#define | TIMESYNC_IS_BIT_SET(val, n) (((val) & (1U << (n))) != 0U) |
#define | TIMESYNC_START_OF_IP_HEADER (14) |
#define | TIMESYNC_START_OF_IP_CHECKSUM (TIMESYNC_START_OF_IP_HEADER + 10U) |
#define | TIMESYNC_START_OF_IP_LENGTH (TIMESYNC_START_OF_IP_HEADER + 2U) |
#define | TIMESYNC_START_OF_UDP_HEADER (34U) |
#define | TIMESYNC_START_OF_UDP_CHECKSUM (TIMESYNC_START_OF_UDP_HEADER + 6U) |
#define | TIMESYNC_START_OF_UDP_LENGTH (TIMESYNC_START_OF_UDP_HEADER + 4U) |
#define | TIMESYNC_START_OF_IP_PROTOCOL (TIMESYNC_START_OF_IP_HEADER + 9U) |
#define | TIMESYNC_START_OF_IP_ADDRESS (TIMESYNC_START_OF_IP_HEADER + 12U) |
#define | TIMESYNC_DEFAULT_ETH_HEADER_SIZE (14U) |
#define | TIMESYNC_DEFAULT_IP_HEADER_SIZE (20U) |
#define | TIMESYNC_DEFAULT_UDP_HEADER_SIZE (8U) |
#define | TIMESYNC_DEFAULT_HEADER_SIZE (42U) |
#define | TIMESYNC_START_OF_PAYLOAD (TIMESYNC_START_OF_UDP_HEADER + TIMESYNC_DEFAULT_UDP_HEADER_SIZE) |
#define | TIMESYNC_SEC_TO_NS (1000000000U) |
#define | TIMESYNC_MAC_ADDR_LEN (6U) |
#define | TIMESYNC_IPV4_ADDR_LEN (4U) |
#define | TIMESYNC_IPV6_ADDR_LEN (16U) |
#define | TIMESYNC_COMPARE_MAC(x, y) (memcmp((x), (y), 6U) == 0) |
#define TIMESYNC_OK (0) |
Success.
#define TIMESYNC_UNABLE_TO_INIT_HAL (-1) |
Time Sync feature not supported.
#define TIMESYNC_UNABLE_TO_CREATE_TASK (-2) |
Time Sync module is unable to create a Task.
#define TIMESYNC_UNABLE_TO_CREATE_SEMAPHORE (-3) |
Time Sync module is unable to create a Semaphore.
#define TIMESYNC_UNABLE_TO_CREATE_INTERRUPT (-4) |
Time Sync module is unable to create an interrupt.
#define TIMESYNC_UNABLE_TO_ALLOC_MEM (-5) |
Time Sync module is unable to allocate memory.
#define TIMESYNC_UNABLE_TO_CREATE_CLOCK (-6) |
Time Sync module is unable to create timer.
#define TIMESYNC_UNABLE_TO_CREATE_MAILBOX (-7) |
Time Sync module is unable to create a mailbox.
#define TIMESYNC_UNABLE_TO_CREATE_EVENT (-8) |
Time Sync module is unable to create an event.
#define TIMESYNC_UNSUPPORTED_FORMAT (-9) |
Time Sync unsupported format.
#define TIMESYNC_DMA_INIT_FAILED (-10) |
Time Sync not able to initialize DMA.
#define TIMESYNC_FEATURE_NOT_ENABLED (-11) |
Time Sync feature disabled.
#define TIMESYNC_HANDLE_NOT_INITIALIZED (-12) |
Time Sync handle uninitialized.
#define TIMESYNC_TX_FRAMETYPE_NOTVALID (-13) |
Time Sync Tx frame type invalid.
#define TIMESYNC_TX_PORTNUMBER_NOTVALID (-14) |
Time Sync Tx port number invalid.
#define TIMESYNC_RX_FRAMETYPE_NOTVALID (-15) |
Time Sync Rx frame type invalid.
#define TIMESYNC_RX_PORTNUMBER_NOTVALID (-16) |
Time Sync Rx port number invalid.
#define TIMESYNC_PARAM_INVALID (-17) |
Time Sync invalid parameter.
#define TIMESYNC_FEATURE_NOT_SUPPORTED (-18) |
Time Sync feature not supported.
#define TIMESYNC_FRAME_NOT_AVAILABLE (-19) |
Time Sync frame not available.
#define TIMESYNC_NUM_DOMAINS (2U) |
Number of domains supported by this PTP implementation
#define TIMESYNC_SET_BIT | ( | n | ) | (1U << (n)) |
Macro to set bit at given bit position
#define TIMESYNC_GET_BIT | ( | val, | |
n | |||
) | ((val & (1U << n)) >> n) |
Macro to get bit at given bit position
#define TIMESYNC_IS_BIT_SET | ( | val, | |
n | |||
) | (((val) & (1U << (n))) != 0U) |
Macro to check if bit at given bit position is set
#define TIMESYNC_START_OF_IP_HEADER (14) |
Starting offset for an IP header in TCP/IP packet
#define TIMESYNC_START_OF_IP_CHECKSUM (TIMESYNC_START_OF_IP_HEADER + 10U) |
Starting offset for checksum in IP header in TCP/IP packet
#define TIMESYNC_START_OF_IP_LENGTH (TIMESYNC_START_OF_IP_HEADER + 2U) |
Starting offset for length field in IP header in TCP/IP packet
#define TIMESYNC_START_OF_UDP_HEADER (34U) |
Starting offset for UDP header in TCP/IP packet
#define TIMESYNC_START_OF_UDP_CHECKSUM (TIMESYNC_START_OF_UDP_HEADER + 6U) |
Starting offset for checksum field in UDP header in TCP/IP packet
#define TIMESYNC_START_OF_UDP_LENGTH (TIMESYNC_START_OF_UDP_HEADER + 4U) |
Starting offset for length field in UDP header in TCP/IP packet
#define TIMESYNC_START_OF_IP_PROTOCOL (TIMESYNC_START_OF_IP_HEADER + 9U) |
Starting offset for protocol field in IP header in TCP/IP packet
#define TIMESYNC_START_OF_IP_ADDRESS (TIMESYNC_START_OF_IP_HEADER + 12U) |
Starting offset for IP address field in IP header in TCP/IP packet
#define TIMESYNC_DEFAULT_ETH_HEADER_SIZE (14U) |
standard size for Ethernet Header (src MAC + dst MAC + EthType) in 802.3 packet
#define TIMESYNC_DEFAULT_IP_HEADER_SIZE (20U) |
standard size for IP header in TCP/IP packet
#define TIMESYNC_DEFAULT_UDP_HEADER_SIZE (8U) |
standard size for UDP header in TCP/IP packet
#define TIMESYNC_DEFAULT_HEADER_SIZE (42U) |
standard size for UDP + IP header in TCP/IP packet
#define TIMESYNC_START_OF_PAYLOAD (TIMESYNC_START_OF_UDP_HEADER + TIMESYNC_DEFAULT_UDP_HEADER_SIZE) |
Starting offset for payload data in UDP header in TCP/IP packet
#define TIMESYNC_SEC_TO_NS (1000000000U) |
Value of seconds in nanoseconds. Useful for calculations
#define TIMESYNC_MAC_ADDR_LEN (6U) |
Length of MAC address in bytes
#define TIMESYNC_IPV4_ADDR_LEN (4U) |
Length of IPv4 address in bytes
#define TIMESYNC_IPV6_ADDR_LEN (16U) |
Length of IPv4 address in bytes
#define TIMESYNC_COMPARE_MAC | ( | x, | |
y | |||
) | (memcmp((x), (y), 6U) == 0) |
Compare MAC ID's. Uses memcmp internally
typedef void(* TimeSync_txNotifyCb) (void *cbArg, uint8_t portNum, uint8_t frameType, uint16_t seqId) |
Transmit callback function.
[in] | cbArg | Pointer to callback argument |
[in] | portNum | Port number to which frame was transmitted |
[in] | frameType | PTP frame type of transmitted frame |
[in] | seqId | PTP sequence ID of transmitted frame |
typedef void(* TimeSync_rxNotifyCb) (void *cbArg) |
Receive callback function.
[in] | cbArg | Pointer to callback argument |
typedef void(* TimeSync_ppsNotifyCb) (void *cbArg) |
PTP PPS callback function.
[in] | cbArg | Pointer to callback argument |
typedef struct TimeSync_Obj_s* TimeSync_Handle |
TimeSync handle.
TimeSync opaque handle
enum TimeSync_VlanType |
enum TimeSync_FrameType |
PTP frame types.
enum TimeSync_SocType |
enum TimeSync_EthIpVer |
enum TimeSync_StepMode |
TimeSync_Handle TimeSync_open | ( | TimeSync_Config * | timeSyncConfig | ) |
Function to configure low-level network driver.
[in] | timeSyncConfig | Pointer to time sync configuration structure |
int32_t TimeSync_getRxTimestamp | ( | TimeSync_Handle | timeSyncHandle, |
TimeSync_FrameType | rxFrameType, | ||
uint8_t | rxPort, | ||
uint16_t | seqId, | ||
uint32_t * | nanoseconds, | ||
uint64_t * | seconds | ||
) |
Reads and provides timestamp of a received event message.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | rxFrameType | Frame type of received packet |
[in] | rxPort | Port used for receiving packet |
[in] | seqId | Sequence ID of the packet |
[out] | nanoseconds | Pointer to 32 bit nanoseconds field |
[out] | seconds | Pointer to 64 bit(48 used) seconds field |
int32_t TimeSync_getTxTimestamp | ( | TimeSync_Handle | timeSyncHandle, |
TimeSync_FrameType | txFrameType, | ||
uint8_t | txPort, | ||
uint16_t | seqId, | ||
uint32_t * | nanoseconds, | ||
uint64_t * | seconds | ||
) |
Reads and provides timestamp of a transmitted event message.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | txFrameType | Frame type transmitted packet |
[in] | txPort | Port used for transmit |
[in] | seqId | Sequence ID of the packet |
[out] | nanoseconds | Pointer to 32 bit nanoseconds field |
[out] | seconds | Pointer to 64 bit(48 used) seconds field |
int32_t TimeSync_adjTimeSlowComp | ( | TimeSync_Handle | timeSyncHandle, |
int32_t | adjOffset, | ||
uint32_t | syncInterval | ||
) |
Adjusts the clock by the drift value over one Sync interval.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | adjOffset | Filtered offset from master in nanoseconds |
[in] | syncInterval | Sync interval |
int32_t TimeSync_setClockTime | ( | TimeSync_Handle | timeSyncHandle, |
uint32_t | nanoseconds, | ||
uint64_t | seconds | ||
) |
Changes the timer value.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | nanoseconds | 32 bit nanoseconds value |
[in] | seconds | 64 bit seconds value |
void TimeSync_getCurrentTime | ( | TimeSync_Handle | timeSyncHandle, |
uint32_t * | nanoseconds, | ||
uint64_t * | seconds | ||
) |
Returns the current time on device.
Returns the current time in
Nanoseconds : Current nanoseconds as on master. The format is identical to the one followed in PTP frames for origin timestamp.
[in] | timeSyncHandle | Pointer to TimeSync object |
[out] | nanoseconds | Pointer to nanoseconds field |
[out] | seconds | Pointer to seconds field |
int32_t TimeSync_getPtpFrame | ( | TimeSync_Handle | timeSyncHandle, |
uint8_t * | frame, | ||
uint32_t * | size, | ||
uint8_t * | rxPort | ||
) |
Receive the PTP frame from hardware queue.
[in] | timeSyncHandle | Pointer to TimeSync object |
[out] | frame | Pointer to PTP frame buffer |
[out] | size | Size of received frame |
[out] | rxPort | Port number frame was received |
int32_t TimeSync_sendPtpFrame | ( | TimeSync_Handle | timeSyncHandle, |
uint8_t * | frame, | ||
uint32_t | size, | ||
uint8_t | txPort | ||
) |
Transmit the PTP frame to the directed port.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | frame | Pointer to PTP frame buffer |
[in] | size | Size of received frame |
[in] | txPort | Port number to which frame is to be sent |
int32_t TimeSync_isSingleStepSupported | ( | TimeSync_Handle | timeSyncHandle | ) |
Helper function to check if single step mode is supported or not.
[in] | timeSyncHandle | Pointer to TimeSync object |
int32_t TimeSync_getPpsTs | ( | TimeSync_Handle | timeSyncHandle, |
uint32_t * | nanoseconds, | ||
uint64_t * | seconds | ||
) |
Get PPS timestamp value.
Note: In case of ICSS, there are FIFO for PPS timestamps. So, based on consumption rate of timestamps by stack, maximum frequency(or minimum ppsPulseIntervalNs) will have to be fixed.
[in] | timeSyncHandle | Pointer to TimeSync object |
[out] | nanoseconds | Pointer to nanoseconds field |
[out] | seconds | Pointer to seconds field |
void TimeSync_recalibratePps | ( | TimeSync_Handle | timeSyncHandle | ) |
Re-calibrate PPS compare values to align with timer's second increment. This recalibration is required when there is a huge jump in timer's value because of correction/adjustment.
[in] | timeSyncHandle | Pointer to TimeSync object |
int8_t TimeSync_isPortLinkUp | ( | TimeSync_Handle | timeSyncHandle, |
uint8_t | portNum | ||
) |
Time sync port link status helper function.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | portNum | Port number |
void TimeSync_reset | ( | TimeSync_Handle | timeSyncHandle | ) |
Time sync module reset.
[in] | timeSyncHandle | Pointer to TimeSync object |
void TimeSync_close | ( | TimeSync_Handle | timeSyncHandle | ) |
Time sync module close.
[in] | timeSyncHandle | Pointer to TimeSync object |
void TimeSync_updateParentAddress | ( | TimeSync_Handle | timeSyncHandle, |
uint8_t * | parentMac | ||
) |
Write the MAC ID of PTP master to Firmware. BMC Algorithm calls this API.
Below functions are IP-specific. IPs without these features will return without doing anything.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | parentMac | Pointer to MAC ID of master. |
void TimeSync_setRcf | ( | TimeSync_Handle | timeSyncHandle, |
uint32_t | rcfValue | ||
) |
Set rate compensation factor value. This is used to communicate path rate compensation factor value to ICSS firmware, for other devices this function returns without doing anything.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | rcfValue | Rate compensation factor value |
void TimeSync_setPathDelay | ( | TimeSync_Handle | timeSyncHandle, |
uint32_t | pathDelay, | ||
uint8_t | portNum | ||
) |
Set path delay for port. This is used to communicate path delay to ICSS firmware, for other devices this function returns without doing anything.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | pathDelay | Path delay value |
[in] | portNum | Port number |
void TimeSync_writeTsSingleStepSync | ( | TimeSync_Handle | timeSyncHandle, |
uint8_t | portNum | ||
) |
For single step master, computation of Tx seconds and nanoseconds timestamp requires some techniques to avoid a long division in firmware.
[in] | timeSyncHandle | Pointer to TimeSync object |
[in] | portNum | Port number |
void TimeSync_addWord | ( | uint8_t * | src, |
uint32_t | word | ||
) |
Add a word to the packet stream.
src | Pointer to the packet stream |
word | Word which is to be added |
void TimeSync_addHalfWord | ( | volatile uint8_t * | src, |
uint16_t | halfWord | ||
) |
Add a half word to the packet stream.
src | Pointer to the packet stream |
halfWord | 16-bit word which is to be added |
void TimeSync_convEndianess | ( | volatile void * | src, |
volatile void * | dst, | ||
uint8_t | numBytes | ||
) |
Convert specified number of bytes in source from big endian bytes to little endian and vice versa. Assumption :
src | Pointer to source byte stream |
dst | Pointer to destination byte stream |
numBytes | Number of bytes to convert and copy |
uint32_t TimeSync_calcChecksum | ( | uint8_t * | packet, |
uint16_t | len | ||
) |
Compute checksum used in IP/UDP packets for a given stream.
packet | Pointer to the packet stream |
len | Length of stream |
void TimeSync_calcIpChecksum | ( | uint8_t * | packet | ) |
Compute checksum for IP Header and modify in place.
packet | Pointer to the packet stream |
void TimeSync_calcUdpChecksum | ( | uint8_t * | packet | ) |
Compute checksum for UDP Header and modify in place.
packet | Pointer to the packet stream |
void TimeSync_getMacId | ( | uint8_t * | packet, |
uint8_t * | macId | ||
) |
Get the MAC Id from the network stream, convert it to little endian format and return it assumption : MAC is present in big endian byte format and starts from zero offset.
packet | Pointer to byte stream |
macId | Pointer to array of six bytes which contain the MAC Id in little endian format |
void TimeSync_addMacID | ( | uint8_t * | src, |
uint8_t * | macID | ||
) |
Copy MAC ID to a stream.
src | Pointer to stream |
macID | Pointer to MAC ID |
uint32_t TimeSync_convBigEndianToLittleEndianWord | ( | uint8_t * | byte | ) |
Get a word from the network stream, convert it to little endian format and return it assumption word is present in big endian byte format and starts from zero offset.
byte | Pointer to byte stream |
uint16_t TimeSync_convBigEndianToLittleEndianHalfWord | ( | uint8_t * | byte | ) |
get a halfword from the network stream, convert it to little endian format and return it assumption halfword is present in big endian byte format and starts from zero offset
byte | Pointer to byte stream |
void TimeSync_convEnd6to8 | ( | volatile void * | src, |
void * | dst | ||
) |
Takes in a 6 byte reverse byte endian source and puts it in an 64 bit double word with correct endianness. This function is specific to PTP Assumption :
src | Pointer to source byte stream |
dst | Pointer to destination byte stream |