TIMER0
Timer
Provides a generic Timer core.
The Timer is implemented as a countdown timer that can be used in various modes:
Polling : Returns current countdown value to software
One-Shot: Loads itself and stops when value reaches
0Periodic: (Re-)Loads itself when value reaches
0
en register allows the user to enable/disable the Timer. When the Timer is enabled, it is
automatically loaded with the value of load register.
When the Timer reaches 0, it is automatically reloaded with value of reload register.
The user can latch the current countdown value by writing to update_value register, it will
update value register with current countdown value.
To use the Timer in One-Shot mode, the user needs to:
Disable the timer
Set the
loadregister to the expected duration(Re-)Enable the Timer
To use the Timer in Periodic mode, the user needs to:
Disable the Timer
Set the
loadregister to 0Set the
reloadregister to the expected periodEnable the Timer
For both modes, the CPU can be advertised by an IRQ that the duration/period has elapsed. (The
CPU can also do software polling with update_value and value to know the elapsed duration)
Register Listing for TIMER0
Register |
Address |
|---|---|
TIMER0_LOAD |
0xf000e000 |
TIMER0_RELOAD |
0xf000e004 |
TIMER0_EN |
0xf000e008 |
TIMER0_UPDATE_VALUE |
0xf000e00c |
TIMER0_VALUE |
0xf000e010 |
TIMER0_EV_STATUS |
0xf000e014 |
TIMER0_EV_PENDING |
0xf000e018 |
TIMER0_EV_ENABLE |
0xf000e01c |
TIMER0_LOAD
Address: 0xf000e000 + 0x0 = 0xf000e000
Load value when Timer is (re-)enabled. In One-Shot mode, the value written to this register specifies the Timer’s duration in clock cycles.
TIMER0_RELOAD
Address: 0xf000e000 + 0x4 = 0xf000e004
Reload value when Timer reaches
0. In Periodic mode, the value written to this register specify the Timer’s period in clock cycles.
TIMER0_EN
Address: 0xf000e000 + 0x8 = 0xf000e008
Enable flag of the Timer. Set this flag to
1to enable/start the Timer. Set to0to disable the Timer.
TIMER0_UPDATE_VALUE
Address: 0xf000e000 + 0xc = 0xf000e00c
Update trigger for the current countdown value. A write to this register latches the current countdown value to
valueregister.
TIMER0_VALUE
Address: 0xf000e000 + 0x10 = 0xf000e010
Latched countdown value. This value is updated by writing to
update_value.
TIMER0_EV_STATUS
Address: 0xf000e000 + 0x14 = 0xf000e014
This register contains the current raw level of the zero event trigger. Writes to this register have no effect.
Field |
Name |
Description |
|---|---|---|
[0] |
ZERO |
Level of the |
TIMER0_EV_PENDING
Address: 0xf000e000 + 0x18 = 0xf000e018
When a zero event occurs, the corresponding bit will be set in this register. To clear the Event, set the corresponding bit in this register.
Field |
Name |
Description |
|---|---|---|
[0] |
ZERO |
1 if a zero event occurred. This Event is triggered on rising edge. |
TIMER0_EV_ENABLE
Address: 0xf000e000 + 0x1c = 0xf000e01c
This register enables the corresponding zero events. Write a
0to this register to disable individual events.
Field |
Name |
Description |
|---|---|---|
[0] |
ZERO |
Write a |