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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2006 Daniel Stenberg
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "cpu.h"
#include "system.h"
#include "lcd.h"
#include "kernel.h"
#include "thread.h"
#include "ata.h"
#include "fat.h"
#include "disk.h"
#include "font.h"
#include "adc.h"
#include "backlight.h"
#include "panic.h"
#include "power.h"
#include "file.h"
static inline void blink(void)
{
volatile unsigned int* ptr;
int i;
ptr = (volatile unsigned int*)0x70000020;
*ptr &= ~(1 << 13);
for(i = 0; i < 0xfffff; i++)
{
}
*ptr |= (1 << 13);
for(i = 0; i < 0xfffff; i++)
{
}
}
static inline void slow_blink(void)
{
volatile unsigned int* ptr;
int i;
ptr = (volatile unsigned int*)0x70000020;
*ptr &= ~(1 << 13);
for(i = 0; i < (0xfffff); i++)
{
}
for(i = 0; i < (0xfffff); i++)
{
}
for(i = 0; i < (0xfffff); i++)
{
}
*ptr |= (1 << 13);
for(i = 0; i < (0xfffff); i++)
{
}
for(i = 0; i < (0xfffff); i++)
{
}
for(i = 0; i < (0xfffff); i++)
{
}
}
static inline unsigned long get_pc(void)
{
unsigned long pc;
asm volatile (
"mov %0, pc\n"
: "=r"(pc)
);
return pc;
}
/* These functions are present in the firmware library, but we reimplement
them here because the originals do a lot more than we want */
void reset_poweroff_timer(void)
{
}
int dbg_ports(void)
{
unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
unsigned int gpio_e, gpio_f, gpio_g, gpio_h;
unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
char buf[128];
int line;
lcd_setmargins(0, 0);
lcd_clear_display();
lcd_setfont(FONT_SYSFIXED);
while(1)
{
gpio_a = GPIOA_INPUT_VAL;
gpio_b = GPIOB_INPUT_VAL;
gpio_c = GPIOC_INPUT_VAL;
gpio_g = GPIOG_INPUT_VAL;
gpio_h = GPIOH_INPUT_VAL;
gpio_i = GPIOI_INPUT_VAL;
line = 0;
snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_G: %02x", gpio_a, gpio_g);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPIO_B: %02x GPIO_H: %02x", gpio_b, gpio_h);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_I: %02x", gpio_c, gpio_i);
lcd_puts(0, line++, buf);
line++;
gpio_d = GPIOD_INPUT_VAL;
gpio_e = GPIOE_INPUT_VAL;
gpio_f = GPIOF_INPUT_VAL;
gpio_j = GPIOJ_INPUT_VAL;
gpio_k = GPIOK_INPUT_VAL;
gpio_l = GPIOL_INPUT_VAL;
snprintf(buf, sizeof(buf), "GPIO_D: %02x GPIO_J: %02x", gpio_d, gpio_j);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPIO_E: %02x GPIO_K: %02x", gpio_e, gpio_k);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l);
lcd_puts(0, line++, buf);
line++;
snprintf(buf, sizeof(buf), "ADC_1: %02x", adc_read(ADC_0));
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "ADC_2: %02x", adc_read(ADC_1));
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "ADC_3: %02x", adc_read(ADC_2));
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "ADC_4: %02x", adc_read(ADC_3));
lcd_puts(0, line++, buf);
lcd_update();
}
return 0;
}
void mpeg_stop(void)
{
}
void usb_acknowledge(void)
{
}
void usb_wait_for_disconnect(void)
{
}
void sys_poweroff(void)
{
}
void system_reboot(void)
{
}
void main(void)
{
kernel_init();
adc_init();
lcd_init_device();
dbg_ports();
}
|