0

我想知道是否有可能获得用于 TickCounter 中断的计数器的值。

目的:

我想知道当前的 Tick 和这个寄存器的值。

这样我就可以评估了。

例如,

滴答声是 12,寄存器是 1526。所以我可以实现一个虚拟时钟,它使用滴答计数器(基数 1ms)和寄存器,这样我就有一个更精确的时钟。

编辑:

我找到了这个实现

> #ifndef CERT /*******************************************************************************
> *
> * tickGet - get the value of the kernel's tick counter
> *
> * This routine returns the current value of the tick counter.
> * This value is set to zero at startup, incremented by tickAnnounce(),
> * and can be changed using tickSet().
> *
> * RETURNS: The most recent tickSet() value, plus all tickAnnounce() calls since.
> *
> * SEE ALSO: tickSet(), tickAnnounce()
> * 
> * INTERNAL
> * There should be no need to lock interrupts on this one; the compiler should
> * only generate a read from one half of the UINT64 which means that the read
> * can never be interrupted.
> */
> 
> ULONG tickGet (void)
>     {
>     return (ULONG) (vxAbsTicks & 0xFFFFFFFFull);
>     }
> #endif /* !CERT */

但我无法访问该vxAbsTicks

4

1 回答 1

1

简单而正确的答案是只调用tickGet()。

于 2012-12-20T12:04:48.350 回答