-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_init.c
More file actions
79 lines (66 loc) · 1.96 KB
/
system_init.c
File metadata and controls
79 lines (66 loc) · 1.96 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* \file system_init.c
* \brief Initialize libdprg
* \author David P. Anderson <dpa@io.isem.smu.edu>
*
* Initialize MRM ibrary functions. Calls all inits() in this library
*
* <b>History:</b>
*
* 07 Oct 2004 dpa - Created
*
* 27 Oct 2004 dpa - Added call to tpu_init(0x06);
*
* 10 Feb 2005 dpa - Added call to analog_services();
*
* 30 Dec 2006 rsr - Normalized indentation
*
* \todo system_init() should accept an initial clock speed value and
* pass it to cpu_init()
*/
/*
Copyright (C) 2004-2007 David P. Anderson <dpa@io.isem.smu.edu>
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 program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* Initialize the system function in the library and install the system
* interrupt service routine on the 1kHz sysclock timer
*
* @return Always returns 0
*/
int system_init()
{
void extern (*system_interrupt)();
void extern system_services();
void extern analog_services();
cpu_init();
sysclock_init();
led_init();
lcd_init();
sci_init();
tpu_init(0x06); /* iarb = 6 */
analog_service(); /* init analog read */
/* set hook to 1Kz sysclock interrupt for LCD and A/D service */
system_interrupt = &system_services;
/* Enable level 6&7 interrupts */
asm("move.w #0x2500,%sr");
return 0;
}
/**
* System 1kHz interrupt service routine. Services the LCD and A/D hardware
*/
void system_services()
{
lcd_service();
analog_service();
}