Hey guys, I was perusing the KOS codebase the other day, digging into some Timer stuff when I saw a comment stating "WDT is not supported," which I thought was kind of bullshit... So I wrote a driver for it which just got merged into KOS. I also included an example as well.
https://github.com/KallistiOS/KallistiO ... 918eb428fd.
Only 2 of the 4 supported modes are relevant to us: The watchdog and interval timer modes.
Watchdog mode basically works the same way a standard watchdog timer works, where a reset signal is sent after a counter overflow. My API lets you configure which reset interrupt is generated (MANUAL, POWER_ON), plus the clock divider for setting the counter frequency... The only problem is that even with the largest divider, the thing still runs so fast that a reset is generated about every 5ms, making it still unsuited for a gamedev frame-based WDT... It's just so damn speedy!
What IS particularly useful is the interval timer mode, which lets you use the WDT basically as an extra generic timer with up to 41us resolution. My API lets you configure the timeout interval in microseconds and then invokes your callback as soon as the interval has elapsed, within 41us of the requested timeout period.
Since KOS already reserves two of the general-purpose TMU peripherals for housekeeping, I'm hoping the WDT can be useful to some people as another general-purpose timer.
NOTE: I have spoken with many emulator authors and NOBODY has bothered to emulate this damn thing, since apparently it was never used... At very worst case, you can use it to detect whether you're running on an emulator or not.
SH4 Watchdog Timer Driver
-
- DCEmu Banned
- Posts: 1876
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Mon Mar 22, 2004 4:55 pm
- Location: #%^&*!!!11one Super Sonic
- Has thanked: 82 times
- Been thanked: 64 times
- Contact: