From: Erik M. <er...@us...> - 2001-07-22 22:54:30
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv28848/src Modified Files: Tag: blob_1_0_9_hack Makefile.am clock.c flash.c led.c ledasm.S main.c serial.c start.S time.c Added Files: Tag: blob_1_0_9_hack memory.c Log Message: - added memory tester - switch off LED just before we jump to RAM and immediately swith it on again in main() so we can see if something went wrong - LED definitions are now in include/led.h - toggle LED at serial input - moved the #define __ASM_ARCH_HARDWARE_H hack to sa1100.h so we have that hack only in one file - minor documentation updates ***** Error reading new file: [Errno 2] No such file or directory: 'memory.c' Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/Makefile.am,v retrieving revision 1.1.1.1.2.2 retrieving revision 1.1.1.1.2.3 diff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 --- Makefile.am 2001/07/11 18:59:03 1.1.1.1.2.2 +++ Makefile.am 2001/07/22 22:54:26 1.1.1.1.2.3 @@ -48,16 +48,18 @@ blob_rest_elf32_SOURCES = \ trampoline.S \ - testmem2.S \ flashasm.S \ + testmem2.S \ + clock.c \ + command.c \ + flash.c \ + led.c \ main.c \ + memory.c \ serial.c \ - command.c \ - clock.c \ - util.c \ time.c \ - uucodec.c \ - flash.c + util.c \ + uucodec.c blob_rest_elf32_LDFLAGS += \ Index: clock.c =================================================================== RCS file: /cvsroot/blob/blob/src/clock.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- clock.c 2001/06/27 19:47:42 1.1.1.1 +++ clock.c 2001/07/22 22:54:26 1.1.1.1.2.1 @@ -36,12 +36,11 @@ #endif #include "types.h" -#include "util.h" +#include "sa1100.h" #include "serial.h" #include "time.h" +#include "util.h" -#define __ASM_ARCH_HARDWARE_H -#include <asm/arch-sa1100/SA-1100.h> /* It should be possible to improve this function */ /* Determine if the given character is a 0 to 9 or a to z, Index: flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/flash.c,v retrieving revision 1.1.1.1.2.4 retrieving revision 1.1.1.1.2.5 diff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 --- flash.c 2001/07/20 18:39:03 1.1.1.1.2.4 +++ flash.c 2001/07/22 22:54:26 1.1.1.1.2.5 @@ -35,6 +35,7 @@ # include "config.h" #endif +#include "led.h" #include "main.h" #include "util.h" #include "serial.h" @@ -155,6 +156,7 @@ for(i = 0; i < numBlocks; i++, thisBlock += MAIN_BLOCK_SIZE) { SerialOutputByte('.'); + led_toggle(); if((EraseOne(thisBlock) & STATUS_ERASE_ERR) != 0) { SerialOutputString("\n*** Erase error at address 0x"); SerialOutputHex((u32)thisBlock); @@ -219,8 +221,10 @@ #endif for(i = 0; i < length; i+= 4, flashBase++, source++) { - if((i % MAIN_BLOCK_SIZE) == 0) + if((i % MAIN_BLOCK_SIZE) == 0) { SerialOutputByte('.'); + led_toggle(); + } *flashBase = data_to_flash(PGM_SETUP); *flashBase = *source; Index: led.c =================================================================== RCS file: /cvsroot/blob/blob/src/led.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- led.c 2001/06/27 19:47:42 1.1.1.1 +++ led.c 2001/07/22 22:54:26 1.1.1.1.2.1 @@ -8,72 +8,71 @@ * Modified by: Erik Mouw <J.A...@it...> * Modified at: Mon Aug 16 16:55:21 1999 *-----------------------------------------------------------------------*/ +/* + * led.c: simple LED control functions + * + * Copyright (C) 1999 2001 Erik Mouw (J.A...@it...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/* + * All functions assume that the LED is properly initialised by the code + * in ledasm.S. + * + */ #ident "$Id$" -/* function prototypes */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif -void blink_led(void); +#include "led.h" +#include "sa1100.h" -static inline void init_gpio(void); -static inline void led_on(void); -static inline void led_off(void); -static inline void waitloop(void); -static inline void init_gpio(void) -{ - /* GPIO Pin Direction Register */ - register unsigned int *gpdr = (unsigned int *)0x90040004; - - /* bit 23 is the LED */ - *gpdr = 0x00800000; -} - - - +static int led_state; -static inline void led_on(void) -{ - register unsigned int *gpsr = (unsigned int *)0x90040008; - - *gpsr = 0x00800000; -} - -static inline void led_off(void) +void led_on(void) { - register unsigned int *gpcr = (unsigned int *)0x9004000c; - - *gpcr = 0x00800000; + GPSR = LED_GPIO; + led_state = 1; } -static inline void waitloop(void) +void led_off(void) { - __asm__ __volatile__ ( - " mov r4, #0x8000\n" - "0: subs r4, r4, #1\n" - " bne 0b\n"); + GPCR = LED_GPIO; + led_state = 0; } -void blink_led(void) +void led_toggle(void) { - init_gpio(); - - for(;;) - { - led_on(); - waitloop(); - led_off(); - waitloop(); - } + if(led_state) + led_off(); + else + led_on(); } Index: ledasm.S =================================================================== RCS file: /cvsroot/blob/blob/src/Attic/ledasm.S,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- ledasm.S 2001/07/17 14:18:38 1.1.2.4 +++ ledasm.S 2001/07/22 22:54:26 1.1.2.5 @@ -32,31 +32,22 @@ # include <config.h> #endif +#define ASSEMBLY +#include "led.h" .text -#if defined ASSABET -LED: .long 0x00020000 /* GPIO 17 */ -#elif (defined CLART) || (defined LART) || (defined NESA) -LED: .long 0x00800000 /* GPIO 23 */ -#elif defined PLEB -LED: .long 0x00010000 /* GPIO 16 */ -#else -#warning "FIXME: Include code to turn on one of the LEDs on your board" -LED: .long 0x00000000 /* safe mode: no GPIO, so no LED */ -#endif - - - +LED: .long LED_GPIO GPIO_BASE: .long 0x90040000 #define GPDR 0x00000004 #define GPSR 0x00000008 #define GPCR 0x0000000c - - - + + + + .globl ledinit /* initialise LED GPIO and turn LED on. * clobbers r0 and r1 Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/main.c,v retrieving revision 1.1.1.1.2.8 retrieving revision 1.1.1.1.2.9 diff -u -r1.1.1.1.2.8 -r1.1.1.1.2.9 --- main.c 2001/07/20 18:39:03 1.1.1.1.2.8 +++ main.c 2001/07/22 22:54:26 1.1.1.1.2.9 @@ -12,8 +12,9 @@ /* * main.c: main file for the blob bootloader * - * Copyright (C) 1999 Jan-Derk Bakker (J.D...@it...) and - * Erik Mouw (J.A...@it...) + * Copyright (C) 1999 2000 2001 + * Jan-Derk Bakker (J.D...@it...) and + * Erik Mouw (J.A...@it...) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,16 +41,15 @@ #include "clock.h" #include "command.h" #include "flash.h" +#include "led.h" +#include "main.h" +#include "memory.h" +#include "sa1100.h" #include "serial.h" #include "time.h" -#include "main.h" #include "util.h" #include "uucodec.h" -/* Tell SA-1100.h to shut up; we're including it anyway. Nyah nyah ;-) */ -#define __ASM_ARCH_HARDWARE_H -#include <asm/arch-sa1100/SA-1100.h> - typedef enum { @@ -106,6 +106,11 @@ blobStatus status; int i; int retval = 0; + + /* Turn the LED on again, so we can see that we safely made it + * into C code. + */ + led_on(); /* We really want to be able to communicate, so initialise the * serial port at 9k6 (which works good for terminals) @@ -127,6 +132,9 @@ SerialOutputString("under certain conditions; " "read the GNU GPL for details.\n\n"); + + /* get the amount of memory */ + get_memory_map(); /* initialise status */ status.kernelSize = 0; Index: serial.c =================================================================== RCS file: /cvsroot/blob/blob/src/serial.c,v retrieving revision 1.1.1.1.2.2 retrieving revision 1.1.1.1.2.3 diff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 --- serial.c 2001/07/20 18:39:03 1.1.1.1.2.2 +++ serial.c 2001/07/22 22:54:26 1.1.1.1.2.3 @@ -11,7 +11,7 @@ /* * serial.c: Serial utilities for blob * - * Copyright (C) 1999 Erik Mouw (J.A...@it...) + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A...@it...) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,10 +35,8 @@ # include "config.h" #endif -/* Tell SA-1100.h to shut up; we're including it anyway. Nyah nyah ;-) */ -#define __ASM_ARCH_HARDWARE_H -#include <asm/arch-sa1100/SA-1100.h> - +#include "led.h" +#include "sa1100.h" #include "serial.h" #include "time.h" @@ -224,21 +222,17 @@ SerialOutputByte('#'); else if(err & UTSR1_ROR) SerialOutputByte('$'); -#if 0 - else - SerialOutputByte(*c); -#endif /* We currently only care about framing and parity errors */ if((err & (UTSR1_PRE | UTSR1_FRE)) != 0) { return SerialInputByte(c); - } - else + } else { + led_toggle(); return(1); - } - else { - /* no bit ready */ - return(0); + } + } else { + /* no bit ready */ + return(0); } } /* SerialInputByte */ Index: start.S =================================================================== RCS file: /cvsroot/blob/blob/src/start.S,v retrieving revision 1.1.1.1.2.10 retrieving revision 1.1.1.1.2.11 diff -u -r1.1.1.1.2.10 -r1.1.1.1.2.11 --- start.S 2001/07/18 23:49:41 1.1.1.1.2.10 +++ start.S 2001/07/22 22:54:26 1.1.1.1.2.11 @@ -179,6 +179,12 @@ ble copy_loop + /* turn off the LED. if it stays off it is an indication that + * we didn't make it into the C code + */ + bl led_off + + /* set up the stack pointer */ ldr r0, MEM_START add r1, r0, #(1024 * 1024) Index: time.c =================================================================== RCS file: /cvsroot/blob/blob/src/time.c,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.1.1.1.2.2 diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- time.c 2001/07/20 18:39:03 1.1.1.1.2.1 +++ time.c 2001/07/22 22:54:26 1.1.1.1.2.2 @@ -11,7 +11,7 @@ /* * timer.c: Timer functions for blob * - * Copyright (C) 1999 Erik Mouw (J.A...@it...) + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A...@it...) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,10 +35,8 @@ # include "config.h" #endif -/* Tell SA-1100.h to shut up; we're including it anyway. Nyah nyah ;-) */ -#define __ASM_ARCH_HARDWARE_H -#include <asm/arch-sa1100/SA-1100.h> - +#include "led.h" +#include "sa1100.h" #include "time.h" @@ -76,8 +74,16 @@ /* returns the time in 1/TICKS_PER_SECOND seconds */ u32 TimerGetTime(void) { + /* turn LED always on after one second so the user knows that + * the board is on + */ + if((OSCR % TICKS_PER_SECOND) < (TICKS_PER_SECOND >>7)) + led_on(); + return((u32) OSCR); } + + int TimerDetectOverflow(void) |