]>
Commit | Line | Data |
---|---|---|
6cb142fa WD |
1 | /* |
2 | * U-boot - board.c First C file to be called contains init routines | |
3 | * | |
d5bffeb8 | 4 | * Copyright (c) 2005-2008 Analog Devices Inc. |
6cb142fa WD |
5 | * |
6 | * (C) Copyright 2000-2004 | |
7 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
8 | * | |
d5bffeb8 | 9 | * Licensed under the GPL-2 or later. |
6cb142fa WD |
10 | */ |
11 | ||
12 | #include <common.h> | |
13 | #include <command.h> | |
6cb142fa | 14 | #include <devices.h> |
6cb142fa | 15 | #include <environment.h> |
3f0606ad | 16 | #include <i2c.h> |
d5bffeb8 MF |
17 | #include <malloc.h> |
18 | #include <net.h> | |
19 | #include <version.h> | |
20 | ||
3f0606ad | 21 | #include <asm/cplb.h> |
d5bffeb8 MF |
22 | #include <asm/mach-common/bits/mpu.h> |
23 | ||
24 | #ifdef CONFIG_CMD_NAND | |
25 | #include <nand.h> /* cannot even include nand.h if it isnt configured */ | |
26 | #endif | |
6cb142fa | 27 | |
9171fc81 | 28 | #if defined(CONFIG_POST) |
3f0606ad AL |
29 | #include <post.h> |
30 | int post_flag; | |
31 | #endif | |
d87080b7 | 32 | |
1218abf1 WD |
33 | DECLARE_GLOBAL_DATA_PTR; |
34 | ||
d5bffeb8 MF |
35 | const char version_string[] = U_BOOT_VERSION " (" __DATE__ " - " __TIME__ ")"; |
36 | ||
37 | __attribute__((always_inline)) | |
38 | static inline void serial_early_puts(const char *s) | |
39 | { | |
40 | #ifdef CONFIG_DEBUG_EARLY_SERIAL | |
41 | serial_puts("Early: "); | |
42 | serial_puts(s); | |
3f0606ad | 43 | #endif |
d5bffeb8 | 44 | } |
6cb142fa | 45 | |
d5bffeb8 MF |
46 | /* Get the input voltage */ |
47 | static u_long get_vco(void) | |
3f0606ad AL |
48 | { |
49 | u_long msel; | |
50 | u_long vco; | |
51 | ||
52 | msel = (*pPLL_CTL >> 9) & 0x3F; | |
53 | if (0 == msel) | |
54 | msel = 64; | |
55 | ||
56 | vco = CONFIG_CLKIN_HZ; | |
57 | vco >>= (1 & *pPLL_CTL); /* DF bit */ | |
58 | vco = msel * vco; | |
59 | return vco; | |
60 | } | |
61 | ||
d5bffeb8 | 62 | /* Get the Core clock */ |
3f0606ad AL |
63 | u_long get_cclk(void) |
64 | { | |
65 | u_long csel, ssel; | |
66 | if (*pPLL_STAT & 0x1) | |
67 | return CONFIG_CLKIN_HZ; | |
68 | ||
69 | ssel = *pPLL_DIV; | |
70 | csel = ((ssel >> 4) & 0x03); | |
71 | ssel &= 0xf; | |
72 | if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */ | |
73 | return get_vco() / ssel; | |
74 | return get_vco() >> csel; | |
75 | } | |
76 | ||
77 | /* Get the System clock */ | |
78 | u_long get_sclk(void) | |
79 | { | |
80 | u_long ssel; | |
81 | ||
82 | if (*pPLL_STAT & 0x1) | |
83 | return CONFIG_CLKIN_HZ; | |
84 | ||
85 | ssel = (*pPLL_DIV & 0xf); | |
86 | ||
87 | return get_vco() / ssel; | |
88 | } | |
6cb142fa | 89 | |
d5bffeb8 MF |
90 | static void *mem_malloc_start, *mem_malloc_end, *mem_malloc_brk; |
91 | ||
6cb142fa WD |
92 | static void mem_malloc_init(void) |
93 | { | |
6d0f6bcf JCPV |
94 | mem_malloc_start = (void *)CONFIG_SYS_MALLOC_BASE; |
95 | mem_malloc_end = (void *)(CONFIG_SYS_MALLOC_BASE + CONFIG_SYS_MALLOC_LEN); | |
6cb142fa | 96 | mem_malloc_brk = mem_malloc_start; |
d5bffeb8 | 97 | memset(mem_malloc_start, 0, mem_malloc_end - mem_malloc_start); |
6cb142fa WD |
98 | } |
99 | ||
100 | void *sbrk(ptrdiff_t increment) | |
101 | { | |
d5bffeb8 MF |
102 | void *old = mem_malloc_brk; |
103 | void *new = old + increment; | |
104 | ||
105 | if (new < mem_malloc_start || new > mem_malloc_end) | |
106 | return NULL; | |
6cb142fa | 107 | |
6cb142fa WD |
108 | mem_malloc_brk = new; |
109 | ||
d5bffeb8 | 110 | return old; |
6cb142fa WD |
111 | } |
112 | ||
113 | static int display_banner(void) | |
114 | { | |
d5bffeb8 | 115 | printf("\n\n%s\n\n", version_string); |
f7ce12cb | 116 | printf("CPU: ADSP " MK_STR(CONFIG_BFIN_CPU) " (Detected Rev: 0.%d)\n", bfin_revid()); |
d5bffeb8 | 117 | return 0; |
6cb142fa WD |
118 | } |
119 | ||
120 | static int init_baudrate(void) | |
121 | { | |
d5bffeb8 MF |
122 | char baudrate[15]; |
123 | int i = getenv_r("baudrate", baudrate, sizeof(baudrate)); | |
6cb142fa | 124 | gd->bd->bi_baudrate = gd->baudrate = (i > 0) |
d5bffeb8 | 125 | ? simple_strtoul(baudrate, NULL, 10) |
3f0606ad | 126 | : CONFIG_BAUDRATE; |
d5bffeb8 | 127 | return 0; |
6cb142fa WD |
128 | } |
129 | ||
6cb142fa WD |
130 | static void display_global_data(void) |
131 | { | |
d5bffeb8 | 132 | #ifdef CONFIG_DEBUG_EARLY_SERIAL |
6cb142fa WD |
133 | bd_t *bd; |
134 | bd = gd->bd; | |
d5bffeb8 MF |
135 | printf(" gd: %x\n", gd); |
136 | printf(" |-flags: %x\n", gd->flags); | |
137 | printf(" |-board_type: %x\n", gd->board_type); | |
138 | printf(" |-baudrate: %i\n", gd->baudrate); | |
139 | printf(" |-have_console: %x\n", gd->have_console); | |
140 | printf(" |-ram_size: %x\n", gd->ram_size); | |
141 | printf(" |-reloc_off: %x\n", gd->reloc_off); | |
142 | printf(" |-env_addr: %x\n", gd->env_addr); | |
143 | printf(" |-env_valid: %x\n", gd->env_valid); | |
144 | printf(" |-jt(%x): %x\n", gd->jt, *(gd->jt)); | |
145 | printf(" \\-bd: %x\n", gd->bd); | |
146 | printf(" |-bi_baudrate: %x\n", bd->bi_baudrate); | |
147 | printf(" |-bi_ip_addr: %x\n", bd->bi_ip_addr); | |
148 | printf(" |-bi_enetaddr: %x %x %x %x %x %x\n", | |
149 | bd->bi_enetaddr[0], bd->bi_enetaddr[1], | |
150 | bd->bi_enetaddr[2], bd->bi_enetaddr[3], | |
151 | bd->bi_enetaddr[4], bd->bi_enetaddr[5]); | |
152 | printf(" |-bi_boot_params: %x\n", bd->bi_boot_params); | |
153 | printf(" |-bi_memstart: %x\n", bd->bi_memstart); | |
154 | printf(" |-bi_memsize: %x\n", bd->bi_memsize); | |
155 | printf(" |-bi_flashstart: %x\n", bd->bi_flashstart); | |
156 | printf(" |-bi_flashsize: %x\n", bd->bi_flashsize); | |
157 | printf(" \\-bi_flashoffset: %x\n", bd->bi_flashoffset); | |
6cb142fa | 158 | #endif |
d5bffeb8 | 159 | } |
6cb142fa | 160 | |
d5bffeb8 MF |
161 | #define CPLB_PAGE_SIZE (4 * 1024 * 1024) |
162 | #define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1)) | |
3f0606ad AL |
163 | void init_cplbtables(void) |
164 | { | |
d5bffeb8 MF |
165 | volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA; |
166 | volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA; | |
167 | uint32_t extern_memory; | |
168 | size_t i; | |
169 | ||
170 | void icplb_add(uint32_t addr, uint32_t data) | |
171 | { | |
172 | *(ICPLB_ADDR + i) = addr; | |
173 | *(ICPLB_DATA + i) = data; | |
3f0606ad | 174 | } |
d5bffeb8 MF |
175 | void dcplb_add(uint32_t addr, uint32_t data) |
176 | { | |
177 | *(DCPLB_ADDR + i) = addr; | |
178 | *(DCPLB_DATA + i) = data; | |
3f0606ad AL |
179 | } |
180 | ||
d5bffeb8 MF |
181 | /* populate a few common entries ... we'll let |
182 | * the memory map and cplb exception handler do | |
183 | * the rest of the work. | |
184 | */ | |
185 | i = 0; | |
186 | ICPLB_ADDR = (uint32_t *)ICPLB_ADDR0; | |
187 | ICPLB_DATA = (uint32_t *)ICPLB_DATA0; | |
188 | DCPLB_ADDR = (uint32_t *)DCPLB_ADDR0; | |
189 | DCPLB_DATA = (uint32_t *)DCPLB_DATA0; | |
190 | ||
191 | icplb_add(0xFFA00000, L1_IMEMORY); | |
192 | dcplb_add(0xFF800000, L1_DMEMORY); | |
193 | ++i; | |
194 | ||
6d0f6bcf JCPV |
195 | icplb_add(CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_IKERNEL); |
196 | dcplb_add(CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_DKERNEL); | |
d5bffeb8 MF |
197 | ++i; |
198 | ||
199 | /* If the monitor crosses a 4 meg boundary, we'll need | |
200 | * to lock two entries for it. | |
201 | */ | |
6d0f6bcf JCPV |
202 | if ((CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK) != ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK)) { |
203 | icplb_add((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_IKERNEL); | |
204 | dcplb_add((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_DKERNEL); | |
d5bffeb8 MF |
205 | ++i; |
206 | } | |
207 | ||
208 | icplb_add(0x20000000, SDRAM_INON_CHBL); | |
209 | dcplb_add(0x20000000, SDRAM_EBIU); | |
210 | ++i; | |
211 | ||
212 | /* Add entries for the rest of external RAM up to the bootrom */ | |
213 | extern_memory = 0; | |
214 | ||
215 | #ifdef CONFIG_DEBUG_NULL_PTR | |
216 | icplb_add(extern_memory, (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB); | |
217 | dcplb_add(extern_memory, (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB); | |
218 | ++i; | |
219 | icplb_add(extern_memory, SDRAM_IKERNEL); | |
220 | dcplb_add(extern_memory, SDRAM_DKERNEL); | |
221 | extern_memory += CPLB_PAGE_SIZE; | |
222 | ++i; | |
223 | #endif | |
224 | ||
6d0f6bcf | 225 | while (i < 16 && extern_memory < (CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK)) { |
d5bffeb8 MF |
226 | icplb_add(extern_memory, SDRAM_IGENERIC); |
227 | dcplb_add(extern_memory, SDRAM_DGENERIC); | |
228 | extern_memory += CPLB_PAGE_SIZE; | |
229 | ++i; | |
230 | } | |
231 | while (i < 16) { | |
232 | icplb_add(0, 0); | |
233 | dcplb_add(0, 0); | |
234 | ++i; | |
235 | } | |
3f0606ad AL |
236 | } |
237 | ||
6cb142fa WD |
238 | /* |
239 | * All attempts to come up with a "common" initialization sequence | |
240 | * that works for all boards and architectures failed: some of the | |
241 | * requirements are just _too_ different. To get rid of the resulting | |
242 | * mess of board dependend #ifdef'ed code we now make the whole | |
243 | * initialization sequence configurable to the user. | |
244 | * | |
245 | * The requirements for any new initalization function is simple: it | |
246 | * receives a pointer to the "global data" structure as it's only | |
247 | * argument, and returns an integer return code, where 0 means | |
248 | * "continue" and != 0 means "fatal error, hang the system". | |
249 | */ | |
250 | ||
d5bffeb8 MF |
251 | extern int exception_init(void); |
252 | extern int irq_init(void); | |
253 | extern int rtc_init(void); | |
254 | extern int timer_init(void); | |
255 | ||
6cb142fa WD |
256 | void board_init_f(ulong bootflag) |
257 | { | |
6cb142fa WD |
258 | ulong addr; |
259 | bd_t *bd; | |
3f0606ad | 260 | |
d5bffeb8 MF |
261 | #ifdef CONFIG_BOARD_EARLY_INIT_F |
262 | serial_early_puts("Board early init flash\n"); | |
263 | board_early_init_f(); | |
264 | #endif | |
265 | ||
266 | serial_early_puts("Init CPLB tables\n"); | |
3f0606ad | 267 | init_cplbtables(); |
6cb142fa | 268 | |
d5bffeb8 MF |
269 | serial_early_puts("Exceptions setup\n"); |
270 | exception_init(); | |
271 | ||
272 | #ifndef CONFIG_ICACHE_OFF | |
273 | serial_early_puts("Turn on ICACHE\n"); | |
274 | icache_enable(); | |
275 | #endif | |
276 | #ifndef CONFIG_DCACHE_OFF | |
277 | serial_early_puts("Turn on DCACHE\n"); | |
278 | dcache_enable(); | |
279 | #endif | |
280 | ||
281 | serial_early_puts("Init global data\n"); | |
6d0f6bcf | 282 | gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR); |
3f0606ad | 283 | memset((void *)gd, 0, sizeof(gd_t)); |
6cb142fa WD |
284 | |
285 | /* Board data initialization */ | |
6d0f6bcf | 286 | addr = (CONFIG_SYS_GBL_DATA_ADDR + sizeof(gd_t)); |
6cb142fa WD |
287 | |
288 | /* Align to 4 byte boundary */ | |
8e7b703a | 289 | addr &= ~(4 - 1); |
3f0606ad | 290 | bd = (bd_t *) addr; |
6cb142fa | 291 | gd->bd = bd; |
3f0606ad | 292 | memset((void *)bd, 0, sizeof(bd_t)); |
6cb142fa | 293 | |
d5bffeb8 MF |
294 | bd->bi_r_version = version_string; |
295 | bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU); | |
296 | bd->bi_board_name = BFIN_BOARD_NAME; | |
297 | bd->bi_vco = get_vco(); | |
298 | bd->bi_cclk = get_cclk(); | |
299 | bd->bi_sclk = get_sclk(); | |
300 | ||
6cb142fa | 301 | /* Initialize */ |
d5bffeb8 | 302 | serial_early_puts("IRQ init\n"); |
9171fc81 | 303 | irq_init(); |
d5bffeb8 MF |
304 | serial_early_puts("Environment init\n"); |
305 | env_init(); | |
306 | serial_early_puts("Baudrate init\n"); | |
307 | init_baudrate(); | |
308 | serial_early_puts("Serial init\n"); | |
309 | serial_init(); | |
310 | serial_early_puts("Console init flash\n"); | |
6cb142fa | 311 | console_init_f(); |
d5bffeb8 MF |
312 | serial_early_puts("End of early debugging\n"); |
313 | display_banner(); | |
3f0606ad | 314 | |
6cb142fa | 315 | checkboard(); |
d5bffeb8 | 316 | #if defined(CONFIG_RTC_BFIN) && defined(CONFIG_CMD_DATE) |
6cb142fa WD |
317 | rtc_init(); |
318 | #endif | |
319 | timer_init(); | |
d5bffeb8 | 320 | |
3f0606ad AL |
321 | printf("Clock: VCO: %lu MHz, Core: %lu MHz, System: %lu MHz\n", |
322 | get_vco() / 1000000, get_cclk() / 1000000, get_sclk() / 1000000); | |
d5bffeb8 MF |
323 | |
324 | printf("RAM: "); | |
6cb142fa | 325 | print_size(initdram(0), "\n"); |
9171fc81 | 326 | #if defined(CONFIG_POST) |
3f0606ad AL |
327 | post_init_f(); |
328 | post_bootmode_init(); | |
329 | post_run(NULL, POST_ROM | post_bootmode_get(0)); | |
330 | #endif | |
d5bffeb8 | 331 | |
6cb142fa WD |
332 | board_init_r((gd_t *) gd, 0x20000010); |
333 | } | |
334 | ||
3f0606ad AL |
335 | #if defined(CONFIG_SOFT_I2C) || defined(CONFIG_HARD_I2C) |
336 | static int init_func_i2c(void) | |
337 | { | |
338 | puts("I2C: "); | |
6d0f6bcf | 339 | i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); |
3f0606ad AL |
340 | puts("ready\n"); |
341 | return (0); | |
342 | } | |
343 | #endif | |
344 | ||
6cb142fa WD |
345 | void board_init_r(gd_t * id, ulong dest_addr) |
346 | { | |
6cb142fa | 347 | extern void malloc_bin_reloc(void); |
d5bffeb8 | 348 | char *s; |
6cb142fa | 349 | bd_t *bd; |
6cb142fa WD |
350 | gd = id; |
351 | gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ | |
352 | bd = gd->bd; | |
353 | ||
9171fc81 | 354 | #if defined(CONFIG_POST) |
3f0606ad AL |
355 | post_output_backlog(); |
356 | post_reloc(); | |
357 | #endif | |
358 | ||
6d0f6bcf | 359 | #if !defined(CONFIG_SYS_NO_FLASH) |
6cb142fa WD |
360 | /* There are some other pointer constants we must deal with */ |
361 | /* configure available FLASH banks */ | |
d5bffeb8 MF |
362 | extern flash_info_t flash_info[]; |
363 | ulong size = flash_init(); | |
364 | puts("Flash: "); | |
365 | print_size(size, "\n"); | |
6d0f6bcf JCPV |
366 | flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE, |
367 | CONFIG_SYS_FLASH_BASE + 0x1ffff, &flash_info[0]); | |
368 | bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; | |
6cb142fa WD |
369 | bd->bi_flashsize = size; |
370 | bd->bi_flashoffset = 0; | |
371 | #else | |
372 | bd->bi_flashstart = 0; | |
373 | bd->bi_flashsize = 0; | |
374 | bd->bi_flashoffset = 0; | |
375 | #endif | |
376 | /* initialize malloc() area */ | |
377 | mem_malloc_init(); | |
378 | malloc_bin_reloc(); | |
379 | ||
3f0606ad | 380 | #ifdef CONFIG_SPI |
bb1f8b4f | 381 | # if ! defined(CONFIG_ENV_IS_IN_EEPROM) |
3f0606ad AL |
382 | spi_init_f(); |
383 | # endif | |
384 | spi_init_r(); | |
385 | #endif | |
386 | ||
6cb142fa WD |
387 | /* relocate environment function pointers etc. */ |
388 | env_relocate(); | |
389 | ||
d5bffeb8 | 390 | #ifdef CONFIG_CMD_NET |
6cb142fa WD |
391 | /* board MAC address */ |
392 | s = getenv("ethaddr"); | |
d5bffeb8 MF |
393 | if (s == NULL) { |
394 | # ifndef CONFIG_ETHADDR | |
395 | # if 0 | |
396 | if (!board_get_enetaddr(bd->bi_enetaddr)) { | |
397 | char nid[20]; | |
398 | sprintf(nid, "%02X:%02X:%02X:%02X:%02X:%02X", | |
399 | bd->bi_enetaddr[0], bd->bi_enetaddr[1], | |
400 | bd->bi_enetaddr[2], bd->bi_enetaddr[3], | |
401 | bd->bi_enetaddr[4], bd->bi_enetaddr[5]); | |
402 | setenv("ethaddr", nid); | |
403 | } | |
404 | # endif | |
405 | # endif | |
406 | } else { | |
407 | int i; | |
408 | char *e; | |
409 | for (i = 0; i < 6; ++i) { | |
410 | bd->bi_enetaddr[i] = simple_strtoul(s, &e, 16); | |
6cb142fa | 411 | s = (*e) ? e + 1 : e; |
d5bffeb8 | 412 | } |
6cb142fa WD |
413 | } |
414 | ||
415 | /* IP Address */ | |
416 | bd->bi_ip_addr = getenv_IPaddr("ipaddr"); | |
d5bffeb8 | 417 | #endif |
6cb142fa WD |
418 | |
419 | /* Initialize devices */ | |
420 | devices_init(); | |
421 | jumptable_init(); | |
422 | ||
423 | /* Initialize the console (after the relocation and devices init) */ | |
424 | console_init_r(); | |
425 | ||
426 | /* Initialize from environment */ | |
d5bffeb8 | 427 | if ((s = getenv("loadaddr")) != NULL) |
6cb142fa | 428 | load_addr = simple_strtoul(s, NULL, 16); |
d5bffeb8 MF |
429 | #ifdef CONFIG_CMD_NET |
430 | if ((s = getenv("bootfile")) != NULL) | |
6cb142fa | 431 | copy_filename(BootFile, s, sizeof(BootFile)); |
6cb142fa | 432 | #endif |
3f0606ad | 433 | |
d5bffeb8 | 434 | #ifdef CONFIG_CMD_NAND |
3f0606ad AL |
435 | puts("NAND: "); |
436 | nand_init(); /* go init the NAND */ | |
437 | #endif | |
438 | ||
6cb142fa WD |
439 | #if defined(CONFIG_MISC_INIT_R) |
440 | /* miscellaneous platform dependent initialisations */ | |
441 | misc_init_r(); | |
442 | #endif | |
443 | ||
f7ce12cb | 444 | #ifdef CONFIG_CMD_NET |
d5bffeb8 MF |
445 | printf("Net: "); |
446 | eth_initialize(gd->bd); | |
447 | if (getenv("ethaddr")) | |
448 | printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", | |
449 | bd->bi_enetaddr[0], bd->bi_enetaddr[1], bd->bi_enetaddr[2], | |
450 | bd->bi_enetaddr[3], bd->bi_enetaddr[4], bd->bi_enetaddr[5]); | |
6cb142fa | 451 | #endif |
6cb142fa | 452 | |
3f0606ad | 453 | #if defined(CONFIG_SOFT_I2C) || defined(CONFIG_HARD_I2C) |
6cb142fa WD |
454 | init_func_i2c(); |
455 | #endif | |
456 | ||
3f0606ad | 457 | display_global_data(); |
3f0606ad | 458 | |
9171fc81 | 459 | #if defined(CONFIG_POST) |
3f0606ad AL |
460 | if (post_flag) |
461 | post_run(NULL, POST_RAM | post_bootmode_get(0)); | |
6cb142fa WD |
462 | #endif |
463 | ||
464 | /* main_loop() can return to retry autoboot, if so just run it again. */ | |
d5bffeb8 | 465 | for (;;) |
6cb142fa | 466 | main_loop(); |
6cb142fa WD |
467 | } |
468 | ||
6cb142fa WD |
469 | void hang(void) |
470 | { | |
471 | puts("### ERROR ### Please RESET the board ###\n"); | |
d5bffeb8 MF |
472 | while (1) |
473 | /* If a JTAG emulator is hooked up, we'll automatically trigger | |
474 | * a breakpoint in it. If one isn't, this is just a NOP. | |
475 | */ | |
476 | asm("emuexcpt;"); | |
6cb142fa | 477 | } |