Title: The RealTek timer-count
1The RealTek timer-count
- A look at how we could utilize the timekeeping
capabilities of our RealTek 8139 network
controller
2The Timer Count Register
32-bits
TCTR
0x48-0x4B
How it works This register may be read at
any time. Its value steadily increments, at
a fixed frequency. If any value is written,
the register is reset to zero.
3The Timer Interrupt Register
32-bits
TimerInt
0x54-0x57
How it works This register may be read or
written at any time. Its value is
initialized to zero by a reset command. So
long as its zero, no timer-interrupt is
generated. If any nonzero value is written,
the timeout flag in the Interrupt Status
register will be set as soon as the TCTR
becomes equal to this TimerInt amount.
4Registers IMR and ISR
16-bits
Interrupt Mask Register (read/write) (Bit
1enabled, 0masked)
T i m e O u t
0x3C-0x3D
14
16-bits
Interrupt Status Register (read/only) (bit
1active, 0inactive)
T i m e O u t
0x3E-0x3F
14
Writing 1 to an active bit in IntStatus clears
the active condition
5In-Class Exercise
- Use our nictimer.c device-driver, and also our
2seconds.cpp program (plus your knowledge of
arithmetic), to determine how rapidly the nics
Timer Count Register will be incrementing - Compute the expiration-value you should write to
the TimerInt register in order that a task will
be awakened by a timer-interrupt after enough
time has elapsed for a maximum-size packet to be
transmitted