Open-AVB AVTP Pipeline SDK  1.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
openavb_avtp_time_pub.h
Go to the documentation of this file.
1 /*************************************************************************************************************
2 Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS LISTED BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 Attributions: The inih library portion of the source code is licensed from
26 Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
27 Complete license and copyright information can be found at
28 https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
29 *************************************************************************************************************/
30 
31 /*
32 * HEADER SUMMARY : AVTP Time public interface
33 */
34 
35 #ifndef OPENAVB_AVTP_TIME_PUB_H
36 #define OPENAVB_AVTP_TIME_PUB_H 1
37 
38 #include "openavb_platform_pub.h"
39 #include "openavb_types_pub.h"
40 
45 typedef struct timespec timespec_t;
47 
50 typedef struct {
53 
56 
59 
62 } avtp_time_t;
63 
64 
77 avtp_time_t * openavbAvtpTimeCreate(U32 maxLatencyUsec);
78 
85 void openavbAvtpTimeDelete(avtp_time_t *pAvtpTime);
86 
96 
105 
114 void openavbAvtpTimeSetToTimestamp(avtp_time_t *pAvtpTime, U32 timestamp);
115 
124 void openavbAvtpTimeSetToTimespec(avtp_time_t *pAvtpTime, timespec_t* timestamp);
125 
135 void openavbAvtpTimePushMCR(avtp_time_t *pAvtpTime, U32 timestamp);
136 
144 void openavbAvtpTimeSetTimestampValid(avtp_time_t *pAvtpTime, bool validFlag);
145 
153 void openavbAvtpTimeSetTimestampUncertain(avtp_time_t *pAvtpTime, bool uncertainFlag);
154 
162 void openavbAvtpTimeAddUSec(avtp_time_t *pAvtpTime, long uSec);
163 
171 void openavbAvtpTimeAddNSec(avtp_time_t *pAvtpTime, long nSec);
172 
182 void openavbAvtpTimeSubUSec(avtp_time_t *pAvtpTime, long uSec);
183 
193 void openavbAvtpTimeSubNSec(avtp_time_t *pAvtpTime, long nSec);
194 
203 
213 
223 
233 
241 bool openavbAvtpTimeIsPast(avtp_time_t *pAvtpTime);
242 
252 bool openavbAvtpTimeIsPastTime(avtp_time_t *pAvtpTime, U64 nSecTime);
253 
264 bool openavbAvtpTimeUsecTill(avtp_time_t *pAvtpTime, U32 *pUsecTill);
265 
274 
275 #endif // OPENAVB_AVTP_TIME_PUB_H
AVTP time structure.
Definition: openavb_avtp_time_pub.h:50
void openavbAvtpTimeSetTimestampUncertain(avtp_time_t *pAvtpTime, bool uncertainFlag)
Set the AVTP timestamp uncertain indicator.
bool openavbAvtpTimeIsPastTime(avtp_time_t *pAvtpTime, U64 nSecTime)
Check if time is in the past a specific time (PTP time)
void openavbAvtpTimeAddUSec(avtp_time_t *pAvtpTime, long uSec)
Add microseconds to the time.
void openavbAvtpTimeSetToWallTime(avtp_time_t *pAvtpTime)
Set to wall time (gPTP time).
bool openavbAvtpTimeIsPast(avtp_time_t *pAvtpTime)
Check if time is in the past.
U64 openavbAvtpTimeGetAvtpTimeNS(avtp_time_t *pAvtpTime)
Get AVTP timestamp in nanoseconds.
void openavbAvtpTimeSetToTimestamp(avtp_time_t *pAvtpTime, U32 timestamp)
Set to timestamp.
bool openavbAvtpTimeTimestampIsValid(avtp_time_t *pAvtpTime)
Get the AVTP timestamp valid indicator.
U32 openavbAvtpTimeGetAvtpTimestamp(avtp_time_t *pAvtpTime)
Get AVTP timestamp.
void openavbAvtpTimeDelete(avtp_time_t *pAvtpTime)
Delete the time struct.
void openavbAvtpTimeAddNSec(avtp_time_t *pAvtpTime, long nSec)
Add nanoseconds to the time.
void openavbAvtpTimeSetToTimespec(avtp_time_t *pAvtpTime, timespec_t *timestamp)
Set to timestamp.
void openavbAvtpTimeSetTimestampValid(avtp_time_t *pAvtpTime, bool validFlag)
Set the AVTP timestamp valid indicator.
void openavbAvtpTimeSubNSec(avtp_time_t *pAvtpTime, long nSec)
Subtract nanoseconds from the time.
avtp_time_t * openavbAvtpTimeCreate(U32 maxLatencyUsec)
Create a avtp_time_t structure.
uint32_t U32
Unsigned 32 bit type.
Definition: openavb_types_base_pub.h:85
S32 openavbAvtpTimeUsecDelta(avtp_time_t *pAvtpTime)
Returns delta from timestamp and now.
uint64_t U64
Unsigned 64 bit type.
Definition: openavb_types_base_pub.h:89
struct timespec timespec_t
standard timespec type.
Definition: openavb_avtp_time_pub.h:46
bool openavbAvtpTimeTimestampIsUncertain(avtp_time_t *pAvtpTime)
Get the AVTP timestamp uncertain indicator.
int32_t S32
Signed 32 bit type.
Definition: openavb_types_base_pub.h:83
void openavbAvtpTimeSubUSec(avtp_time_t *pAvtpTime, long uSec)
Subtract microseconds from the time.
bool bTimestampValid
Timestamp valid.
Definition: openavb_avtp_time_pub.h:58
bool bTimestampUncertain
Timestamp uncertain.
Definition: openavb_avtp_time_pub.h:61
void openavbAvtpTimePushMCR(avtp_time_t *pAvtpTime, U32 timestamp)
Push a timestamp, for use in Media Clock Recovery (MCR).
bool openavbAvtpTimeUsecTill(avtp_time_t *pAvtpTime, U32 *pUsecTill)
Determines microseconds until PTP time.
U64 timeNsec
Time in nanoseconds.
Definition: openavb_avtp_time_pub.h:52
U64 maxLatencyNsec
Maximum latency. Timestamps greater than now + max latency will be considered uncertain.
Definition: openavb_avtp_time_pub.h:55
void openavbAvtpTimeSetToSystemTime(avtp_time_t *pAvtpTime)
Set to system time.