Open-AVB AVTP Pipeline SDK  1.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Typedefs | Functions
openavb_avtp_time_pub.h File Reference

AVTP Time public interface. More...

#include "openavb_platform_pub.h"
#include "openavb_types_pub.h"

Go to the source code of this file.

Data Structures

struct  avtp_time_t
 AVTP time structure. More...
 

Typedefs

typedef struct timespec timespec_t
 standard timespec type.
 

Functions

avtp_time_topenavbAvtpTimeCreate (U32 maxLatencyUsec)
 Create a avtp_time_t structure. More...
 
void openavbAvtpTimeDelete (avtp_time_t *pAvtpTime)
 Delete the time struct. More...
 
void openavbAvtpTimeSetToWallTime (avtp_time_t *pAvtpTime)
 Set to wall time (gPTP time). More...
 
void openavbAvtpTimeSetToSystemTime (avtp_time_t *pAvtpTime)
 Set to system time. More...
 
void openavbAvtpTimeSetToTimestamp (avtp_time_t *pAvtpTime, U32 timestamp)
 Set to timestamp. More...
 
void openavbAvtpTimeSetToTimespec (avtp_time_t *pAvtpTime, timespec_t *timestamp)
 Set to timestamp. More...
 
void openavbAvtpTimePushMCR (avtp_time_t *pAvtpTime, U32 timestamp)
 Push a timestamp, for use in Media Clock Recovery (MCR). More...
 
void openavbAvtpTimeSetTimestampValid (avtp_time_t *pAvtpTime, bool validFlag)
 Set the AVTP timestamp valid indicator. More...
 
void openavbAvtpTimeSetTimestampUncertain (avtp_time_t *pAvtpTime, bool uncertainFlag)
 Set the AVTP timestamp uncertain indicator. More...
 
void openavbAvtpTimeAddUSec (avtp_time_t *pAvtpTime, long uSec)
 Add microseconds to the time. More...
 
void openavbAvtpTimeAddNSec (avtp_time_t *pAvtpTime, long nSec)
 Add nanoseconds to the time. More...
 
void openavbAvtpTimeSubUSec (avtp_time_t *pAvtpTime, long uSec)
 Subtract microseconds from the time. More...
 
void openavbAvtpTimeSubNSec (avtp_time_t *pAvtpTime, long nSec)
 Subtract nanoseconds from the time. More...
 
U32 openavbAvtpTimeGetAvtpTimestamp (avtp_time_t *pAvtpTime)
 Get AVTP timestamp. More...
 
U64 openavbAvtpTimeGetAvtpTimeNS (avtp_time_t *pAvtpTime)
 Get AVTP timestamp in nanoseconds. More...
 
bool openavbAvtpTimeTimestampIsValid (avtp_time_t *pAvtpTime)
 Get the AVTP timestamp valid indicator. More...
 
bool openavbAvtpTimeTimestampIsUncertain (avtp_time_t *pAvtpTime)
 Get the AVTP timestamp uncertain indicator. More...
 
bool openavbAvtpTimeIsPast (avtp_time_t *pAvtpTime)
 Check if time is in the past. More...
 
bool openavbAvtpTimeIsPastTime (avtp_time_t *pAvtpTime, U64 nSecTime)
 Check if time is in the past a specific time (PTP time) More...
 
bool openavbAvtpTimeUsecTill (avtp_time_t *pAvtpTime, U32 *pUsecTill)
 Determines microseconds until PTP time. More...
 
S32 openavbAvtpTimeUsecDelta (avtp_time_t *pAvtpTime)
 Returns delta from timestamp and now. More...
 

Detailed Description

AVTP Time public interface.

Function Documentation

avtp_time_t* openavbAvtpTimeCreate ( U32  maxLatencyUsec)

Create a avtp_time_t structure.

Allocate storage for a avtp_time_t structure. When a media queue items are created an avtp_time_t structure is allocated for each item. Interface modules do not need to be concerned with doing this.

Parameters
maxLatencyUsecMaximum Latency (in usec) for the avtp_time_t structure. Timestamps greater than now + maximum latency are considered uncertain.
Returns
A pointer to the avtp_time_t structure. Returns NULL if the memory could not be allocated.
void openavbAvtpTimeDelete ( avtp_time_t pAvtpTime)

Delete the time struct.

Delete the avtp_time_t structure and any additional allocations it owns.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
void openavbAvtpTimeSetToWallTime ( avtp_time_t pAvtpTime)

Set to wall time (gPTP time).

Set the time in the avtp_time_t structure to that of the synchronized PTP time. An interface module will normally use this function to set the time that media data was placed into the media queue.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Examples:
openavb_intf_echo.c.
void openavbAvtpTimeSetToSystemTime ( avtp_time_t pAvtpTime)

Set to system time.

Set the time in the avtp_time_t structure to that of the system time on the device.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
void openavbAvtpTimeSetToTimestamp ( avtp_time_t pAvtpTime,
U32  timestamp 
)

Set to timestamp.

Set the time in the avtp_time_t structure to the value of the timestamp parameter which is in the same format as an AVTP timestamp.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
timestampA timestamp in the same format as the 1722 AVTP timestamp.
void openavbAvtpTimeSetToTimespec ( avtp_time_t pAvtpTime,
timespec_t timestamp 
)

Set to timestamp.

Set the time in the avtp_time_t structure to the value of timespec_t *timestamp.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
timestampA timestamp in the timespec_t format.
void openavbAvtpTimePushMCR ( avtp_time_t pAvtpTime,
U32  timestamp 
)

Push a timestamp, for use in Media Clock Recovery (MCR).

Note
Not available in all platforms.

Push a timestamp, for use in Media Clock Recover (MCR). *pAvtpTime is not modified.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
timestampA timestamp in the same format as the 1722 AVTP timestamp.
void openavbAvtpTimeSetTimestampValid ( avtp_time_t pAvtpTime,
bool  validFlag 
)

Set the AVTP timestamp valid indicator.

Sets the indicator for AVTP timestamp is valid or not.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
validFlagFlag indicating is timestamp is valid.
void openavbAvtpTimeSetTimestampUncertain ( avtp_time_t pAvtpTime,
bool  uncertainFlag 
)

Set the AVTP timestamp uncertain indicator.

Sets the indicator for AVTP timestamp is uncertain or not.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
uncertainFlagFlag indicating is timestamp is uncertain.
void openavbAvtpTimeAddUSec ( avtp_time_t pAvtpTime,
long  uSec 
)

Add microseconds to the time.

Add the number of microseconds passed in to the time stored in avtp_time_t.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
uSecNumber of microseconds to add to the stored time.
void openavbAvtpTimeAddNSec ( avtp_time_t pAvtpTime,
long  nSec 
)

Add nanoseconds to the time.

Add the number of nanoseconds passed in to the time stored in avtp_time_t.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
nSecNumber of nanoseconds to add to the stored time.
void openavbAvtpTimeSubUSec ( avtp_time_t pAvtpTime,
long  uSec 
)

Subtract microseconds from the time.

Subtract the number of microseconds passed in from the time stored in avtp_time_t.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
uSecNumber of microseconds to subtract from the stored time.
void openavbAvtpTimeSubNSec ( avtp_time_t pAvtpTime,
long  nSec 
)

Subtract nanoseconds from the time.

Subtract the number of nanoseconds passed in from the time stored in avtp_time_t.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
nSecNumber of nanoseconds to subtract from the stored time.
U32 openavbAvtpTimeGetAvtpTimestamp ( avtp_time_t pAvtpTime)

Get AVTP timestamp.

Get the time stored in avtp_time_t and return it in an AVTP timestamp format

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Returns
Returns an integer (U32) in the same format as a 1722 AVTP Timestamp.
U64 openavbAvtpTimeGetAvtpTimeNS ( avtp_time_t pAvtpTime)

Get AVTP timestamp in nanoseconds.

Get the time stored in avtp_time_t and return it as a full time value in nanoseconds

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Returns
Returns an integer (U64) of the full walltime in nanoseconds.
bool openavbAvtpTimeTimestampIsValid ( avtp_time_t pAvtpTime)

Get the AVTP timestamp valid indicator.

Gets the indicator for AVTP timestamp is valid or not.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Returns
Returns TRUE if the AVTP timestamp valid indicator is set otherwise FALSE.
bool openavbAvtpTimeTimestampIsUncertain ( avtp_time_t pAvtpTime)

Get the AVTP timestamp uncertain indicator.

Gets the indicator for AVTP timestamp is uncertain or not.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Returns
Returns TRUE if the AVTP timestamp uncertain indicator is set otherwise FALSE.
bool openavbAvtpTimeIsPast ( avtp_time_t pAvtpTime)

Check if time is in the past.

Checks if the time stored in avtp_time_t is past the PTP wall time.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Returns
Returns TRUE if time is in the past otherwise FALSE.
bool openavbAvtpTimeIsPastTime ( avtp_time_t pAvtpTime,
U64  nSecTime 
)

Check if time is in the past a specific time (PTP time)

Checks if the time stored in avtp_time_t is past the time passed in.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
nSecTimeTime in nanoseconds to compare against.
Returns
Returns TRUE if time is in the past otherwise FALSE.
bool openavbAvtpTimeUsecTill ( avtp_time_t pAvtpTime,
U32 pUsecTill 
)

Determines microseconds until PTP time.

Returns the number of microseconds until the time stored in avtp_time_t reaches the PTP time.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
pUsecTillAn output parameter that is set with the number of microseconds until the time is reached.
Returns
Return FALSE if greater than 5 second otherwise TRUE.
S32 openavbAvtpTimeUsecDelta ( avtp_time_t pAvtpTime)

Returns delta from timestamp and now.

Returns difference between timestamp and current time.

Parameters
pAvtpTimeA pointer to the avtp_time_t structure.
Returns
Difference in microseconds between timestamp and now.