RtndReadClock

RtndReadClock reads a NIC clock time and CPU time simultaneously (cross-timestamp) and returns all timestamps.

Syntax

Copy
BOOL RtndReadClock(
    [in]    ULONG_PTR RtndInterfaceId, 
    [in]    ULONG LocalClockIndex, 
    [out]   RTND_READ_CLOCK_RESULT *pResult, 
    [in]    ULONG ResultStructSize, 
    [in]    ULONG RequestFlags
);

Parameters

[in] RtndInterfaceId

The number or pointer used to identify the interface. This value is returned by RtndManageInterface.

[in] LocalClockIndex

The index of the local clock to access.

[out] pResult

A pointer to a RTND_READ_CLOCK_RESULT structure containing the collection of timestamps retrieved during the cross-timestamp operation.

[in] ResultStructSize

The size of the structure pointed to by pResult.

[in] RequestFlags

A bitwise OR of flags:

Flag

Description

RTND_READ_CLOCK_RESULT_FLAG_PTM

When set, the driver must first try to perform the cross-timestamp operation in hardware, using PTM (Precision Time Measurement). If that fails, it must use the software method.

When this flag is not set, the driver must use the software method directly.

Return Value

If the function succeeds, it returns TRUE. If the function fails, it returns FALSE. To get extended error information, call GetLastError.

Common error codes:

Error code Meaning

ERROR_IO_DEVICE

An unexpected error occurred while trying to access the device.

Note: Custom drivers may return other error codes not listed above.

Remarks

The NL2 always calls this function from the main thread of the NL2 process.

The NL2 always uses sizeof() to get the real size of its RTND_READ_CLOCK_RESULT structure at compilation time and will memset this structure to 0 before calling this function. In return, the driver MUST comply with the requirements for backward and forward compatibility.

If the driver used the PTM method, it MUST set the RTND_READ_CLOCK_RESULT_FLAG_PTM flag in the RTND_READ_CLOCK_RESULT.Flags field and it MUST store the PTM Master time, in nanoseconds, in the RTND_READ_CLOCK_RESULT.PtmMasterTimeNs field.

If the driver used the software method, it MUST clear the RTND_READ_CLOCK_RESULT_FLAG_PTM flag in the RTND_READ_CLOCK_RESULT.Flags field and it MUST store the values of QPC prior and after reading the NIC time in the RTND_READ_CLOCK_RESULT.QpcPrior and RTND_READ_CLOCK_RESULT.QpcAfter fields.

Characteristics

Real-time requirements

Deterministic behavior

Not required

Shutdown-safe behavior

Required

Local memory allocation/deallocation restrictions

Process

External MSpace

Internal MSpace

System

Not allowed

Not allowed

RTSS process

Not allowed

Not allowed

Windows contiguous memory allocation/deallocation restrictions

Contiguous memory

Not allowed

Requirements

Minimum supported version Header

wRTOS 1.0 SDK

Rtnd.h

See Also: