summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-07-15 17:20:07 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-07-15 17:20:07 +0000
commitea9d1073201bf8feacdd947c5aa2742b7718bf70 (patch)
tree3258002431cea157646efd87ad938470793ec0f5
parentebb612fbcc87a9547a3603ef6188a26b0760a9aa (diff)
downloadrockbox-ea9d1073201bf8feacdd947c5aa2742b7718bf70.tar.gz
rockbox-ea9d1073201bf8feacdd947c5aa2742b7718bf70.zip
Forgot a file..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18053 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/ondavx747.c105
1 files changed, 98 insertions, 7 deletions
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c
index 46e81cacad..5333ac3b1f 100644
--- a/bootloader/ondavx747.c
+++ b/bootloader/ondavx747.c
@@ -30,6 +30,8 @@
30#include "system.h" 30#include "system.h"
31#include "mips.h" 31#include "mips.h"
32#include "button.h" 32#include "button.h"
33#include "timefuncs.h"
34#include "rtc.h"
33 35
34int _line = 1; 36int _line = 1;
35char _printfbuf[256]; 37char _printfbuf[256];
@@ -56,7 +58,7 @@ void _printf(const char *format, ...)
56 _line = 1; 58 _line = 1;
57} 59}
58 60
59void audiotest(void) 61static void audiotest(void)
60{ 62{
61 __i2s_internal_codec(); 63 __i2s_internal_codec();
62 __aic_enable(); 64 __aic_enable();
@@ -65,6 +67,86 @@ void audiotest(void)
65 __aic_enable_loopback(); 67 __aic_enable_loopback();
66} 68}
67 69
70#define JZ_NAND_SELECT(n) (REG_EMC_NFCSR |= (EMC_NFCSR_NFCE##n | EMC_NFCSR_NFE##n) )
71#define JZ_NAND_DESELECT(n) (REG_EMC_NFCSR &= ~(EMC_NFCSR_NFCE##n | EMC_NFCSR_NFE##n) )
72
73#define NAND_CMD_READ1_00 0x00
74#define NAND_CMD_READ_ID1 0x90
75#define NAND_CMD_READ_ID2 0x91
76
77#define NANDFLASH_CLE 0x00008000 //PA[15]
78#define NANDFLASH_ALE 0x00010000 //PA[16]
79
80#define NANDFLASH_BASE 0xB8000000
81#define REG_NAND_DATA (*((volatile unsigned char *) NANDFLASH_BASE))
82#define REG_NAND_CMD (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_CLE)))
83#define REG_NAND_ADDR (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_ALE)))
84
85static void jz_nand_scan_id(void)
86{
87 unsigned char cData[5];
88 unsigned int dwNandID;
89
90 REG_EMC_NFCSR = 0;
91
92 JZ_NAND_SELECT(1);
93 REG_NAND_CMD = NAND_CMD_READ_ID1;
94 REG_NAND_ADDR = NAND_CMD_READ1_00;
95 cData[0] = REG_NAND_DATA;
96 cData[1] = REG_NAND_DATA;
97 cData[2] = REG_NAND_DATA;
98 cData[3] = REG_NAND_DATA;
99 cData[4] = REG_NAND_DATA;
100 JZ_NAND_DESELECT(1);
101
102 dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
103
104 _printf("NAND Flash 1: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
105
106 JZ_NAND_SELECT(2);
107 REG_NAND_CMD = NAND_CMD_READ_ID1;
108 REG_NAND_ADDR = NAND_CMD_READ1_00;
109 cData[0] = REG_NAND_DATA;
110 cData[1] = REG_NAND_DATA;
111 cData[2] = REG_NAND_DATA;
112 cData[3] = REG_NAND_DATA;
113 cData[4] = REG_NAND_DATA;
114 JZ_NAND_DESELECT(2);
115
116 dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
117
118 _printf("NAND Flash 2: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
119
120
121 JZ_NAND_SELECT(3);
122 REG_NAND_CMD = NAND_CMD_READ_ID1;
123 REG_NAND_ADDR = NAND_CMD_READ1_00;
124 cData[0] = REG_NAND_DATA;
125 cData[1] = REG_NAND_DATA;
126 cData[2] = REG_NAND_DATA;
127 cData[3] = REG_NAND_DATA;
128 cData[4] = REG_NAND_DATA;
129 JZ_NAND_DESELECT(3);
130
131 dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
132
133 _printf("NAND Flash 3: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
134
135 JZ_NAND_SELECT(4);
136 REG_NAND_CMD = NAND_CMD_READ_ID1;
137 REG_NAND_ADDR = NAND_CMD_READ1_00;
138 cData[0] = REG_NAND_DATA;
139 cData[1] = REG_NAND_DATA;
140 cData[2] = REG_NAND_DATA;
141 cData[3] = REG_NAND_DATA;
142 cData[4] = REG_NAND_DATA;
143 JZ_NAND_DESELECT(4);
144
145 dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
146
147 _printf("NAND Flash 4: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
148}
149
68static void jz_store_icache(void) 150static void jz_store_icache(void)
69{ 151{
70 unsigned long start; 152 unsigned long start;
@@ -99,26 +181,35 @@ int main(void)
99 font_init(); 181 font_init();
100 lcd_setfont(FONT_SYSFIXED); 182 lcd_setfont(FONT_SYSFIXED);
101 button_init(); 183 button_init();
184 rtc_init();
102 185
103 backlight_init(); 186 backlight_init();
104 187
105 /* To make the Windows say "ding-dong".. */ 188 /* To make the Windows say "ding-dong".. */
106 REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN; 189 REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN;
107 190
108 int touch; 191 int touch, btn;
109 lcd_clear_display(); 192 lcd_clear_display();
110 _printf("Rockbox bootloader v0.000001"); 193 _printf("Rockbox bootloader v0.000001");
194 jz_nand_scan_id();
195 _printf("Test");
111 while(1) 196 while(1)
112 { 197 {
113 if(button_read_device(&touch) & BUTTON_VOL_DOWN) 198 btn = button_read_device(&touch);
199 if(btn & BUTTON_VOL_DOWN)
114 _printf("BUTTON_VOL_DOWN"); 200 _printf("BUTTON_VOL_DOWN");
115 if(button_read_device(&touch) & BUTTON_MENU) 201 if(btn & BUTTON_MENU)
116 _printf("BUTTON_MENU"); 202 _printf("BUTTON_MENU");
117 if(button_read_device(&touch) & BUTTON_VOL_UP) 203 if(btn & BUTTON_VOL_UP)
118 _printf("BUTTON_VOL_UP"); 204 _printf("BUTTON_VOL_UP");
119 if(button_read_device(&touch) & BUTTON_POWER) 205 if(btn & BUTTON_POWER)
120 _printf("BUTTON_POWER"); 206 _printf("BUTTON_POWER");
121 _printf("X: %d Y: %d", touch>>16, touch&0xFFFF); 207 if(button_hold())
208 _printf("BUTTON_HOLD");
209 if(touch != 0)
210 _printf("X: %d Y: %d", touch>>16, touch&0xFFFF);
211 /*_printf("%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year,
212 get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec);*/
122 } 213 }
123 214
124 return 0; 215 return 0;