RtndSetClockRate

RtndSetClockRate sets the rate of a NIC clock.

Syntax

Copy
BOOL RtndSetClockRate(
    [in]    ULONG_PTR RtndInterfaceId, 
    [in]    ULONG LocalClockIndex, 
    [in]    LONG RequestedScaledOffsetPpm, 
    [out]   LONG *pActualScaledOffsetPpm
);

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.

[in] RequestedScaledOffsetPpm

The new rate to apply, in ppm, relative to the nominal rate (can be positive or negative).

[out] pActualScaledOffsetPpm

The applied rate, in ppm, relative to the nominal rate (can be positive or negative).

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 RequestedScaledOffsetPpm parameter is in Q16.16 fixed point representation. For example, +1.5ppm is represented as 0x00018000 (1.5 * 2^16 = 98304 = 0x00018000) while -1.5ppm is represented as 0xFFFE8000 (-1.5 * 2^16 = -98304 = 0xFFFE8000).

The NL2 guarantees that it will never pass a value of RequestedScaledOffsetPpm outside of the range of allowed values provided by the driver in RTND_FEATURE_CLOCK.ClockRateScaledOffsetPpmMax and RTND_FEATURE_CLOCK.ClockRateScaledOffsetPpmMin.

If necessary, the driver can adjust the passed value slightly to ensure it matches the granularity accepted by the hardware.

The function immediately reads the actual applied rate and returns it in the pActualScaledOffsetPpm parameter, which is also in Q16.16 fixed point representation.

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: