1 diff -urN romboot.old/com.cpp romboot/com.cpp
2 --- romboot.old/com.cpp 2004-07-04 21:37:05.000000000 +0200
3 +++ romboot/com.cpp 2007-04-04 04:30:12.000000000 +0200
5 //*-----------------------------------------------------------------------------
6 void AT91F_ClrScr(void)
15 if (*(--p) == '\t') { /* will retype the whole line */
16 while (*colp > plen) {
21 for (s=buffer; s<p; ++s) {
23 - puts(tab_seq+((*colp) & 07));
24 + putstr(tab_seq+((*colp) & 07));
25 *colp += 8 - ((*colp) & 07);
47 case '\r': /* Enter */
52 return (p - console_buffer);
54 case 0x03: /* ^C - break */
56 case 0x15: /* ^U - erase line */
65 void AT91F_WaitKeyPressed(void)
69 + putstr("Hit a Key!");
73 diff -urN romboot.old/main.cpp romboot/main.cpp
74 --- romboot.old/main.cpp 2007-04-03 12:12:33.000000000 +0200
75 +++ romboot/main.cpp 2007-04-04 05:56:39.000000000 +0200
78 AT91F_MCI_ReadBlockSwab(&MCI_Device, block*Max_Read_DataBlock_Length, (unsigned int *)bufpos, Max_Read_DataBlock_Length);
80 - if (p->magic != TRX_MAGIC)
81 + if (p->magic != TRX_MAGIC) {
82 + printf("Invalid Image 0x%08x\n\r");
86 printf("Read SD-Card\n\r");
87 AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC7 | AT91C_PIO_PC15 | AT91C_PIO_PC8 | AT91C_PIO_PC14;
92 - stdin = fopen(0, at91_dbgu_getc);
93 - stdout = fopen(at91_dbgu_putc, 0);
95 pAT91 = AT91C_ROM_BOOT_ADDRESS;
97 // Tempo Initialisation
102 - Program_From_MCI();
103 - AT91F_StartUboot(0, (void *)0);
104 + if (Program_From_MCI())
105 + AT91F_StartUboot(0, (void *)0);
109 // start tempo to start Uboot in a delay of 1 sec if no key pressed
110 svcUbootTempo.Start(&svcUbootTempo, 1000, 0, AT91F_StartUboot, (void *)0);
113 printf("press key\n\r");
118 svcUbootTempo.Stop(&svcUbootTempo);
120 AT91F_WaitKeyPressed();
125 +int puts(const char *str)
130 diff -urN romboot.old/stdio.cpp romboot/stdio.cpp
131 --- romboot.old/stdio.cpp 2004-07-04 22:36:10.000000000 +0200
132 +++ romboot/stdio.cpp 2007-04-04 04:29:25.000000000 +0200
136 extern int at91_dbgu_putc(int ch);
137 +extern int at91_dbgu_getc();
139 -FILE *stdout = (FILE *)0;
140 -FILE *stdin = (FILE *)0;
142 -FILE __filedesc[FILEDESCS];
144 -FILE *fopen(int (*put)(int), int (*get)())
146 - static int init = 1;
150 - for(int i = 0; i < FILEDESCS; i++)
152 - __filedesc[i].active = false;
153 - __filedesc[i].put = 0;
154 - __filedesc[i].get = 0;
160 - for(int i = 0; i < FILEDESCS; i++)
162 - if(!__filedesc[i].active)
164 - __filedesc[i].put = put;
165 - __filedesc[i].get = get;
167 - __filedesc[i].active = true;
169 - return &__filedesc[i];
176 -int fclose(FILE *fp)
177 +int putstr(const char *str)
179 - for(int i = 0; i < FILEDESCS; i++)
180 - if(&__filedesc[i] == fp || fp->active)
182 - fp->active = false;
193 -int fputs(const char *str, FILE *fp)
195 - if(fp == (FILE *)0)
198 - if(fp->put == (void *)0)
214 -int fputc(int c, FILE *fp)
216 - if(fp == (FILE *)0)
219 - if(fp->put == (void *)0)
227 - if(fp == (FILE *)0)
230 - if(fp->get == (void *)0)
237 -int puts(const char *str)
240 - return fputs(str, stdout);
246 - return fputc(c, stdout);
251 - return fputc(c, stdout);
258 - return fgetc(stdin);
259 + return at91_dbgu_getc();
262 int strlen(const char *str)
267 -int number(FILE *fp, int num, int base, int size, int precision, int type)
268 +int number(int num, int base, int size, int precision, int type)
270 char c, sign, tmp[66];
271 const char *digits="0123456789abcdef";
274 if(!(type&(ZEROPAD+LEFT)))
288 while (i < precision--)
303 -int vfprintf(FILE *fp, const char *fmt, va_list va)
304 +int vprintf(const char *fmt, va_list va)
308 @@ -231,33 +146,33 @@
310 s = va_arg(va, char *);
312 - fputs("<NULL>", fp);
320 - fputc(va_arg(va, int), fp);
321 + putc(va_arg(va, int));
325 - number(fp, va_arg(va, int), 10, 0, precision, type);
326 + number(va_arg(va, int), 10, 0, precision, type);
330 - number(fp, va_arg(va, int), 16, 0, precision, type);
331 + number(va_arg(va, int), 16, 0, precision, type);
335 - number(fp, va_arg(va, int), 16, 0, precision, type | LARGE);
336 + number(va_arg(va, int), 16, 0, precision, type | LARGE);
360 @@ -274,25 +189,13 @@
364 -int fprintf(FILE *fp, const char *fmt, ...)
370 - i = fprintf(fp, fmt, ap);
376 int printf(const char *fmt, ...)
382 - i = vfprintf(stdout, fmt, ap);
383 + i = vprintf(fmt, ap);
387 diff -urN romboot.old/stdio.h romboot/stdio.h
388 --- romboot.old/stdio.h 2004-07-04 22:04:27.000000000 +0200
389 +++ romboot/stdio.h 2007-04-04 04:29:48.000000000 +0200
396 - int (*put)(int); /* function to write one char to device */
397 - int (*get)(); /* function to read one char from device */
402 -FILE *fopen(int (*put)(int), int (*get)());
403 -int fclose(FILE *fp);
405 -int puts(const char *str);
406 +int putstr(const char *str);
411 -int fputs(const char *str, FILE *fp);
412 -int fputc(int c, FILE *fp);
413 -int fgetc(FILE *fp);
414 int strlen(const char *str);
416 -int fprintf(FILE *fp, const char *fmt, ...);
417 -int vfprintf(FILE *fp, const char *fmt, va_list ap);
418 +int vprintf(const char *fmt, va_list ap);
420 int printf(const char *fmt, ...);
422 -extern FILE *stdout;