AM64x MCU+ SDK  08.02.00
icss_timeSync_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef ICSS_TIMESYNC_UTILS_H_
34 #define ICSS_TIMESYNC_UTILS_H_
35 
36 /* ========================================================================== */
37 /* Include Files */
38 /* ========================================================================== */
39 #include <stdint.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /* ========================================================================== */
46 /* Macros & Typedefs */
47 /* ========================================================================== */
48 
49 
50 
51 /* ========================================================================== */
52 /* Function Declarations */
53 /* ========================================================================== */
54 
65 void TimeSync_addWord(uint8_t *src, uint32_t word);
66 
72 void TimeSync_addHalfWord(volatile uint8_t *src, uint16_t halfWord);
73 
80 uint32_t TimeSync_calcChecksum(uint8_t *packet, uint16_t len);
81 
86 void TimeSync_calcIPChecksum(uint8_t *packet);
87 
99 void TimeSync_convEndianess(volatile void *src, volatile void *dst, uint8_t numBytes);
100 
110 void TimeSync_convEnd6to8(volatile void *src, void *dst);
111 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif /* #ifndef ICSS_TIMESYNC_UTILS_H_ */
TimeSync_addHalfWord
void TimeSync_addHalfWord(volatile uint8_t *src, uint16_t halfWord)
Add a half word to the packet stream.
TimeSync_convEndianess
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....
TimeSync_addWord
void TimeSync_addWord(uint8_t *src, uint32_t word)
Add a word to the packet stream.
TimeSync_convEnd6to8
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 endian...
TimeSync_calcIPChecksum
void TimeSync_calcIPChecksum(uint8_t *packet)
Compute checksum for IP Header and modify in place.
TimeSync_calcChecksum
uint32_t TimeSync_calcChecksum(uint8_t *packet, uint16_t len)
Compute checksum used in IP/UDP packets for a given stream.