Jump to main content

# 1.1.2.4.7 DRV_G3_MACRT_GetTimerReference Function

## C

    uint32_t DRV_G3_MACRT_GetTimerReference (
        const DRV_HANDLE handle
    );

## Summary

Gets the internal timer reference from PLC transceiver, in microseconds.

## Description

PLC transceiver has an internal 32-bit counter which is used as internal time reference for all time calculations in PHY and MAC-RT layers. This counter is internally configured to be increased each microsecond. This function allows to use this counter as an accurate time reference for upper layers.

## Precondition

DRV_G3_MACRT_Open must have been called to obtain a valid opened device handle.

## Parameters

Param | Description
--- | ---
handle | A valid instance handle, returned from the driver's open routine.

## Returns

Internal timer reference from PLC transceiver in microseconds.

## Example

    // 'handle', returned from DRV_G3_MACRT_Open previously called

    uint32_t macRtTimerRef;

    macRtTimerRef = DRV_G3_MACRT_GetTimerReference(handle);

## Remarks

This function requires an SPI transaction to retrieve time from PLC transceiver, so potential jitter in different SPI accesses may impact accuracy.

Rev: G