summaryrefslogtreecommitdiff
path: root/firmware/test/kernel/timer.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-04-25 00:15:04 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-04-25 00:15:04 +0000
commit7b9581a13148957842ab53e2b28bf0a663a48980 (patch)
tree04db80bcc15ccb36c50d6e368c5846ec65bcd4f0 /firmware/test/kernel/timer.c
parent99406a6635f91f5fc716cd0ca28e8364f7a97061 (diff)
downloadrockbox-7b9581a13148957842ab53e2b28bf0a663a48980.zip
rockbox-7b9581a13148957842ab53e2b28bf0a663a48980.tar.gz
rockbox-7b9581a13148957842ab53e2b28bf0a663a48980.tar.bz2
rockbox-7b9581a13148957842ab53e2b28bf0a663a48980.tar.xz
Not yet working
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@220 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/kernel/timer.c')
-rw-r--r--firmware/test/kernel/timer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/test/kernel/timer.c b/firmware/test/kernel/timer.c
index be253db..31c6f82 100644
--- a/firmware/test/kernel/timer.c
+++ b/firmware/test/kernel/timer.c
@@ -19,6 +19,7 @@
#include "sh7034.h"
#include "system.h"
#include "debug.h"
+#include "kernel.h"
void tick_start(unsigned int interval_in_ms)
{
@@ -26,6 +27,7 @@ void tick_start(unsigned int interval_in_ms)
count = FREQ / 1000 / 8 * interval_in_ms;
+ debugf("count = %d\n", count);
if(count > 0xffff)
{
debugf("Error! The tick interval is too long (%d ms)\n",
@@ -40,24 +42,22 @@ void tick_start(unsigned int interval_in_ms)
TMDR &= ~0x01; /* Operate normally */
TCNT0 = 0; /* Start counting at 0 */
- GRA0 = 0xfff0;
+ GRA0 = count;
TCR0 = 0x23; /* Clear at GRA match, sysclock/8 */
- TSTR |= 0x01; /* Start timer 1 */
-
/* Enable interrupt on level 1 */
IPRC = (IPRC & ~0x00f0) | 0x0010;
-
- TIER0 |= 0x01; /* Enable GRA match interrupt */
- while(1)
- {
- }
+ TSR0 &= ~0x01;
+ TIER0 |= 0x01; /* Enable GRA match interrupt */
+
+ TSTR |= 0x01; /* Start timer 1 */
}
#pragma interrupt
void IMIA0(void)
{
+ current_tick++;
+
TSR0 &= ~0x01;
- debugf("Yes\n");
}