User Tools

Site Tools


timers

This is an old revision of the document!


Table of Contents

Timers

The gamepad has the following timer registers: (TODO word better)

Address Desc.
0xF0000400 ??
0xF0000404 xx
0xF0000408 Count-up timer
0xF0000410 Timer 0 control
0xF0000414 Timer 0 counter
0xF0000418 Timer 0 target
0xF0000420 Timer 1 control
0xF0000424 Timer 1 counter
0xF0000428 Timer 1 target

TODO: measure the rate at which the timers tick. It is dependent on the system clock settings, which are still not understood.

Timer 0/1 count 8126 ticks per video frame. That is, 487560Hz.

They count ~1237 ticks per frame at the default (slow) clock settings. That is, 74220Hz.

Count-up timer

This is a simple timer that is always counting up. When writing a value to 0xF0000408, it will begin counting from the new value.

It counts at twice the speed of timers 0/1.

Timer 0

0xF0000410

Timer control.

Bits Desc.
0 ??
1 Timer enable
4-6 Prescaler

Bit0 is possibly used by firmware code but has no observable effect.

Writing 0 to bit1 resets the timer to 0.

The prescaler value has the following possible settings:

Value Frequency
0 Normal
1 Divide by 2
2 Divide by 4
3 Divide by 8
4 Divide by 16
5 Divide by 32
6 Divide by 64
7 Divide by 128

0xF0000414

Counter. Can be written to, the timer will count from the new value.

When the timer goes past the target, the timer is reloaded to 0 and IRQ 0x00 is triggered.

Writing a new value greater than the target does not cause a reload.

0xF0000418

Target.

Before a reload, the last value the timer takes is equal to the target.

Timer 1

Function identical to timer 0, except it triggers IRQ 0x01.

timers.1727115723.txt.gz · Last modified: 2024/09/23 18:22 by arisotura

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki