RtSetHalTimerPeriodCounts
RtSetHalTimerPeriodCounts sets the APIC counts per eRTOS HAL timer period.
Syntax
bool RtSetHalTimerPeriodCounts(
ULONG PeriodicCounts
);
Parameters
PeriodicCounts
Specifies a new value for the APIC counts per eRTOS HAL timer period.
Return Value
If the function succeeds, it returns true. Otherwise, it returns false. Call GetLastError for additional error information.
Remarks
RtSetHalTimerPeriodCounts allows you to set a new value for the APIC counts per HAL timer period, therefore adjusting the reference frequency of the APIC timer. The HAL timer is used for all other timers or clock-related functions. Adjusting the HAL timer period count will affect the entire system, not just the calling application.
To adjust time, call RtGetHalTimerPeriodCounts to obtain the current APIC counts and the base APIC counts. To adjust time to run slower, increase the APIC counts and call RtSetHalTimerPeriodCounts to set on APIC timer. To adjust time to run faster, decrease the APIC counts and call RtSetHalTimerPeriodCounts to set on APIC timer. The new count can either be calculated by multiplying or dividing a percentage of the current APIC counts, or by incrementing/decrementing certain counts on the current APIC counts.
To avoid significant side effects on timers and timing-relative RTAPIs (processed by HAL ticks), the adjustment of the APIC counts should not be less than 90% or greater than 110% of the base APIC counts. Otherwise, RtSetHalTimerPeriodCounts returns FALSE and GetLastError returns ERROR_INVALID_PARAMETER.
Function | Process Behavior Change | Notes |
---|---|---|
RtGetClockTime | Shifted | The returning time is based on HAL ticks. |
Shifted | The expiration and interval of timers created by users are based on HAL ticks. | |
Shifted | The sleeping duration is based on HAL ticks | |
Shifted | The waiting timeout is based on HAL ticks. | |
RtSetThreadTimeQuantum / RtSetThreadTimeQuantumEx | Shifted | The time quantum is based on HAL ticks. |
RtSetFlushTLBTickMod | Shifted | The mod value is based on HAL ticks. |
RtGetThreadTimes | No Change | The times are based on system time. |
No Change | The times are based on TSC. |
Below is a matrix of the eRTOS program samples that are impacted by adjusting APIC Counts per HAL Timer Period:
Sample | Impact |
---|---|
srtm.ertos | The number of expiration ticks and latency results are valid. |
srtm.exe | The results are invalid because of inconsistency between expiration tick interval and RtGetClockTime. |
Requirements
Minimum supported version | Header | Library |
---|---|---|
eRTOS 1.0 SDK |
Rtapi.h | rtkrnl.lib |
See Also: