Get real-time interrupt count and hardware TIMER2 up count.

void RTX_GetFineTick (RTX_FINE_TICK *report);



Output parameter, pointer to a RTX_FINE_TICK structure which will receive the timing information.   This structure consists of a 32 bit Rti_Count union allowing WORD wise access to the 32 bit Real-Time Interrupt count, followed by a 16 bit TIMER2 reading.   See type definition below in comments.

Return Value

-- none --


This procedure's main purpose in life is to support the more user friendly RTX_GetTick_us API.   However some real-time appplications may be interested in using this function directly to avoid the additional computation overhead added by the conversion to microseconds of the data collected here.   For example if an Interrupt Service Routine (ISR) needs to know precisely what time it is then it might be a wiser design decision to buffer the raw data collected by this API for later off-line processing rather than hanging around waiting for a conversion to microseconds within the ISR.   (On the other hand, the conversion to microseconds has a data reduction aspect to it.)

If the RTX_FineTickInit API has not yet been called, then this call will be made one time to obtain the _pRti_Tick internal data pointer that is required here.   (This initialization function is also called if the low power mode of operation has been changed.)   Making this additional API call is time consuming (slightly) and results in the interrupts being enabled.   Therefore calling RTX_FineTickInit prior to using this API may be advisable.

Once this initialization has been handled, this API is well suited for real-time applications.   It becomes both re-entrant and respects the interrupt masking applied by the caller.   Consequently calling this API from inside hardware interrupts is no problem.   These interrupt service routines do not need to be registered with the RTX.   No further calls into the @Chip-RTOS are necessary since both the @Chip-RTOS 32 bit RTI up counter (via the pointer) and the TIMER2 hardware count are sampled here directly.

The _RTI_kHz global constant can be inspected to determine the RTI rate in effect (always 1 for SC1x systems).

The data returned by this API is output to the following structure type.

typedef struct {
    union {
        unsigned long   Full ;      // 32 bit RTI counter
        struct {
            unsigned int Lsh ;      // Least Significant Half
            unsigned int Msh ;      // Most Significant Half
        } Part ;
    } Rti_Count ;

    unsigned int    Timer2_Count ;


See Also


After RTX_FineTickInit has been invoked a single time, this library function makes no entry into the RTOS.

Related Topics

RTX API   Overview

Supported since or modified in @CHIP-RTOS version


Supported by @CHIP-RTOS C Library since version


This API List
List of C Libraries
@CHIP-RTOS Main Index

End of document