blob: 4645e388cc9c6b5ef9dc076f55ea1a5970ff97a1 [file] [log] [blame]
Dave Chapmanf2042982008-05-02 19:12:09 +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.
Dave Chapmanf2042982008-05-02 19:12:09 +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{
33 #warning function not implemented
34
35 (void)cycles;
36 (void)start;
37 return false;
38}
39
40bool __timer_register(void)
41{
42 #warning function not implemented
43
44 return false;
45}
46
47void __timer_unregister(void)
48{
49 #warning function not implemented
50}
51
52
53/* Timer interrupt processing - all timers (inc. tick) have a single IRQ */
54
55extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
56
57void TIMER(void)
58{
59 if (TIREQ & TF0) /* Timer0 reached ref value */
60 {
61 int i;
62
63 /* Run through the list of tick tasks */
64 for(i = 0; i < MAX_NUM_TICK_TASKS; i++)
65 {
66 if(tick_funcs[i])
67 {
68 tick_funcs[i]();
69 }
70 }
71 current_tick++;
72
73 /* reset Timer 0 IRQ & ref flags */
74 TIREQ |= TI0 | TF0;
75 }
76
77 if (TC32IRQ & (1<<3)) /* end of TC32 prescale */
78 {
79 /* dispatch timer */
80 }
81}