blob: 2a00254173c1f95d5dbe8bd5f6365f5fe07911de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Björn Stenberg
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include "system.h"
#include "kernel.h"
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
void TIMER1(void)
{
/* Run through the list of tick tasks (using main core) */
TIMER1_VAL; /* Read value to ack IRQ */
/* Run through the list of tick tasks using main CPU core -
wake up the COP through its control interface to provide pulse */
call_tick_tasks();
#if NUM_CORES > 1
/* Pulse the COP */
core_wake(COP);
#endif /* NUM_CORES */
}
#endif
/* Must be last function called init kernel/thread initialization */
void tick_start(unsigned int interval_in_ms)
{
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
TIMER1_CFG = 0x0;
TIMER1_VAL;
/* enable timer */
TIMER1_CFG = 0xc0000000 | (interval_in_ms*1000 - 1);
/* unmask interrupt source */
CPU_INT_EN = TIMER1_MASK;
#else
/* We don't enable interrupts in the bootloader */
(void)interval_in_ms;
#endif
}
#ifdef HAVE_BOOTLOADER_USB_MODE
void tick_stop(void)
{
CPU_INT_DIS = TIMER1_MASK;
TIMER1_CFG = 0;
}
#endif
|