Date: Tue, 18 Apr 2006 04:41:19 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95475 for review Message-ID: <200604180441.k3I4fJ4n028102@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95475 Change 95475 by imp@imp_hammer on 2006/04/18 04:41:17 Move eeprom goo to the library. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/eeprom.c#7 delete .. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/eeprom.h#3 delete .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#3 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/eeprom.c#1 branch .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/eeprom.h#1 branch .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#5 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/Makefile#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/arm_init.s#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/array_bytes.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/at91rm9200_lowlevel.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/at91rm9200_lowlevel.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/debug_io.c#3 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/debug_io.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/eeprom.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/eeprom.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/emac.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/emac.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/flash.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/flash.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/irda.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/lcd.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/lcd.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/led.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/led.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/linker.cfg#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/main.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/ohci.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/p_string.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/p_string.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/processor.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/processor.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/prompt.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/prompt.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/spi_flash.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/spi_flash.h#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/stage1.bin#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/test_uhp.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/twsi.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/xmodem.c#2 edit .. //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/xmodem.h#2 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#3 (text+ko) ==== @@ -2,7 +2,7 @@ LIB= at91 INTERNALLIB= -SRCS=at91rm9200_lowlevel.c getc.c putchar.c printf.c xmodem.c +SRCS=at91rm9200_lowlevel.c eeprom.c getc.c putchar.c printf.c xmodem.c NO_MAN= .include <bsd.lib.mk> ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#5 (text) ==== @@ -29,7 +29,15 @@ int getc(int); void putchar(int); +void printf(const char *fmt,...); + +/* The following function write eeprom at ee_addr using data */ +/* from data_add for size bytes. */ +void ReadEEPROM(unsigned ee_addr, char *data_addr, unsigned size); +void WriteEEPROM(unsigned ee_addr, char *data_addr, unsigned size); +void InitEEPROM(void); + +/* XMODEM protocol */ int xmodem_rx(char *dst); -void printf(const char *fmt,...); #endif ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/Makefile#2 (text+ko) ==== @@ -1,97 +1,13 @@ -#/****************************************************************************** -# * -# * Filename: Makefile -# * -# * Classic makefile intended for use in gnu environment. The entries listed -# * here are intentionally simple to aid the novice user in his/her own -# * development - for easy modification. -# * -# * Revision information: -# * -# * 20SEP2004 kb_admin initial creation -# * -# * BEGIN_KBDD_BLOCK -# * No warranty, expressed or implied, is included with this software. It is -# * provided "AS IS" and no warranty of any kind including statutory or aspects -# * relating to merchantability or fitness for any purpose is provided. All -# * intellectual property rights of others is maintained with the respective -# * owners. This software is not copyrighted and is intended for reference -# * only. -# * END_BLOCK -# ****************************************************************************** -# +# $FreeBSD: src/sys/boot/arm/at91/boot0/Makefile,v 1.1 2006/04/12 21:22:44 imp Exp $ -SHELL = /bin/sh +P=bootiic +FILES=${P} +SRCS=arm_init.s main.c eeprom.c \ + env_vars.c loader_prompt.c p_string.c emac.c \ + flash.c test_uhp.c twsi.c idra.c spi_flash.c processor.c lcd.c \ + led.c prompt.c +NO_MAN= +LDFLAGS=-e 0 -T linker.cfg +OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -basetoolsdir = /usr/local/arm -bindir = ${basetoolsdir}/bin -libdir = ${basetoolsdir}/lib/gcc/arm-linux/3.4.2 - -CC = cc ${CFLAGS} -AS = as -LD = ld -OBJCOPY = objcopy -CFLAGS=-O2 -mcpu=arm9 -ffreestanding - -CFILES = main.o debug_io.o at91rm9200_lowlevel.o p_string.o xmodem.o eeprom.o flash.o emac.o test_uhp.o twsi.o irda.o spi_flash.o processor.o lcd.o led.o prompt.o -ASFILES = arm_init.o -LIBS=divdi3.o qdivrem.o udivdi3.o divsi3.o moddi3.o umoddi3.o - - -ramMonitor: ${CFILES} ${ASFILES} ${LIBS} - ${LD} -e 0 -o ramMonitor.out -T linker.cfg ${ASFILES} ${CFILES} ${LIBS} - ${OBJCOPY} -O binary ramMonitor.out ramMonitor.bin - -main.o: main.c - ${CC} -c $? - -debug_io.o: debug_io.c - ${CC} -c $? - -at91rm9200_lowlevel.o: at91rm9200_lowlevel.c - ${CC} -c $? - -prompt.o: prompt.c - ${CC} -c $? - -p_string.o: p_string.c - ${CC} -c $? - -xmodem.o: xmodem.c - ${CC} -c $? - -eeprom.o: eeprom.c - ${CC} -c $? - -flash.o: flash.c - ${CC} -c $? - -emac.o: emac.c - ${CC} -c $? - -test_uhp.o: test_uhp.c - ${CC} -c $? - -twsi.o: twsi.c - ${CC} -c $? - -irda.o: irda.c - ${CC} -c $? - -spi_flash.o: spi_flash.c - ${CC} -c $? - -processor.o: processor.c - ${CC} -c $? - -lcd.o: lcd.c - ${CC} -c $? - -led.o: led.c - ${CC} -c $? - -arm_init.o: arm_init.s - ${AS} -o $@ $? - -clean: - rm -f *.o +.include <bsd.prog.mk> ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/arm_init.s#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/array_bytes.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/at91rm9200_lowlevel.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/at91rm9200_lowlevel.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/debug_io.c#3 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/debug_io.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/eeprom.c#2 (text+ko) ==== @@ -48,8 +48,9 @@ * This function does not utilize the page read mode to simplify the code. * .KB_C_FN_DEFINITION_END */ -void ReadEEPROM(unsigned ee_addr, char *data_addr, unsigned size) { - +void +ReadEEPROM(unsigned ee_addr, char *data_addr, unsigned size) +{ const AT91PS_TWI twiPtr = AT91C_BASE_TWI; unsigned int status; ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/eeprom.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/emac.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/emac.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/flash.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/flash.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/irda.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/lcd.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/lcd.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/led.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/led.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/linker.cfg#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/main.c#2 (text+ko) ==== @@ -22,15 +22,21 @@ * END_BLOCK ******************************************************************************/ +#include "at91rm9200_lowlevel.h" #include "debug_io.h" -#include "at91rm9200_lowlevel.h" -#include "prompt.h" #include "eeprom.h" +#include "emac.h" #include "flash.h" -#include "spi_flash.h" +#include "irda.h" #include "lcd.h" #include "led.h" - +#include "lib.h" +#include "prompt.h" +#include "processor.h" +#include "spi_flash.h" +#include "twsi.h" +#include "uhp.h" +#include "xmodem_cmd.h" /* * .KB_C_FN_DEFINITION_START @@ -39,9 +45,10 @@ * services all future requests. * .KB_C_FN_DEFINITION_END */ -int main(void) { - - DebugPrint("\n\rEntry: RAM Monitor v1.3.0\n\r"); +int +main(void) +{ + printf("\r\nEntry: RAM Monitor v1.3.0\r\n"); InitPrompt(); ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/ohci.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/p_string.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/p_string.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/processor.c#2 (text+ko) ==== @@ -21,6 +21,7 @@ #include "processor.h" #include "AT91RM9200.h" #include "prompt.h" +#include "lib.h" /* ****************************** GLOBALS *************************************/ @@ -41,6 +42,76 @@ /* * .KB_C_FN_DEFINITION_START + * void ReadMem(unsigned address, unsigned length, unsigned size) + * This global function displays a block of memory in size increments. + * .KB_C_FN_DEFINITION_END + */ +static void +ReadMem(unsigned address, unsigned length, unsigned size) +{ + unsigned i, perLine, v; + + perLine = 16 / size; + + while (length) { + i = perLine; + + if (length < 16) { + i = (length/size); + length = 0; + } else { + length -= 16; + } + + printf("\r\n(R)0x%x : ", address); + + while (i--) { + switch (size) { + case 1: + v = *(unsigned char*)address; + address += 1; + break; + case 2: + v = *(unsigned short*)address; + address += 2; + break; + case 4: + v = *(unsigned*)address; + address += 4; + break; + default: + return ; + } + printf("0x%x ", v); + } + } +} + + +/* + * .KB_C_FN_DEFINITION_START + * void WriteMem(unsigned address, unsigned size, unsigned value) + * This global function writes value at address using size width. + * .KB_C_FN_DEFINITION_END + */ +static void +WriteMem(unsigned address, unsigned size, unsigned value) +{ + switch(size) { + case 1: + *(char*)address = (char)(value & 0xFF); + break; + case 2: + *(unsigned short*)address = (unsigned short)(value & 0xFFFF); + break; + case 4: + *(unsigned*)address = value; + break; + } +} + +/* + * .KB_C_FN_DEFINITION_START * int compare_parse(int argc, char *argv[]) * This global function parses text from the command line. * .KB_C_FN_DEFINITION_END ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/processor.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/prompt.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/prompt.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/spi_flash.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/spi_flash.h#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/stage1.bin#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/test_uhp.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/twsi.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/xmodem.c#2 (text+ko) ==== ==== //depot/projects/arm/src/sys/boot/arm/at91/ramMonitor/xmodem.h#2 (text+ko) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604180441.k3I4fJ4n028102>