blob: c08520116a556eb2c7fd4937da233ee958fd63b4 [file] [log] [blame]
Rob Purchase47ea0302008-01-14 22:04:48 +00001/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2008 by Rob Purchase
11*
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
Rob Purchase47ea0302008-01-14 22:04:48 +000016*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "system.h"
25#include "timer.h"
26#include "logf.h"
27
28/* Use the TC32 counter [sourced by Xin:12Mhz] for this timer, as it's the
29 only one that allows a 32-bit counter (Timer0-5 are 16/20 bit only). */
30
31bool __timer_set(long cycles, bool start)
32{
Rob Purchase47ea0302008-01-14 22:04:48 +000033 (void)cycles;
34 (void)start;
35 return false;
36}
37
38bool __timer_register(void)
39{
Rob Purchase47ea0302008-01-14 22:04:48 +000040 return false;
41}
42
43void __timer_unregister(void)
44{
Rob Purchase47ea0302008-01-14 22:04:48 +000045}
46
47
48/* Timer interrupt processing - all timers (inc. tick) have a single IRQ */
49
50extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
51
Rob Purchase4dc2d8d2008-03-22 19:41:51 +000052void TIMER0(void)
Rob Purchase47ea0302008-01-14 22:04:48 +000053{
54 if (TIREQ & TF0) /* Timer0 reached ref value */
55 {
56 int i;
57
58 /* Run through the list of tick tasks */
59 for(i = 0; i < MAX_NUM_TICK_TASKS; i++)
60 {
61 if(tick_funcs[i])
62 {
63 tick_funcs[i]();
64 }
65 }
66
67 current_tick++;
68
69 /* reset Timer 0 IRQ & ref flags */
70 TIREQ |= TI0 | TF0;
71 }
72
73 if (TC32IRQ & (1<<3)) /* end of TC32 prescale */
74 {
75 /* dispatch timer */
76 }
Rob Purchase47ea0302008-01-14 22:04:48 +000077}