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 blink(2);
68 if (dbg_fh > 0) {
69 write(dbg_fh, str, strlen(str));
70 }
71 }
72
73 static int dump_rom() {
74 volatile int ret = 0;
75 volatile int fd;
76
77 if ((fd = open("A/MISC/FW_FFC0.DMP", O_WRONLY|O_CREAT, 0777)) > 0) {
78 write(fd, (char*)0xFFC00000, ROMSIZE);
79 close(fd);
80 ret = 1;
81 }
82
83 return ret;
84 }
85
86 void go_debug(long kbd_state[]) {
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 }
102
103