This source file includes following definitions.
- blink
- dbg_start
- dbg_stop
- dbg_log
- dump_rom
- go_debug
1
2 #include "stdlib.h"
3 #include "conf.h"
4
5 void dbg_log(char *str);
6
7 #define LED_PR 0xc0220084
8
9 static void blink(int cnt)
10 {
11 volatile long *p=(void*)LED_PR;
12 int i;
13
14 for(;cnt>0;cnt--){
15 p[0]=0x46;
16
17 for(i=0;i<0x200000;i++){
18 asm ("nop\n");
19 asm ("nop\n");
20 }
21 p[0]=0x44;
22 for(i=0;i<0x200000;i++){
23 asm ("nop\n");
24 asm ("nop\n");
25 }
26 }
27 }
28
29 #define ROMSIZE (4*1024*1024)
30
31 static int dbg_fh = 0;
32
33 void dbg_start() {
34 if (0 == dbg_fh) {
35 if ((dbg_fh = open("A/MISC/DEBUG.LOG", O_WRONLY|O_CREAT, 0777)) > 0) {
36 lseek(dbg_fh, 0, SEEK_END);
37 }
38 }
39 }
40
41 void dbg_stop() {
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 if (dbg_fh > 0) {
61 close(dbg_fh);
62 dbg_fh = 0;
63 }
64 }
65
66 void dbg_log(char *str) {
67 if (dbg_fh > 0) {
68 write(dbg_fh, str, strlen(str));
69 }
70 }
71
72 static int dump_rom() {
73 volatile int ret = 0;
74 volatile int fd;
75
76 if ((fd = open("A/MISC/FW_FFC0.DMP", O_WRONLY|O_CREAT, 0777)) > 0) {
77 write(fd, (char*)0xFFC00000, ROMSIZE);
78 close(fd);
79 ret = 1;
80 }
81
82 return ret;
83 }
84
85 void go_debug(long kbd_state[]) {
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100 }
101
102