From de4a08fdd087b005de9aa1a1dac453784014e1fc Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 19 Oct 2009 13:00:47 +0200 Subject: remove unused directory tools Signed-off-by: Sascha Hauer --- tools/Makefile | 216 ---------- tools/Makefile.win32 | 37 -- tools/bddb/README | 116 ------ tools/bddb/badsubmit.php | 23 -- tools/bddb/bddb.css | 207 ---------- tools/bddb/brlog.php | 109 ----- tools/bddb/browse.php | 147 ------- tools/bddb/config.php | 16 - tools/bddb/create_tables.sql | 90 ----- tools/bddb/defs.php | 710 -------------------------------- tools/bddb/dodelete.php | 65 --- tools/bddb/dodellog.php | 57 --- tools/bddb/doedit.php | 186 --------- tools/bddb/doedlog.php | 76 ---- tools/bddb/donew.php | 230 ----------- tools/bddb/donewlog.php | 86 ---- tools/bddb/edit.php | 131 ------ tools/bddb/edlog.php | 86 ---- tools/bddb/execute.php | 33 -- tools/bddb/index.php | 38 -- tools/bddb/new.php | 120 ------ tools/bddb/newlog.php | 54 --- tools/bmp_logo.c | 165 -------- tools/easylogo/Makefile | 2 - tools/easylogo/easylogo.c | 422 ------------------- tools/easylogo/linux_logo.tga | Bin 19244 -> 0 bytes tools/easylogo/runme.sh | 4 - tools/env/Makefile | 48 --- tools/env/README | 44 -- tools/env/fw_env.c | 768 ----------------------------------- tools/env/fw_env.config | 7 - tools/env/fw_env.h | 54 --- tools/env/fw_env_main.c | 78 ---- tools/envcrc.c | 99 ----- tools/gdb/Makefile | 77 ---- tools/gdb/error.c | 81 ---- tools/gdb/error.h | 30 -- tools/gdb/gdbcont.c | 87 ---- tools/gdb/gdbsend.c | 137 ------- tools/gdb/remote.c | 916 ------------------------------------------ tools/gdb/remote.h | 28 -- tools/gdb/serial.c | 149 ------- tools/gdb/serial.h | 34 -- tools/gen_eth_addr.c | 50 --- tools/img2brec.sh | 388 ------------------ tools/img2srec.c | 413 ------------------- tools/inca-swap-bytes.c | 38 -- tools/logos/denx.bmp | Bin 15538 -> 0 bytes tools/mpc86x_clk.c | 218 ---------- tools/ncb.c | 36 -- tools/scripts/README | 67 --- tools/scripts/dot.kermrc | 16 - tools/scripts/flash_param | 60 --- tools/scripts/send_cmd | 21 - tools/scripts/send_image | 26 -- tools/setlocalversion | 22 - 56 files changed, 7418 deletions(-) delete mode 100644 tools/Makefile delete mode 100644 tools/Makefile.win32 delete mode 100644 tools/bddb/README delete mode 100644 tools/bddb/badsubmit.php delete mode 100644 tools/bddb/bddb.css delete mode 100644 tools/bddb/brlog.php delete mode 100644 tools/bddb/browse.php delete mode 100644 tools/bddb/config.php delete mode 100644 tools/bddb/create_tables.sql delete mode 100644 tools/bddb/defs.php delete mode 100644 tools/bddb/dodelete.php delete mode 100644 tools/bddb/dodellog.php delete mode 100644 tools/bddb/doedit.php delete mode 100644 tools/bddb/doedlog.php delete mode 100644 tools/bddb/donew.php delete mode 100644 tools/bddb/donewlog.php delete mode 100644 tools/bddb/edit.php delete mode 100644 tools/bddb/edlog.php delete mode 100644 tools/bddb/execute.php delete mode 100644 tools/bddb/index.php delete mode 100644 tools/bddb/new.php delete mode 100644 tools/bddb/newlog.php delete mode 100644 tools/bmp_logo.c delete mode 100644 tools/easylogo/Makefile delete mode 100644 tools/easylogo/easylogo.c delete mode 100644 tools/easylogo/linux_logo.tga delete mode 100644 tools/easylogo/runme.sh delete mode 100644 tools/env/Makefile delete mode 100644 tools/env/README delete mode 100644 tools/env/fw_env.c delete mode 100644 tools/env/fw_env.config delete mode 100644 tools/env/fw_env.h delete mode 100644 tools/env/fw_env_main.c delete mode 100644 tools/envcrc.c delete mode 100644 tools/gdb/Makefile delete mode 100644 tools/gdb/error.c delete mode 100644 tools/gdb/error.h delete mode 100644 tools/gdb/gdbcont.c delete mode 100644 tools/gdb/gdbsend.c delete mode 100644 tools/gdb/remote.c delete mode 100644 tools/gdb/remote.h delete mode 100644 tools/gdb/serial.c delete mode 100644 tools/gdb/serial.h delete mode 100644 tools/gen_eth_addr.c delete mode 100755 tools/img2brec.sh delete mode 100644 tools/img2srec.c delete mode 100644 tools/inca-swap-bytes.c delete mode 100644 tools/logos/denx.bmp delete mode 100644 tools/mpc86x_clk.c delete mode 100644 tools/ncb.c delete mode 100644 tools/scripts/README delete mode 100644 tools/scripts/dot.kermrc delete mode 100644 tools/scripts/flash_param delete mode 100644 tools/scripts/send_cmd delete mode 100644 tools/scripts/send_image delete mode 100755 tools/setlocalversion diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index 6177f90271..0000000000 --- a/tools/Makefile +++ /dev/null @@ -1,216 +0,0 @@ -# -# (C) Copyright 2000-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# 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 -# - -BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) - -OBJ_LINKS = environment.o crc32.o -OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o - -ifeq ($(ARCH),mips) -BIN_FILES += inca-swap-bytes$(SFX) -OBJ_FILES += inca-swap-bytes.o -endif - -# Don't build by default -#ifeq ($(ARCH),ppc) -#BIN_FILES += mpc86x_clk$(SFX) -#OBJ_FILES += mpc86x_clk.o -#endif - -LOGO_H = $(OBJTREE)/include/bmp_logo.h - -ifeq ($(LOGO_BMP),) -LOGO_BMP= logos/denx.bmp -endif - -#------------------------------------------------------------------------- - -HOSTARCH := $(shell uname -m | \ - sed -e s/i.86/i386/ \ - -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ \ - -e s/sa110/arm/ \ - -e s/powerpc/ppc/ \ - -e s/Power\ Macintosh/ppc/ \ - -e s/macppc/ppc/) - -HOSTOS := $(shell uname -s | tr A-Z a-z | \ - sed -e 's/\(cygwin\).*/cygwin/') - -TOOLSUBDIRS = - -# -# Mac OS X / Darwin's C preprocessor is Apple specific. It -# generates numerous errors and warnings. We want to bypass it -# and use GNU C's cpp. To do this we pass the -traditional-cpp -# option to the compiler. Note that the -traditional-cpp flag -# DOES NOT have the same semantics as GNU C's flag, all it does -# is invoke the GNU preprocessor in stock ANSI/ISO C fashion. -# -# Apple's linker is similar, thanks to the new 2 stage linking -# multiple symbol definitions are treated as errors, hence the -# -multiply_defined suppress option to turn off this error. -# -ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc) -HOST_CFLAGS = -traditional-cpp -Wall -HOST_LDFLAGS =-multiply_defined suppress -HOST_ENVIRO_CFLAGS = -traditional-cpp - -else -ifeq ($(HOSTOS)-$(HOSTARCH),netbsd-ppc) -HOST_CFLAGS = -Wall -pedantic -HOST_LDFLAGS = -HOST_ENVIRO_CFLAGS = - -# -# Everyone else -# -else -HOST_CFLAGS = -Wall -pedantic -HOST_LDFLAGS = -HOST_ENVIRO_CFLAGS = -endif -endif - -# -# Cygwin needs .exe files :-( -# -ifeq ($(HOSTOS),cygwin) -SFX = .exe -else -SFX = -endif - -# -# Include this after HOSTOS HOSTARCH check -# so that we can act intelligently. -# -include $(TOPDIR)/config.mk - -# now $(obj) is defined -SRCS := $(addprefix $(obj),$(OBJ_LINKS:.o=.c)) $(OBJ_FILES:.o=.c) -BINS := $(addprefix $(obj),$(BIN_FILES)) - -# -# Use native tools and options -# -CPPFLAGS = -idirafter $(SRCTREE)/include \ - -idirafter $(OBJTREE)/include2 \ - -idirafter $(OBJTREE)/include \ - -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC -CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O -AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS) -CC = $(HOSTCC) -STRIP = $(HOSTSTRIP) -MAKEDEPEND = makedepend - -all: $(obj).depend $(BINS) $(LOGO_H) subdirs - -$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)environment.o - $(CC) $(CFLAGS) -o $@ $^ - -$(obj)img2srec$(SFX): $(obj)img2srec.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)ncb$(SFX): $(obj)ncb.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)gen_eth_addr$(SFX): $(obj)gen_eth_addr.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)bmp_logo$(SFX): $(obj)bmp_logo.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -$(obj)envcrc.o: $(src)envcrc.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -$(obj)crc32.o: $(obj)crc32.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -$(obj)mkimage.o: $(src)mkimage.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -$(obj)ncb.o: $(src)ncb.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -$(obj)gen_eth_addr.o: $(src)gen_eth_addr.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -$(obj)inca-swap-bytes.o: $(src)inca-swap-bytes.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -$(obj)mpc86x_clk.o: $(src)mpc86x_clk.c - $(CC) -g $(CFLAGS) -c -o $@ $< - -subdirs: -ifeq ($(TOOLSUBDIRS),) - @: -else - @for dir in $(TOOLSUBDIRS) ; do \ - $(MAKE) \ - HOSTOS=$(HOSTOS) \ - HOSTARCH=$(HOSTARCH) \ - HOST_CFLAGS="$(HOST_CFLAGS)" \ - HOST_LDFLAGS="$(HOST_LDFLAGS)" \ - -C $$dir || exit 1 ; \ - done -endif - -$(obj)environment.c: - @rm -f $(obj)environment.c - ln -s $(src)../common/environment.c $(obj)environment.c - -$(obj)environment.o: $(obj)environment.c - $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $< - -$(obj)crc32.c: - @rm -f $(obj)crc32.c - ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c - -$(LOGO_H): $(obj)bmp_logo $(LOGO_BMP) - $(obj)./bmp_logo $(LOGO_BMP) >$@ - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/tools/Makefile.win32 b/tools/Makefile.win32 deleted file mode 100644 index 69dc44c6b5..0000000000 --- a/tools/Makefile.win32 +++ /dev/null @@ -1,37 +0,0 @@ -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# 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 -# - -CPPFLAGS = -Wall -pedantic -I../include -I.. -D__WIN32__ -CFLAGS = $(CPPFLAGS) -O - -all: mkimage.exe - -mkimage.exe: mkimage.o crc32.o - $(CC) -g $(CFLAGS) -o $@ $^ - -crc32.o: crc32.c - $(CC) -g $(CFLAGS) -c $< - -mkimage.o: mkimage.c - $(CC) -g $(CFLAGS) -c $< - diff --git a/tools/bddb/README b/tools/bddb/README deleted file mode 100644 index 9bee59a0fe..0000000000 --- a/tools/bddb/README +++ /dev/null @@ -1,116 +0,0 @@ -Hymod Board Database - -(C) Copyright 2001 -Murray Jensen -CSIRO Manufacturing Science and Technology, Preston Lab - -25-Jun-01 - -This stuff is a set of PHP/MySQL scripts to implement a custom board -database. It will need *extensive* hacking to modify it to keep the -information about your custom boards that you want, however it is a good -starting point. - -How it is used: - - 1. a board has gone through all the hardware testing etc and is - ready to have the flash programmed for the first time - first you - go to a web page and fill in information about the board in a form - to register it in a database - - 2. the web stuff allocates a (unique) serial number and (optionally) - a (locally administered) ethernet address and stores the information - in a database using the serial number as the key (can do whole - batches of boards in one go and/or use a previously registered board - as defaults for the new board(s)) - - 3. it then creates a file in the tftp area of a server somewhere - containing the board information in a simple text format (one - per serial number) - - 4. all hymod boards have an i2c eeprom, and when U-Boot sees that - the eeprom is unitialised, it prompts for a serial number and - ethernet address (if not set), then transfers the file created - in step 3 from the server and initialises the eeprom from its - contents - -What this means is you can't boot the board until you have allocated a serial -number, but you don't have to type it all twice - you do it once on the web -and the board then finds the info it needs to initialise its eeprom. The -other side of the coin is the reading of the eeprom and how it gets passed -to Linux (or another O/S). - -To see how this is all done for the hymod boards look at the code in the -"board/hymod" directory and in the file "include/asm/hymod.h". Hymod boards -can have a mezzanine card which also have an eeprom that needs allocating, -the same process is used for these as well - just a different i2c address. - -Other forms provide the following functions: - - - browsing the board database - - editing board information (one at a time) - - maintaining/browsing a (simple) per board event log - -You will need: MySQL (I use version 3.23.7-alpha), PHP4 (with MySQL -support enabled) and a web server (I use Apache 1.3.x). - -I originally started by using phpMyBuilder (http://kyber.dk/phpMyBuilder) -but it soon got far more complicated than that could handle (but I left -the copyright messages in there anyway). Most of the code resides in the -common defs.php file, which shouldn't need much alteration - all the work -will be in shaping the front-end php files to your liking. - -Here's a quick summary of what needs doing to use it for your boards: - -1. get phpMyAdmin (http://phpwizard.net/projects/phpMyAdmin/) - it's an - invaluable tool for this sort of stuff (this step is optional of course) - -2. edit "bddb.css" to your taste, if you could be bothered - I have no - idea what is in there or what it does - I copied it from somewhere else - ("user.css" from the phpMyEdit (http://phpmyedit.sourcerforge.net) package, - I think) - I figure one day I'll see what sort of things I can change - in there. - -3. create a mysql database - call it whatever you like - -4. edit "create_tables.sql" and modify the "boards" table schema to - reflect the information you want to keep about your boards. It may or - may not be easier to do this and the next step in phpMyAdmin. Check out - the MySQL documentation at http://www.mysql.com/doc/ in particular the - column types at http://www.mysql.com/doc/C/o/Column_types.html - Note - there is only support for a few data types: - - int - presented as an html text input - char/text - presented as an html text input - date - presented as an html text input - enum - presented as an html radio input - - I also have what I call "enum_multi" which is a set of enums with the - same name, but suffixed with a number e.g. fred0, fred1, fred2. These - are presented as a number of html select's with a single label "fred" - this is useful for board characteristics that have multiple items of - the same type e.g. multiple banks of sdram. - -5. use the "create_tables.sql" file to create the "boards" table in the - database e.g. mysql dbname < create_tables.sql - -6. create a user and password for the web server to log into the MySQL - database with; give this user select, insert and update privileges - to the database created in 3 (and delete, if you want the "delete" - functions in the edit forms to work- I have this turned off). phpMyAdmin - helps in this step. - -7. edit "config.php" and set the variables: $mysql_user, $mysql_pw, $mysql_db, - $bddb_cfgdir and $bddb_label - keep the contents of this file secret - it - contains the web servers username and password (the three $mysql_* vars - are set from the previous step) - -8. edit "defs.php" and a. adjust the various enum value arrays and b. edit - the function "pg_foot()" to remove my email address :-) - -9. do major hacking on the following files: browse.php, doedit.php, donew.php, - edit.php and new.php to reflect your database schema - fortunately the - hacking is fairly straight-forward, but it is boring and time-consuming. - -These notes were written rather hastily - if you find any obvious problems -please let me know. diff --git a/tools/bddb/badsubmit.php b/tools/bddb/badsubmit.php deleted file mode 100644 index 5092a31969..0000000000 --- a/tools/bddb/badsubmit.php +++ /dev/null @@ -1,23 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - require("defs.php"); - pg_head("$bddb_label - Unknown Submit Type"); -?> -
- - - The form was submitted with an - unknown SUBMIT type . -

- Perhaps you typed the URL in directly? Click here to go to the - home page of the . -
-
-
- diff --git a/tools/bddb/bddb.css b/tools/bddb/bddb.css deleted file mode 100644 index dee2b2ee49..0000000000 --- a/tools/bddb/bddb.css +++ /dev/null @@ -1,207 +0,0 @@ -BODY { - background: #e0ffff; - color: #000000; - font-family: Arial, Verdana, Helvetica; -} -H1 { - font-family: "Copperplate Gothic Bold"; - background: transparent; - color: #993300; - text-align: center; -} -H2, H3, H4, H5 { - background: transparent; - color: #993300; - margin-top: 4%; - text-align: center; -} -Body.Plain Div.Abstract, Body.Plain P.Abstract { - background: #cccc99; - color: #333300; - border: white; - padding: 3%; - font-family: Times, Verdana; -} -TH.Nav { - background: #0000cc; - color: #ff9900; -} -TH.Menu { - background: #3366cc; - color: #ff9900; -} -A:hover { - color: #ff6600; -} -A.Menu:hover { - color: #ff6600; -} -A.HoMe:hover { - color: #ff6600; -} -A.Menu { - background: transparent; - color: #ffcc33; - font-family: Verdana, Helvetica, Arial; - font-size: smaller; - text-decoration: none; -} -A.Menu:visited { - background: transparent; - color: #ffcc99; -} -A.HoMe { - background: transparent; - color: #ffcc33; - font-family: Verdana, Helvetica, Arial; - text-decoration:none; -} -A.HoMe:visited { - background: transparent; - color: #ffcc99; -} -TH.Xmp { - background: #eeeeee; - color: #330066; - font-family: courier; - font-weight: normal; -} -TH.LuT { - background: #cccccc; - color: #000000; -} -TD.LuT { - background: #ffffcc; - color: #000000; - font-size: 85%; -} -TH.Info, TD.Info { - background: #ffffcc; - color: #660000; - font-family: "Comic Sans MS", Cursive, Verdana; - font-size: smaller; -} -Div.Info, P.Info { - background: #ffff99; - color: #990033; - text-align: left; - padding: 2%; - font-family: "Comic Sans MS", Cursive, Verdana; - font-size: 85%; - } -Div.Info A { - background: transparent; - color: #ff6600; -} -.HL { - background: #ffff99; - color: #000000; -} -TD.HL { - background: #ccffff; - color: #000000; -} -Div.Margins { - width: 512px; - text-align: center; -} -TD.Plain { - background: #ffffcc; - color: #000033; -} -.Type { - background: #cccccc; - color: #660000; -} -.Name { - background: #eeeeee; - color: #660000; - vertical-align: top; - text-align: right; -} -.Value { - background: #ffffee; - color: #000066; -} -.Drop { - background: #333366; - color: #ffcc33; - font-family: "Copperplate Gothic Light", Helvetica, Verdana, Arial; -} -A.Button:hover { - color: #ff6600; -} -A.Button { - text-decoration:none; - color: #003366; - background: #ffcc66; -} -.Button { - font-size: 9pt; - text-align: center; - text-decoration:none; - color: #003366; - background: #ffcc66; - margin-bottom: 2pt; - border-top: 2px solid #ffff99; - border-left: 2px solid #ffff99; - border-right: 2px solid #cc9933; - border-bottom: 2px solid #cc9933; - font-family: Verdana, Arial, "Comic Sans MS"; -} -.Banner { - width: 468; - font-size: 12pt; - text-align: center; - text-decoration:none; - color: #003366; - background: #ffcc66; - border-top: 4px solid #ffff99; - border-left: 4px solid #ffff99; - border-right: 4px solid #cc9933; - border-bottom: 4px solid #cc9933; - font-family: Verdana, Arial, "Comic Sans MS"; -} -TD.Nova, Body.Nova { - background: #000000; - font-family: "Times New Roman"; - font-weight: light; - color: #ffcc00; -} -Body.Nova A.Button { - background: gold; - color: #003366; -} -Body.Nova A.Banner { - background: transparent; - color: #003366; -} -Body.Nova A { - background: transparent; - text-decoration:none; - color: #ffd766; -} -Body.Nova H1, Body.Nova H2, Body.Nova H3, Body.Nova H4 { - background: transparent; - color: white; - margin-top: 4%; - text-align: center; - filter: Blur(Add=1, Direction=0, Strength=8); -} -Body.Nova Div.Abstract { - background: #000000; - color: #ffffff; - font-family: Times, Verdana; -} -Body.Nova A.Abstract { - background: transparent; - color: #ffeedd; -} -Body.Nova TH.LuT { - background: black; - color: #ffff99; -} -Body.Nova TD.LuT { - background: navy; - color: #ffff99; -} diff --git a/tools/bddb/brlog.php b/tools/bddb/brlog.php deleted file mode 100644 index fccfbd011c..0000000000 --- a/tools/bddb/brlog.php +++ /dev/null @@ -1,109 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // list page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Browse Board Log"); - - $serno=intval($serno); - if ($serno == 0) - die("serial number not specified or invalid!"); - - function print_cell($str) { - if ($str == '') - $str = ' '; - echo "\t$str\n"; - } -?> - - - - - - - - - - -\n"; - print_cell("$row[serno]"); - print_cell($row['ethaddr']); - print_cell($row['date']); - print_cell($row['batch']); - print_cell($row['type']); - print_cell($row['rev']); - print_cell($row['location']); - echo "\n"; - } - - mysql_free_result($r); -?> -
serno / editethaddrdatebatchtyperevlocation
-
-

-$limit){ - $preoffset=max(0,$offset-$limit); - $postoffset=$offset+$limit; - echo "\n\n"; - printf("\n", $offset>0?"":"no", $PHP_SELF, $preoffset); - printf("\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset); - echo "\n
<%sa href=\"%s?submit=Log&serno=$serno&offset=%d\">\"<\"<%sa href=\"%s?submit=Log&serno=$serno&offset=%d\">\">\"
\n"; - } - mysql_free_result($lr); -?> - - - - - - - -\n"; - print_cell("$row[logno]"); - print_cell($row['date']); - print_cell($row['who']); - print_cell("
" . urldecode($row['details']) . "
"); - echo "\n"; - } - - mysql_free_result($r); -?> -
logno / editdatewhodetails
-
-

- - - - - -
- ">Add to Log - - Back to Start -
- diff --git a/tools/bddb/browse.php b/tools/bddb/browse.php deleted file mode 100644 index 675dfab749..0000000000 --- a/tools/bddb/browse.php +++ /dev/null @@ -1,147 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // list page (hymod_bddb / boards) - - require("defs.php"); - - $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:''; - - $verbose=isset($_REQUEST['verbose'])?intval($_REQUEST['verbose']):0; - - pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":"")); -?> -

-$limit){ - $preoffset=max(0,$offset-$limit); - $postoffset=$offset+$limit; - echo "\n\n"; - printf("\n", $offset>0?"":"no", $PHP_SELF, $preoffset, $verbose); - printf("\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset, $offset); - echo "\n
<%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\">\"<\"<%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\">\">\"
\n"; - } - - mysql_free_result($lr); - } -?> - - - - - - - - - - -comments\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } -?> - -=$m[1] and serno<=$m[2])"; - } - else - die("illegal serial number ($s)"); - $pre = " or "; - } - } - $query .= " order by serno"; - if ($serno == '') - $query .= " limit $offset,$limit"; - - $r = mysql_query($query); - - function print_cell($str) { - if ($str == '') - $str = ' '; - echo "\t\n"; - } - - while($row=mysql_fetch_array($r)){ - foreach ($columns as $key) { - if (!key_in_array($key, $row)) - $row[$key] = ''; - } - - echo "\n"; - print_cell("Log"); - print_cell("$row[serno]"); - print_cell($row['ethaddr']); - print_cell($row['date']); - print_cell($row['batch']); - print_cell($row['type']); - print_cell($row['rev']); - print_cell($row['location']); - if ($verbose) { - print_cell("
\n" . urldecode($row['comments']) .
-				"\n\t
"); - print_cell(gather_enum_multi_print("sdram", 4, $row)); - print_cell(gather_enum_multi_print("flash", 4, $row)); - print_cell(gather_enum_multi_print("zbt", 16, $row)); - print_cell(gather_enum_multi_print("xlxtyp", 4, $row)); - print_cell(gather_enum_multi_print("xlxspd", 4, $row)); - print_cell(gather_enum_multi_print("xlxtmp", 4, $row)); - print_cell(gather_enum_multi_print("xlxgrd", 4, $row)); - print_cell($row['cputyp']); - print_cell($row['cpuspd']); - print_cell($row['cpmspd']); - print_cell($row['busspd']); - print_cell($row['hstype']); - print_cell($row['hschin']); - print_cell($row['hschout']); - } - echo "\n"; - } -?> -
serno / editethaddrdatebatchtyperevlocationsdramflashzbtxlxtypxlxspdxlxtmpxlxgrdcputypcpuspdcpmspdbusspdhstypehschinhschout
$str
-

- - - - - -
%s Listing\n", $PHP_SELF, $offset, $verbose?0:1, $serno!=''?"&serno=$serno":'', $verbose?"Terse":"Verbose"); - ?>Back to Start
- diff --git a/tools/bddb/config.php b/tools/bddb/config.php deleted file mode 100644 index 67257578f0..0000000000 --- a/tools/bddb/config.php +++ /dev/null @@ -1,16 +0,0 @@ - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // mysql database access info - $mysql_user="fred"; - $mysql_pw="apassword"; - $mysql_db="mydbname"; - - // where to put the eeprom config files - $bddb_cfgdir = '/tftpboot/bddb'; - - // what this database is called - $bddb_label = 'Hymod Board Database'; -?> diff --git a/tools/bddb/create_tables.sql b/tools/bddb/create_tables.sql deleted file mode 100644 index a2a578867f..0000000000 --- a/tools/bddb/create_tables.sql +++ /dev/null @@ -1,90 +0,0 @@ -# phpMyAdmin MySQL-Dump -# http://phpwizard.net/phpMyAdmin/ -# -# Host: localhost Database : hymod_bddb - -# (C) Copyright 2001 -# Murray Jensen -# CSIRO Manufacturing and Infrastructure Technology, Preston Lab - -# -------------------------------------------------------- -# -# Table structure for table 'boards' -# - -DROP TABLE IF EXISTS boards; -CREATE TABLE boards ( - serno int(10) unsigned zerofill NOT NULL auto_increment, - ethaddr char(17), - date date NOT NULL, - batch char(32), - type enum('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY') NOT NULL, - rev tinyint(3) unsigned zerofill NOT NULL, - location char(64), - comments text, - sdram0 enum('32M','64M','128M','256M','512M','1G','2G','4G'), - sdram1 enum('32M','64M','128M','256M','512M','1G','2G','4G'), - sdram2 enum('32M','64M','128M','256M','512M','1G','2G','4G'), - sdram3 enum('32M','64M','128M','256M','512M','1G','2G','4G'), - flash0 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), - flash1 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), - flash2 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), - flash3 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), - zbt0 enum('512K','1M','2M','4M','8M','16M'), - zbt1 enum('512K','1M','2M','4M','8M','16M'), - zbt2 enum('512K','1M','2M','4M','8M','16M'), - zbt3 enum('512K','1M','2M','4M','8M','16M'), - zbt4 enum('512K','1M','2M','4M','8M','16M'), - zbt5 enum('512K','1M','2M','4M','8M','16M'), - zbt6 enum('512K','1M','2M','4M','8M','16M'), - zbt7 enum('512K','1M','2M','4M','8M','16M'), - zbt8 enum('512K','1M','2M','4M','8M','16M'), - zbt9 enum('512K','1M','2M','4M','8M','16M'), - zbta enum('512K','1M','2M','4M','8M','16M'), - zbtb enum('512K','1M','2M','4M','8M','16M'), - zbtc enum('512K','1M','2M','4M','8M','16M'), - zbtd enum('512K','1M','2M','4M','8M','16M'), - zbte enum('512K','1M','2M','4M','8M','16M'), - zbtf enum('512K','1M','2M','4M','8M','16M'), - xlxtyp0 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'), - xlxtyp1 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'), - xlxtyp2 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'), - xlxtyp3 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'), - xlxspd0 enum('6','7','8','4','5','9','10','11','12'), - xlxspd1 enum('6','7','8','4','5','9','10','11','12'), - xlxspd2 enum('6','7','8','4','5','9','10','11','12'), - xlxspd3 enum('6','7','8','4','5','9','10','11','12'), - xlxtmp0 enum('COM','IND'), - xlxtmp1 enum('COM','IND'), - xlxtmp2 enum('COM','IND'), - xlxtmp3 enum('COM','IND'), - xlxgrd0 enum('NORMAL','ENGSAMP'), - xlxgrd1 enum('NORMAL','ENGSAMP'), - xlxgrd2 enum('NORMAL','ENGSAMP'), - xlxgrd3 enum('NORMAL','ENGSAMP'), - cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)','MPC8560'), - cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'), - cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'), - busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'), - hstype enum('AMCC-S2064A','Xilinx-Rockets'), - hschin enum('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'), - hschout enum('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'), - PRIMARY KEY (serno), - KEY serno (serno), - UNIQUE serno_2 (serno) -); - -# -# Table structure for table 'log' -# - -DROP TABLE IF EXISTS log; -CREATE TABLE log ( - logno int(10) unsigned zerofill NOT NULL auto_increment, - serno int(10) unsigned zerofill NOT NULL, - date date NOT NULL, - details text NOT NULL, - PRIMARY KEY (logno), - KEY logno (logno, serno, date), - UNIQUE logno_2 (logno) -); diff --git a/tools/bddb/defs.php b/tools/bddb/defs.php deleted file mode 100644 index b7518e3f79..0000000000 --- a/tools/bddb/defs.php +++ /dev/null @@ -1,710 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // contains mysql user id and password - keep secret - require("config.php"); - - if (isset($_REQUEST['logout'])) { - Header("status: 401 Unauthorized"); - Header("HTTP/1.0 401 Unauthorized"); - Header("WWW-authenticate: basic realm=\"$bddb_label\""); - - echo "" . - "Access to '$bddb_label' Denied" . - "\n"; - echo "



" . - "You must be an Authorised User " . - "to access the '$bddb_label'" . - "

\n
\n"; - exit; - } - - // contents of the various enumerated types - if first item is - // empty ('') then the enum is allowed to be null (ie "not null" - // is not set on the column) - - // all column names in the database table - $columns = array( - 'serno','ethaddr','date','batch', - 'type','rev','location','comments', - 'sdram0','sdram1','sdram2','sdram3', - 'flash0','flash1','flash2','flash3', - 'zbt0','zbt1','zbt2','zbt3','zbt4','zbt5','zbt6','zbt7', - 'zbt8','zbt9','zbta','zbtb','zbtc','zbtd','zbte','zbtf', - 'xlxtyp0','xlxtyp1','xlxtyp2','xlxtyp3', - 'xlxspd0','xlxspd1','xlxspd2','xlxspd3', - 'xlxtmp0','xlxtmp1','xlxtmp2','xlxtmp3', - 'xlxgrd0','xlxgrd1','xlxgrd2','xlxgrd3', - 'cputyp','cpuspd','cpmspd','busspd', - 'hstype','hschin','hschout' - ); - - // board type - $type_vals = array('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY'); - - // Xilinx fpga types - $xlxtyp_vals = array('','XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'); - - // Xilinx fpga speeds - $xlxspd_vals = array('','6','7','8','4','5','9','10','11','12'); - - // Xilinx fpga temperatures (commercial or industrial) - $xlxtmp_vals = array('','COM','IND'); - - // Xilinx fpga grades (normal or engineering sample) - $xlxgrd_vals = array('','NORMAL','ENGSAMP'); - - // CPU types - $cputyp_vals = array('','MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)','MPC8560'); - - // CPU/BUS/CPM clock speeds - $clk_vals = array('','33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'); - - // sdram sizes (nbits array is for eeprom config file) - $sdram_vals = array('','32M','64M','128M','256M','512M','1G','2G','4G'); - $sdram_nbits = array(0,25,26,27,28,29,30,31,32); - - // flash sizes (nbits array is for eeprom config file) - $flash_vals = array('','4M','8M','16M','32M','64M','128M','256M','512M','1G'); - $flash_nbits = array(0,22,23,24,25,26,27,28,29,30); - - // zbt ram sizes (nbits array is for write into eeprom config file) - $zbt_vals = array('','512K','1M','2M','4M','8M','16M'); - $zbt_nbits = array(0,19,20,21,22,23,24); - - // high-speed serial attributes - $hstype_vals = array('','AMCC-S2064A','Xilinx-Rockets'); - $hschin_vals = array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'); - $hschout_vals = array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'); - - // value filters - used when outputting html - function rev_filter($num) { - if ($num == 0) - return "001"; - else - return sprintf("%03d", $num); - } - - function text_filter($str) { - return urldecode($str); - } - - mt_srand(time() | getmypid()); - - // set up MySQL connection - mysql_connect("", $mysql_user, $mysql_pw) || die("cannot connect"); - mysql_select_db($mysql_db) || die("cannot select db"); - - // page header - function pg_head($title) - { - echo "\n\n"; - echo "\n"; - echo "$title\n"; - echo "\n"; - echo "\n"; - echo "

$title

\n"; - echo "
\n"; - } - - // page footer - function pg_foot() - { - echo "
\n"; - echo "
\n
" . - "If you have any problems, email " . - "" . - "Murray Jensen" . - "
\n" . - "
\n" . - "logout\n" . - "
\n"; - echo "

Made with " . - "" . - "Kyber phpMyBuilder

\n"; - echo "\n"; - echo "\n"; - } - - // some support functions - - if (!function_exists('array_search')) { - - function array_search($needle, $haystack, $strict = false) { - - if (is_array($haystack) && count($haystack)) { - - $ntype = gettype($needle); - - foreach ($haystack as $key => $value) { - - if ($value == $needle && (!$strict || - gettype($value) == $ntype)) - return $key; - } - } - - return false; - } - } - - if (!function_exists('in_array')) { - - function in_array($needle, $haystack, $strict = false) { - - if (is_array($haystack) && count($haystack)) { - - $ntype = gettype($needle); - - foreach ($haystack as $key => $value) { - - if ($value == $needle && (!$strict || - gettype($value) == $ntype)) - return true; - } - } - - return false; - } - } - - function key_in_array($key, $array) { - return in_array($key, array_keys($array), true); - } - - function enum_to_index($name, $vals) { - $index = array_search($GLOBALS[$name], $vals); - if ($vals[0] != '') - $index++; - return $index; - } - - // fetch a value from an array - return empty string is not present - function get_key_value($key, $array) { - if (key_in_array($key, $array)) - return $array[$key]; - else - return ''; - } - - function fprintf() { - $n = func_num_args(); - if ($n < 2) - return FALSE; - $a = func_get_args(); - $fp = array_shift($a); - $x = "\$s = sprintf"; - $sep = '('; - foreach ($a as $z) { - $x .= "$sep'$z'"; - $sep = ','; - } - $x .= ');'; - eval($x); - $l = strlen($s); - $r = fwrite($fp, $s, $l); - if ($r != $l) - return FALSE; - else - return TRUE; - } - - // functions to display (print) a database table and its columns - - function begin_table($ncols) { - global $table_ncols; - $table_ncols = $ncols; - echo "\n"; - } - - function begin_field($name, $span = 0) { - global $table_ncols; - echo "\n"; - echo "\t\n"; - if ($span <= 0) - $span = $table_ncols - 1; - if ($span > 1) - echo "\t\n"; - if ($span > 1) - echo "\t\n"; - echo "\n"; - } - - function end_table() { - echo "
$name\n"; - else - echo "\t\n"; - } - - function cont_field($span = 1) { - echo "\t\n"; - else - echo "\t\n"; - } - - function end_field() { - echo "\t
\n"; - } - - function print_field($name, $array, $size = 0, $filt='') { - - begin_field($name); - - if (key_in_array($name, $array)) - $value = $array[$name]; - else - $value = ''; - - if ($filt != '') - $value = $filt($value); - - echo "\t\t 0) - echo " size=$size maxlength=$size"; - echo ">\n"; - - end_field(); - } - - function print_field_multiline($name, $array, $cols, $rows, $filt='') { - - begin_field($name); - - if (key_in_array($name, $array)) - $value = $array[$name]; - else - $value = ''; - - if ($filt != '') - $value = $filt($value); - - echo "\t\t\n"; - - end_field(); - } - - // print a mysql ENUM as an html RADIO INPUT - function print_enum($name, $array, $vals, $def = -1) { - - begin_field($name); - - if (key_in_array($name, $array)) - $chk = array_search($array[$name], $vals, FALSE); - else - $chk = $def; - - $nval = count($vals); - - for ($i = 0; $i < $nval; $i++) { - - $val = $vals[$i]; - if ($val == '') - $pval = "none"; - else - $pval = "$val"; - - printf("\t\t$pval\n", - $i == $chk ? " checked" : ""); - } - - end_field(); - } - - // print a mysql ENUM as an html SELECT INPUT - function print_enum_select($name, $array, $vals, $def = -1) { - - begin_field($name); - - echo "\t\t\n"; - - end_field(); - } - - // print a group of mysql ENUMs (e.g. name0,name1,...) as an html SELECT - function print_enum_multi($base, $array, $vals, $cnt, $defs, $grp = 0) { - - global $table_ncols; - - if ($grp <= 0) - $grp = $cnt; - $ncell = $cnt / $grp; - $span = ($table_ncols - 1) / $ncell; - - begin_field($base, $span); - - $nval = count($vals); - - for ($i = 0; $i < $cnt; $i++) { - - if ($i > 0 && ($i % $grp) == 0) - cont_field($span); - - $name = sprintf("%s%x", $base, $i); - - echo "\t\t\n"; - } - - end_field(); - } - - // functions to handle the form input - - // fetch all the parts of an "enum_multi" into a string suitable - // for a MySQL query - function gather_enum_multi_query($base, $cnt) { - - $retval = ''; - - for ($i = 0; $i < $cnt; $i++) { - - $name = sprintf("%s%x", $base, $i); - - if (isset($_REQUEST[$name])) { - $retval .= sprintf(", %s='%s'", - $name, $_REQUEST[$name]); - } - } - - return $retval; - } - - // fetch all the parts of an "enum_multi" into a string suitable - // for a display e.g. in an html table cell - function gather_enum_multi_print($base, $cnt, $array) { - - $retval = ''; - - for ($i = 0; $i < $cnt; $i++) { - - $name = sprintf("%s%x", $base, $i); - - if ($array[$name] != '') { - if ($retval != '') - $retval .= ','; - $retval .= $array[$name]; - } - } - - return $retval; - } - - // fetch all the parts of an "enum_multi" into a string suitable - // for writing to the eeprom data file - function gather_enum_multi_write($base, $cnt, $vals, $xfrm = array()) { - - $retval = ''; - - for ($i = 0; $i < $cnt; $i++) { - - $name = sprintf("%s%x", $base, $i); - - if ($GLOBALS[$name] != '') { - if ($retval != '') - $retval .= ','; - $index = enum_to_index($name, $vals); - if ($xfrm != array()) - $retval .= $xfrm[$index]; - else - $retval .= $index; - } - } - - return $retval; - } - - // count how many parts of an "enum_multi" are actually set - function count_enum_multi($base, $cnt) { - - $retval = 0; - - for ($i = 0; $i < $cnt; $i++) { - - $name = sprintf("%s%x", $base, $i); - - if (isset($_REQUEST[$name])) - $retval++; - } - - return $retval; - } - - // ethernet address functions - - // generate a (possibly not unique) random vendor ethernet address - // (setting bit 6 in the ethernet address - motorola wise i.e. bit 0 - // is the most significant bit - means it is not an assigned ethernet - // address - it is a "locally administered" address). Also, make sure - // it is NOT a multicast ethernet address (by setting bit 7 to 0). - // e.g. the first byte of all ethernet addresses generated here will - // have 2 in the bottom two bits (incidentally, these are the first - // two bits transmitted on the wire, since the octets in ethernet - // addresses are transmitted LSB first). - - function gen_eth_addr($serno) { - - $ethaddr_hgh = (mt_rand(0, 65535) & 0xfeff) | 0x0200; - $ethaddr_mid = mt_rand(0, 65535); - $ethaddr_low = mt_rand(0, 65535); - - return sprintf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx", - $ethaddr_hgh >> 8, $ethaddr_hgh & 0xff, - $ethaddr_mid >> 8, $ethaddr_mid & 0xff, - $ethaddr_low >> 8, $ethaddr_low & 0xff); - } - - // check that an ethernet address is valid - function eth_addr_is_valid($ethaddr) { - - $ethbytes = split(':', $ethaddr); - - if (count($ethbytes) != 6) - return FALSE; - - for ($i = 0; $i < 6; $i++) { - $ethbyte = $ethbytes[$i]; - if (!ereg('^[0-9a-f][0-9a-f]$', $ethbyte)) - return FALSE; - } - - return TRUE; - } - - // write a simple eeprom configuration file - function write_eeprom_cfg_file() { - - global $sernos, $nsernos, $bddb_cfgdir, $numerrs, $cfgerrs; - global $date, $batch, $type_vals, $rev; - global $sdram_vals, $sdram_nbits; - global $flash_vals, $flash_nbits; - global $zbt_vals, $zbt_nbits; - global $xlxtyp_vals, $xlxspd_vals, $xlxtmp_vals, $xlxgrd_vals; - global $cputyp, $cputyp_vals, $clk_vals; - global $hstype, $hstype_vals, $hschin, $hschout; - - $numerrs = 0; - $cfgerrs = array(); - - for ($i = 0; $i < $nsernos; $i++) { - - $serno = sprintf("%010d", $sernos[$i]); - - $wfp = @fopen($bddb_cfgdir . "/$serno.cfg", "w"); - if (!$wfp) { - $cfgerrs[$i] = 'file create fail'; - $numerrs++; - continue; - } - set_file_buffer($wfp, 0); - - if (!fprintf($wfp, "serno=%d\n", $sernos[$i])) { - $cfgerrs[$i] = 'cfg wr fail (serno)'; - fclose($wfp); - $numerrs++; - continue; - } - - if (!fprintf($wfp, "date=%s\n", $date)) { - $cfgerrs[$i] = 'cfg wr fail (date)'; - fclose($wfp); - $numerrs++; - continue; - } - - if ($batch != '') { - if (!fprintf($wfp, "batch=%s\n", $batch)) { - $cfgerrs[$i] = 'cfg wr fail (batch)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $typei = enum_to_index("type", $type_vals); - if (!fprintf($wfp, "type=%d\n", $typei)) { - $cfgerrs[$i] = 'cfg wr fail (type)'; - fclose($wfp); - $numerrs++; - continue; - } - - if (!fprintf($wfp, "rev=%d\n", $rev)) { - $cfgerrs[$i] = 'cfg wr fail (rev)'; - fclose($wfp); - $numerrs++; - continue; - } - - $s = gather_enum_multi_write("sdram", 4, - $sdram_vals, $sdram_nbits); - if ($s != '') { - $b = fprintf($wfp, "sdram=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (sdram)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $s = gather_enum_multi_write("flash", 4, - $flash_vals, $flash_nbits); - if ($s != '') { - $b = fprintf($wfp, "flash=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (flash)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $s = gather_enum_multi_write("zbt", 16, - $zbt_vals, $zbt_nbits); - if ($s != '') { - $b = fprintf($wfp, "zbt=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (zbt)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $s = gather_enum_multi_write("xlxtyp", 4, $xlxtyp_vals); - if ($s != '') { - $b = fprintf($wfp, "xlxtyp=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (xlxtyp)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $s = gather_enum_multi_write("xlxspd", 4, $xlxspd_vals); - if ($s != '') { - $b = fprintf($wfp, "xlxspd=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (xlxspd)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $s = gather_enum_multi_write("xlxtmp", 4, $xlxtmp_vals); - if ($s != '') { - $b = fprintf($wfp, "xlxtmp=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (xlxtmp)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - $s = gather_enum_multi_write("xlxgrd", 4, $xlxgrd_vals); - if ($s != '') { - $b = fprintf($wfp, "xlxgrd=%s\n", $s); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (xlxgrd)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - if ($cputyp != '') { - $cputypi = enum_to_index("cputyp",$cputyp_vals); - $cpuspdi = enum_to_index("cpuspd", $clk_vals); - $busspdi = enum_to_index("busspd", $clk_vals); - $cpmspdi = enum_to_index("cpmspd", $clk_vals); - $b = fprintf($wfp, "cputyp=%d\ncpuspd=%d\n" . - "busspd=%d\ncpmspd=%d\n", - $cputypi, $cpuspdi, $busspdi, $cpmspdi); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (cputyp)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - if ($hstype != '') { - $hstypei = enum_to_index("hstype",$hstype_vals); - $b = fprintf($wfp, "hstype=%d\n" . - "hschin=%s\nhschout=%s\n", - $hstypei, $hschin, $hschout); - if (!$b) { - $cfgerrs[$i] = 'cfg wr fail (hstype)'; - fclose($wfp); - $numerrs++; - continue; - } - } - - if (!fclose($wfp)) { - $cfgerrs[$i] = 'file cls fail'; - $numerrs++; - } - } - - return $numerrs; - } -?> diff --git a/tools/bddb/dodelete.php b/tools/bddb/dodelete.php deleted file mode 100644 index 4839e36e60..0000000000 --- a/tools/bddb/dodelete.php +++ /dev/null @@ -1,65 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // dodelete page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Delete Board Results"); - - if (!isset($_REQUEST['serno'])) - die("the board serial number was not specified"); - $serno=intval($_REQUEST['serno']); - - mysql_query("delete from boards where serno=$serno"); - - if(mysql_errno()) { - $errstr = mysql_error(); - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $errstr); - echo "\t\t
\n"; - echo "\t
\n"; - } - else { - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe board with serial number $serno was" - . " successfully deleted\n"; - mysql_query("delete from log where serno=$serno"); - if (mysql_errno()) { - $errstr = mysql_error(); - echo "\t\t\t\n"; - echo "\t\t\t\t

\n"; - echo "\t\t\t\t\tBut the following error occurred " . - "when deleting the log entries:\n"; - echo "\t\t\t\t

\n"; - echo "\t\t\t\t
\n"; - printf("\t\t\t\t\t%s\n", $errstr); - echo "\t\t\t\t
\n"; - echo "\t\t\t
\n"; - } - echo "\t\t

\n"; - echo "\t
\n"; - } -?> -

- - - - - -
- Back to Browse - - Back to Start -
- diff --git a/tools/bddb/dodellog.php b/tools/bddb/dodellog.php deleted file mode 100644 index 9dd78c11b6..0000000000 --- a/tools/bddb/dodellog.php +++ /dev/null @@ -1,57 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // dodelete page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Delete Log Entry Results"); - - if (!isset($_REQUEST['serno'])) - die("the board serial number was not specified"); - $serno=intval($_REQUEST['serno']); - - if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == 0) - die("the log entry number not specified!"); - $logno=$_REQUEST['logno']; - - mysql_query("delete from log where serno=$serno and logno=$logno"); - - if(mysql_errno()) { - $errstr = mysql_error(); - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $errstr); - echo "\t\t
\n"; - echo "\t
\n"; - } - else { - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe log entry with log number $logno\n"; - echo "\t\t\tand serial number $serno "; - echo "was successfully deleted\n"; - echo "\t\t

\n"; - echo "\t
\n"; - } -?> -

- - - - - -
- ">Back to Log - - Back to Start -
- diff --git a/tools/bddb/doedit.php b/tools/bddb/doedit.php deleted file mode 100644 index 13fbb69479..0000000000 --- a/tools/bddb/doedit.php +++ /dev/null @@ -1,186 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // doedit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Edit Board Results"); - - if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') - die("the board serial number was not specified"); - $serno=intval($_REQUEST['serno']); - - $query="update boards set"; - - if (isset($_REQUEST['ethaddr'])) { - $ethaddr=$_REQUEST['ethaddr']; - if (!eth_addr_is_valid($ethaddr)) - die("ethaddr is invalid ('$ethaddr')"); - $query.=" ethaddr='$ethaddr',"; - } - - if (isset($_REQUEST['date'])) { - $date=$_REQUEST['date']; - list($y, $m, $d) = split("-", $date); - if (!checkdate($m, $d, $y) || $y < 1999) - die("date is invalid (input '$date', " . - "yyyy-mm-dd '$y-$m-$d')"); - $query.=" date='$date'"; - } - - if (isset($_REQUEST['batch'])) { - $batch=$_REQUEST['batch']; - if (strlen($batch) > 32) - die("batch field too long (>32)"); - $query.=", batch='$batch'"; - } - - if (isset($_REQUEST['type'])) { - $type=$_REQUEST['type']; - if (!in_array($type, $type_vals)) - die("Invalid type ($type) specified"); - $query.=", type='$type'"; - } - - if (isset($_REQUEST['rev'])) { - $rev=$_REQUEST['rev']; - if (($rev = intval($rev)) <= 0 || $rev > 255) - die("Revision number is invalid ($rev)"); - $query.=sprintf(", rev=%d", $rev); - } - - if (isset($_REQUEST['location'])) { - $location=$_REQUEST['location']; - if (strlen($location) > 64) - die("location field too long (>64)"); - $query.=", location='$location'"; - } - - if (isset($_REQUEST['comments'])) - $comments=$_REQUEST['comments']; - $query.=", comments='" . rawurlencode($comments) . "'"; - - $query.=gather_enum_multi_query("sdram", 4); - - $query.=gather_enum_multi_query("flash", 4); - - $query.=gather_enum_multi_query("zbt", 16); - - $query.=gather_enum_multi_query("xlxtyp", 4); - $nxlx = count_enum_multi("xlxtyp", 4); - - $query.=gather_enum_multi_query("xlxspd", 4); - if (count_enum_multi("xlxspd", 4) != $nxlx) - die("number of xilinx speeds not same as number of types"); - - $query.=gather_enum_multi_query("xlxtmp", 4); - if (count_enum_multi("xlxtmp", 4) != $nxlx) - die("number of xilinx temps. not same as number of types"); - - $query.=gather_enum_multi_query("xlxgrd", 4); - if (count_enum_multi("xlxgrd", 4) != $nxlx) - die("number of xilinx grades not same as number of types"); - - if (isset($_REQUEST['cputyp'])) { - $cputyp=$_REQUEST['cputyp']; - $query.=", cputyp='$cputyp'"; - if (!isset($_REQUEST['cpuspd']) || $_REQUEST['cpuspd'] == '') - die("must specify cpu speed if cpu type is defined"); - $cpuspd=$_REQUEST['cpuspd']; - $query.=", cpuspd='$cpuspd'"; - if (!isset($_REQUEST['cpmspd']) || $_REQUEST['cpmspd'] == '') - die("must specify cpm speed if cpu type is defined"); - $cpmspd=$_REQUEST['cpmspd']; - $query.=", cpmspd='$cpmspd'"; - if (!isset($_REQUEST['busspd']) || $_REQUEST['busspd'] == '') - die("must specify bus speed if cpu type is defined"); - $busspd=$_REQUEST['busspd']; - $query.=", busspd='$busspd'"; - } - else { - if (isset($_REQUEST['cpuspd'])) - die("can't specify cpu speed if there is no cpu"); - if (isset($_REQUEST['cpmspd'])) - die("can't specify cpm speed if there is no cpu"); - if (isset($_REQUEST['busspd'])) - die("can't specify bus speed if there is no cpu"); - } - - if (isset($_REQUEST['hschin'])) { - $hschin=$_REQUEST['hschin']; - if (($hschin = intval($hschin)) < 0 || $hschin > 4) - die("Invalid number of hs input chans ($hschin)"); - } - else - $hschin = 0; - if (isset($_REQUEST['hschout'])) { - $hschout=$_REQUEST['hschout']; - if (($hschout = intval($hschout)) < 0 || $hschout > 4) - die("Invalid number of hs output chans ($hschout)"); - } - else - $hschout = 0; - if (isset($_REQUEST['hstype'])) { - $hstype=$_REQUEST['hstype']; - $query.=", hstype='$hstype'"; - } - else { - if ($_REQUEST['hschin'] != 0) - die("number of high-speed input channels must be zero" - . " if high-speed chip is not present"); - if ($_REQUEST['hschout'] != 0) - die("number of high-speed output channels must be zero" - . " if high-speed chip is not present"); - } - $query.=", hschin='$hschin'"; - $query.=", hschout='$hschout'"; - - $query.=" where serno=$serno"; - - mysql_query($query); - if(mysql_errno()) { - $errstr = mysql_error(); - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $errstr); - echo "\t\t
\n"; - echo "\t
\n"; - } - else { - $sernos = array($serno); - $nsernos = 1; - - write_eeprom_cfg_file(); - - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe board with serial number $serno was" - . " successfully updated"; - if ($numerrs > 0) { - $errstr = $cfgerrs[0]; - echo "
\n\t\t\t"; - echo "(but the cfg file update failed: $errstr)"; - } - echo "\n"; - echo "\t\t

\n"; - echo "\t
\n"; - } - -?> -

- - - - - -
Back to BrowseBack to Start
- diff --git a/tools/bddb/doedlog.php b/tools/bddb/doedlog.php deleted file mode 100644 index 7009aa7dad..0000000000 --- a/tools/bddb/doedlog.php +++ /dev/null @@ -1,76 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // doedit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Edit Log Entry Results"); - - if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') - die("the board serial number was not specified"); - $serno=intval($_REQUEST['serno']); - - if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == '') - die("log number not specified!"); - $logno=intval($_REQUEST['logno']); - - $query="update log set"; - - if (isset($_REQUEST['date'])) { - $date=$_REQUEST['date']; - list($y, $m, $d) = split("-", $date); - if (!checkdate($m, $d, $y) || $y < 1999) - die("date is invalid (input '$date', " . - "yyyy-mm-dd '$y-$m-$d')"); - $query.=" date='$date'"; - } - - if (isset($_REQUEST['who'])) { - $who=$_REQUEST['who']; - $query.=", who='" . $who . "'"; - } - - if (isset($_REQUEST['details'])) { - $details=$_REQUEST['details']; - $query.=", details='" . rawurlencode($details) . "'"; - } - - $query.=" where serno=$serno and logno=$logno"; - - mysql_query($query); - if(mysql_errno()) { - $errstr = mysql_error(); - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $errstr); - echo "\t\t
\n"; - echo "\t
\n"; - } - else { - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe log entry with log number $logno and\n"; - echo "\t\t\tserial number $serno "; - echo "was successfully updated\n"; - echo "\t\t

\n"; - echo "\t
\n"; - } - -?> -

- - - - - -
">Back to LogBack to Start
- diff --git a/tools/bddb/donew.php b/tools/bddb/donew.php deleted file mode 100644 index 39b2c78fca..0000000000 --- a/tools/bddb/donew.php +++ /dev/null @@ -1,230 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // doedit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Board Registration Results"); - - if (isset($_REQUEST['serno'])) { - $serno=$_REQUEST['serno']; - die("serial number must not be set ($serno) when Creating!"); - } - - $query="update boards set"; - - list($y, $m, $d) = split("-", $date); - if (!checkdate($m, $d, $y) || $y < 1999) - die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')"); - $query.=" date='$date'"; - - if ($batch != '') { - if (strlen($batch) > 32) - die("batch field too long (>32)"); - $query.=", batch='$batch'"; - } - - if (!in_array($type, $type_vals)) - die("Invalid type ($type) specified"); - $query.=", type='$type'"; - - if (($rev = intval($rev)) <= 0 || $rev > 255) - die("Revision number is invalid ($rev)"); - $query.=sprintf(", rev=%d", $rev); - - $query.=gather_enum_multi_query("sdram", 4); - - $query.=gather_enum_multi_query("flash", 4); - - $query.=gather_enum_multi_query("zbt", 16); - - $query.=gather_enum_multi_query("xlxtyp", 4); - $nxlx = count_enum_multi("xlxtyp", 4); - - $query.=gather_enum_multi_query("xlxspd", 4); - if (count_enum_multi("xlxspd", 4) != $nxlx) - die("number of xilinx speeds not same as number of types"); - - $query.=gather_enum_multi_query("xlxtmp", 4); - if (count_enum_multi("xlxtmp", 4) != $nxlx) - die("number of xilinx temps. not same as number of types"); - - $query.=gather_enum_multi_query("xlxgrd", 4); - if (count_enum_multi("xlxgrd", 4) != $nxlx) - die("number of xilinx grades not same as number of types"); - - if ($cputyp == '') { - if ($cpuspd != '') - die("can't specify cpu speed if there is no cpu"); - if ($cpmspd != '') - die("can't specify cpm speed if there is no cpu"); - if ($busspd != '') - die("can't specify bus speed if there is no cpu"); - } - else { - $query.=", cputyp='$cputyp'"; - if ($cpuspd == '') - die("must specify cpu speed if cpu type is defined"); - $query.=", cpuspd='$cpuspd'"; - if ($cpmspd == '') - die("must specify cpm speed if cpu type is defined"); - $query.=", cpmspd='$cpmspd'"; - if ($busspd == '') - die("must specify bus speed if cpu type is defined"); - $query.=", busspd='$busspd'"; - } - - if (($hschin = intval($hschin)) < 0 || $hschin > 4) - die("Invalid number of hs input chans ($hschin)"); - if (($hschout = intval($hschout)) < 0 || $hschout > 4) - die("Invalid number of hs output chans ($hschout)"); - if ($hstype == '') { - if ($hschin != 0) - die("number of high-speed input channels must be zero" - . " if high-speed chip is not present"); - if ($hschout != 0) - die("number of high-speed output channels must be zero" - . " if high-speed chip is not present"); - } - else - $query.=", hstype='$hstype'"; - $query.=", hschin='$hschin'"; - $query.=", hschout='$hschout'"; - - // echo "final query = '$query'
\n"; - - $quant = intval($quant); - if ($quant <= 0) $quant = 1; - - $sernos = array(); - if ($geneths) - $ethaddrs = array(); - - $sqlerr = ''; - - while ($quant-- > 0) { - - mysql_query("insert into boards (serno) values (null)"); - if (mysql_errno()) { - $sqlerr = mysql_error(); - break; - } - - $serno = mysql_insert_id(); - if (!$serno) { - $sqlerr = "couldn't allocate new serial number"; - break; - } - - mysql_query($query . " where serno=$serno"); - if (mysql_errno()) { - $sqlerr = mysql_error(); - break; - } - - array_push($sernos, $serno); - - if ($geneths) { - - $ethaddr = gen_eth_addr($serno); - - mysql_query("update boards set ethaddr='$ethaddr'" . - " where serno=$serno"); - if (mysql_errno()) { - $sqlerr = mysql_error(); - - array_push($ethaddrs, - "" . - "db save fail" . - ""); - break; - } - - array_push($ethaddrs, $ethaddr); - } - } - - $nsernos = count($sernos); - - if ($nsernos > 0) { - - write_eeprom_cfg_file(); - - echo "\n"; - echo "\t

\n"; - echo "\t\tThe following board serial numbers were" - . " successfully allocated"; - if ($numerrs > 0) - echo " (but with $numerrs cfg file error" . - ($numerrs > 1 ? "s" : "") . ")"; - echo ":\n"; - echo "\t

\n"; - - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\t\n"; - if ($numerrs > 0) - echo "\t\n"; - if ($geneths) - echo "\t\n"; - echo "\n"; - - for ($i = 0; $i < $nsernos; $i++) { - - $serno = sprintf("%010d", $sernos[$i]); - - echo "\n"; - - echo "\t\n"; - - if ($numerrs > 0) { - if (($errstr = $cfgerrs[$i]) == '') - $errstr = ' '; - echo "\t\n"; - } - - if ($geneths) { - echo "\t\n"; - } - - echo "\n"; - } - - echo "
Serial NumberCfg File ErrsEthernet Address
" . - "$serno" . - "" . - $errstr . - "" . - "" . - $ethaddrs[$i] . - "
\n"; - } - - if ($sqlerr != '') { - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following SQL error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $sqlerr); - echo "\t\t
\n"; - echo "\t
\n"; - } - -?> -

- - - - - -
Go to BrowseBack to Start
- diff --git a/tools/bddb/donewlog.php b/tools/bddb/donewlog.php deleted file mode 100644 index 7635d2992d..0000000000 --- a/tools/bddb/donewlog.php +++ /dev/null @@ -1,86 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // doedit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Add Log Entry Results"); - - if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') - die("serial number not specified!"); - $serno=intval($_REQUEST['serno']); - - if (isset($_REQUEST['logno'])) { - $logno=$_REQUEST['logno']; - die("log number must not be set ($logno) when Creating!"); - } - - $query="update log set serno=$serno"; - - list($y, $m, $d) = split("-", $date); - if (!checkdate($m, $d, $y) || $y < 1999) - die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')"); - $query.=", date='$date'"; - - if (isset($_REQUEST['who'])) { - $who=$_REQUEST['who']; - $query.=", who='" . $who . "'"; - } - - if (isset($_REQUEST['details'])) { - $details=$_REQUEST['details']; - $query.=", details='" . rawurlencode($details) . "'"; - } - - // echo "final query = '$query'
\n"; - - $sqlerr = ''; - - mysql_query("insert into log (logno) values (null)"); - if (mysql_errno()) - $sqlerr = mysql_error(); - else { - $logno = mysql_insert_id(); - if (!$logno) - $sqlerr = "couldn't allocate new serial number"; - else { - mysql_query($query . " where logno=$logno"); - if (mysql_errno()) - $sqlerr = mysql_error(); - } - } - - if ($sqlerr == '') { - echo "\n"; - echo "\t

\n"; - echo "\t\tA log entry with log number '$logno' was " . - "added to the board with serial number '$serno'\n"; - echo "\t

\n"; - echo "\n"; - } - else { - echo "\t\n"; - echo "\t\t

\n"; - echo "\t\t\tThe following SQL error was encountered:\n"; - echo "\t\t

\n"; - echo "\t\t
\n"; - printf("\t\t\t%s\n", $sqlerr); - echo "\t\t
\n"; - echo "\t
\n"; - } - -?> -

- - - - - -
">Go to BrowseBack to Start
- diff --git a/tools/bddb/edit.php b/tools/bddb/edit.php deleted file mode 100644 index dd8c26c5cd..0000000000 --- a/tools/bddb/edit.php +++ /dev/null @@ -1,131 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // edit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Edit Board Registration"); - - if ($serno == 0) - die("serial number not specified or invalid!"); - - $pserno = sprintf("%010d", $serno); - - echo "
"; - echo "Board Serial Number: $pserno"; - echo "
\n"; - -?> -

-

-\n"; - - $r=mysql_query("select * from boards where serno=$serno"); - $row=mysql_fetch_array($r); - if(!$row) die("no record of serial number '$serno' in database"); - - begin_table(5); - - // ethaddr char(17) - print_field("ethaddr", $row, 17); - - // date date - print_field("date", $row); - - // batch char(32) - print_field("batch", $row, 32); - - // type enum('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY') - print_enum("type", $row, $type_vals); - - // rev tinyint(3) unsigned zerofill - print_field("rev", $row, 3, 'rev_filter'); - - // location char(64) - print_field("location", $row, 64); - - // comments text - print_field_multiline("comments", $row, 60, 10, 'text_filter'); - - // sdram[0-3] enum('32M','64M','128M','256M') - print_enum_multi("sdram", $row, $sdram_vals, 4, array()); - - // flash[0-3] enum('4M','8M','16M','32M','64M') - print_enum_multi("flash", $row, $flash_vals, 4, array()); - - // zbt[0-f] enum('512K','1M','2M','4M') - print_enum_multi("zbt", $row, $zbt_vals, 16, array()); - - // xlxtyp[0-3] enum('XCV300E','XCV400E','XCV600E') - print_enum_multi("xlxtyp", $row, $xlxtyp_vals, 4, array(), 1); - - // xlxspd[0-3] enum('6','7','8') - print_enum_multi("xlxspd", $row, $xlxspd_vals, 4, array(), 1); - - // xlxtmp[0-3] enum('COM','IND') - print_enum_multi("xlxtmp", $row, $xlxtmp_vals, 4, array(), 1); - - // xlxgrd[0-3] enum('NORMAL','ENGSAMP') - print_enum_multi("xlxgrd", $row, $xlxgrd_vals, 4, array(), 1); - - // cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)') - print_enum("cputyp", $row, $cputyp_vals); - - // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') - print_enum_select("cpuspd", $row, $clk_vals); - - // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') - print_enum_select("cpmspd", $row, $clk_vals); - - // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') - print_enum_select("busspd", $row, $clk_vals); - - // hstype enum('AMCC-S2064A') - print_enum("hstype", $row, $hstype_vals); - - // hschin enum('0','1','2','3','4') - print_enum("hschin", $row, $hschin_vals); - - // hschout enum('0','1','2','3','4') - print_enum("hschout", $row, $hschout_vals); - - end_table(); - - echo "

\n"; - echo "

"; - echo "WARNING: NO UNDO ON DELETE!"; - echo "

\n"; - echo "[ delete ]"; - echo "
\n"; - echo "

\n"; -?> -

- - - - - - - - -
- - -   - - - -   - - Back to Start -
-

-
- diff --git a/tools/bddb/edlog.php b/tools/bddb/edlog.php deleted file mode 100644 index 8befd35b92..0000000000 --- a/tools/bddb/edlog.php +++ /dev/null @@ -1,86 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // edit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - Edit Board Log Entry"); - - if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') - die("serial number not specified!"); - $serno=intval($_REQUEST['serno']); - - if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == '') - die("log number not specified!"); - $logno=intval($_REQUEST['logno']); - - $pserno = sprintf("%010d", $serno); - $plogno = sprintf("%010d", $logno); - - echo "
"; - echo "Board Serial Number: $pserno, Log Number: $plogno"; - echo "
\n"; - -?> -

-

-\n"; - echo "\n"; - - $r=mysql_query("select * from log where serno=$serno and logno=$logno"); - $row=mysql_fetch_array($r); - if(!$row) - die("no record of log entry with serial number '$serno' " . - "and log number '$logno' in database"); - - begin_table(3); - - // date date - print_field("date", $row); - - // who char(20) - print_field("who", $row); - - // details text - print_field_multiline("details", $row, 60, 10, 'text_filter'); - - end_table(); - - echo "

\n"; - echo "

"; - echo "WARNING: NO UNDO ON DELETE!"; - echo "

\n"; - echo "[ delete ]"; - echo "
\n"; - echo "

\n"; -?> -

- - - - - - - - -
- - -   - - - -   - - Back to Start -
-

-
- diff --git a/tools/bddb/execute.php b/tools/bddb/execute.php deleted file mode 100644 index 0b62882d75..0000000000 --- a/tools/bddb/execute.php +++ /dev/null @@ -1,33 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:''; - - $submit=isset($_REQUEST['submit'])?$_REQUEST['submit']:"[NOT SET]"; - - switch ($submit) { - - case "New": - require("new.php"); - break; - - case "Edit": - require("edit.php"); - break; - - case "Browse": - require("browse.php"); - break; - - case "Log": - require("brlog.php"); - break; - - default: - require("badsubmit.php"); - break; - } -?> diff --git a/tools/bddb/index.php b/tools/bddb/index.php deleted file mode 100644 index 842aed55fb..0000000000 --- a/tools/bddb/index.php +++ /dev/null @@ -1,38 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - require("defs.php"); - pg_head("$bddb_label"); -?> - -
- - - - - - - - - - -
- - - - - - - -
- Serial Number: - -
-
-
- diff --git a/tools/bddb/new.php b/tools/bddb/new.php deleted file mode 100644 index 30323ff819..0000000000 --- a/tools/bddb/new.php +++ /dev/null @@ -1,120 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // edit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - New Board Registration"); -?> -
-

- date("Y-m-d"))); - - // batch char(32) - print_field("batch", $row, 32); - - // type enum('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY') - print_enum("type", $row, $type_vals, 0); - - // rev tinyint(3) unsigned zerofill - print_field("rev", $row, 3, 'rev_filter'); - - // sdram[0-3] enum('32M','64M','128M','256M') - print_enum_multi("sdram", $row, $sdram_vals, 4, array(2)); - - // flash[0-3] enum('4M','8M','16M','32M','64M') - print_enum_multi("flash", $row, $flash_vals, 4, array(2)); - - // zbt[0-f] enum('512K','1M','2M','4M') - print_enum_multi("zbt", $row, $zbt_vals, 16, array(2, 2)); - - // xlxtyp[0-3] enum('XCV300E','XCV400E','XCV600E') - print_enum_multi("xlxtyp", $row, $xlxtyp_vals, 4, array(1), 1); - - // xlxspd[0-3] enum('6','7','8') - print_enum_multi("xlxspd", $row, $xlxspd_vals, 4, array(1), 1); - - // xlxtmp[0-3] enum('COM','IND') - print_enum_multi("xlxtmp", $row, $xlxtmp_vals, 4, array(1), 1); - - // xlxgrd[0-3] enum('NORMAL','ENGSAMP') - print_enum_multi("xlxgrd", $row, $xlxgrd_vals, 4, array(1), 1); - - // cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)') - print_enum("cputyp", $row, $cputyp_vals, 1); - - // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') - print_enum_select("cpuspd", $row, $clk_vals, 4); - - // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') - print_enum_select("cpmspd", $row, $clk_vals, 4); - - // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') - print_enum_select("busspd", $row, $clk_vals, 2); - - // hstype enum('AMCC-S2064A') - print_enum("hstype", $row, $hstype_vals, 1); - - // hschin enum('0','1','2','3','4') - print_enum("hschin", $row, $hschin_vals, 4); - - // hschout enum('0','1','2','3','4') - print_enum("hschout", $row, $hschout_vals, 4); - - end_table(); -?> -

- - - - - - - - - - - - - - - -
- Allocate - - board serial number(s) -
- - Generate Ethernet Address(es) -
-   -
- - -   - - -
-
- diff --git a/tools/bddb/newlog.php b/tools/bddb/newlog.php deleted file mode 100644 index 609bb855c5..0000000000 --- a/tools/bddb/newlog.php +++ /dev/null @@ -1,54 +0,0 @@ - ?> - - // CSIRO Manufacturing Science and Technology, Preston Lab - - // edit page (hymod_bddb / boards) - - require("defs.php"); - - pg_head("$bddb_label - New Log Entry"); - - if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') - die("serial number not specified or invalid!"); - $serno=intval($_REQUEST['serno']); - - if (isset($_REQUEST['logno'])) { - $logno=$_REQUEST['logno']; - die("log number must not be specified when adding! ($logno)"); - } -?> -
-

-\n"; - - begin_table(3); - - // date date - print_field("date", array('date' => date("Y-m-d"))); - - // who char(20) - print_field("who", array()); - - // details text - print_field_multiline("details", array(), 60, 10, 'text_filter'); - - end_table(); -?> -

- - - - - -
- - - -
-
- diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c deleted file mode 100644 index 98be617667..0000000000 --- a/tools/bmp_logo.c +++ /dev/null @@ -1,165 +0,0 @@ -#include -#include - -#if defined(__linux__) -#include -#else -#ifdef __CYGWIN__ -#include "elf.h" -#else -#include -#endif -#endif - -typedef struct bitmap_s { /* bitmap description */ - uint16_t width; - uint16_t height; - uint8_t palette[256*3]; - uint8_t *data; -} bitmap_t; - -#define DEFAULT_CMAP_SIZE 16 /* size of default color map */ - -/* - * Neutralize little endians. - */ -uint16_t le_short(uint16_t x) -{ - uint16_t val; - uint8_t *p = (uint8_t *)(&x); - - val = (*p++ & 0xff) << 0; - val |= (*p & 0xff) << 8; - - return val; -} - -void skip_bytes (FILE *fp, int n) -{ - while (n-- > 0) - fgetc (fp); -} - -int main (int argc, char *argv[]) -{ - int i, x; - FILE *fp; - bitmap_t bmp; - bitmap_t *b = &bmp; - uint16_t data_offset, n_colors; - - if (argc < 2) { - fprintf (stderr, "Usage: %s file\n", argv[0]); - exit (EXIT_FAILURE); - } - - if ((fp = fopen (argv[1], "rb")) == NULL) { - perror (argv[1]); - exit (EXIT_FAILURE); - } - - if (fgetc (fp) != 'B' || fgetc (fp) != 'M') { - fprintf (stderr, "%s is not a bitmap file.\n", argv[1]); - exit (EXIT_FAILURE); - } - - /* - * read width and height of the image, and the number of colors used; - * ignore the rest - */ - skip_bytes (fp, 8); - fread (&data_offset, sizeof (uint16_t), 1, fp); - skip_bytes (fp, 6); - fread (&b->width, sizeof (uint16_t), 1, fp); - skip_bytes (fp, 2); - fread (&b->height, sizeof (uint16_t), 1, fp); - skip_bytes (fp, 22); - fread (&n_colors, sizeof (uint16_t), 1, fp); - skip_bytes (fp, 6); - - /* - * Repair endianess. - */ - data_offset = le_short(data_offset); - b->width = le_short(b->width); - b->height = le_short(b->height); - n_colors = le_short(n_colors); - - /* assume we are working with an 8-bit file */ - if ((n_colors == 0) || (n_colors > 256 - DEFAULT_CMAP_SIZE)) { - /* reserve DEFAULT_CMAP_SIZE color map entries for default map */ - n_colors = 256 - DEFAULT_CMAP_SIZE; - } - - printf ("/*\n" - " * Automatically generated by \"tools/bmp_logo\"\n" - " *\n" - " * DO NOT EDIT\n" - " *\n" - " */\n\n\n" - "#ifndef __BMP_LOGO_H__\n" - "#define __BMP_LOGO_H__\n\n" - "#define BMP_LOGO_WIDTH\t\t%d\n" - "#define BMP_LOGO_HEIGHT\t\t%d\n" - "#define BMP_LOGO_COLORS\t\t%d\n" - "#define BMP_LOGO_OFFSET\t\t%d\n" - "\n", - b->width, b->height, n_colors, - DEFAULT_CMAP_SIZE); - - /* allocate memory */ - if ((b->data = (uint8_t *)malloc(b->width * b->height)) == NULL) { - fclose (fp); - printf ("Error allocating memory for file %s.\n", argv[1]); - exit (EXIT_FAILURE); - } - - /* read and print the palette information */ - printf ("unsigned short bmp_logo_palette[] = {\n"); - - for (i=0; ipalette[(int)(i*3+2)] = fgetc(fp); - b->palette[(int)(i*3+1)] = fgetc(fp); - b->palette[(int)(i*3+0)] = fgetc(fp); - x=fgetc(fp); - - printf ("%s0x0%X%X%X,%s", - ((i%8) == 0) ? "\t" : " ", - (b->palette[(int)(i*3+0)] >> 4) & 0x0F, - (b->palette[(int)(i*3+1)] >> 4) & 0x0F, - (b->palette[(int)(i*3+2)] >> 4) & 0x0F, - ((i%8) == 7) ? "\n" : "" - ); - } - - /* seek to offset indicated by file header */ - fseek(fp, (long)data_offset, SEEK_SET); - - /* read the bitmap; leave room for default color map */ - printf ("\n"); - printf ("};\n"); - printf ("\n"); - printf ("unsigned char bmp_logo_bitmap[] = {\n"); - for (i=(b->height-1)*b->width; i>=0; i-=b->width) { - for (x = 0; x < b->width; x++) { - b->data[(uint16_t) i + x] = (uint8_t) fgetc (fp) \ - + DEFAULT_CMAP_SIZE; - } - } - fclose (fp); - - for (i=0; i<(b->height*b->width); ++i) { - if ((i%8) == 0) - putchar ('\t'); - printf ("0x%02X,%c", - b->data[i], - ((i%8) == 7) ? '\n' : ' ' - ); - } - printf ("\n" - "};\n\n" - "#endif /* __BMP_LOGO_H__ */\n" - ); - - return (0); -} diff --git a/tools/easylogo/Makefile b/tools/easylogo/Makefile deleted file mode 100644 index 292344ad03..0000000000 --- a/tools/easylogo/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: easylogo.c - gcc easylogo.c -o easylogo diff --git a/tools/easylogo/easylogo.c b/tools/easylogo/easylogo.c deleted file mode 100644 index 9f1d1fff08..0000000000 --- a/tools/easylogo/easylogo.c +++ /dev/null @@ -1,422 +0,0 @@ -/* -** Easylogo TGA->header converter -** ============================== -** (C) 2000 by Paolo Scaffardi (arsenio@tin.it) -** AIRVENT SAM s.p.a - RIMINI(ITALY) -** -** This is still under construction! -*/ - -#include - -#pragma pack(1) - -/*#define ENABLE_ASCII_BANNERS */ - -typedef struct { - unsigned char id; - unsigned char ColorMapType; - unsigned char ImageTypeCode; - unsigned short ColorMapOrigin; - unsigned short ColorMapLenght; - unsigned char ColorMapEntrySize; - unsigned short ImageXOrigin; - unsigned short ImageYOrigin; - unsigned short ImageWidth; - unsigned short ImageHeight; - unsigned char ImagePixelSize; - unsigned char ImageDescriptorByte; -} tga_header_t; - -typedef struct { - unsigned char r,g,b ; -} rgb_t ; - -typedef struct { - unsigned char b,g,r ; -} bgr_t ; - -typedef struct { - unsigned char Cb,y1,Cr,y2; -} yuyv_t ; - -typedef struct { - unsigned char *data, - *palette ; - int width, - height, - pixels, - bpp, - pixel_size, - size, - palette_size, - yuyv; -} image_t ; - -void StringUpperCase (char *str) -{ - int count = strlen(str); - char c ; - - while(count--) - { - c=*str; - if ((c >= 'a')&&(c<='z')) - *str = 'A' + (c-'a'); - str++ ; - } -} - -void StringLowerCase (char *str) -{ - int count = strlen(str); - char c ; - - while(count--) - { - c=*str; - if ((c >= 'A')&&(c<='Z')) - *str = 'a' + (c-'A'); - str++ ; - } -} -void pixel_rgb_to_yuyv (rgb_t *rgb_pixel, yuyv_t *yuyv_pixel) -{ - unsigned int pR, pG, pB ; - - /* Transform (0-255) components to (0-100) */ - pR = rgb_pixel->r * 100 / 255 ; - pG = rgb_pixel->g * 100 / 255 ; - pB = rgb_pixel->b * 100 / 255 ; - - /* Calculate YUV values (0-255) from RGB beetween 0-100 */ - yuyv_pixel->y1 = yuyv_pixel->y2 = 209 * (pR + pG + pB) / 300 + 16 ; - yuyv_pixel->Cb = pB - (pR/4) - (pG*3/4) + 128 ; - yuyv_pixel->Cr = pR - (pG*3/4) - (pB/4) + 128 ; - - return ; -} - -void printlogo_rgb (rgb_t *data, int w, int h) -{ - int x,y; - for (y=0; yr < 30)/*&&(data->g == 0)&&(data->b == 0)*/) - printf(" "); - else - printf("X"); - printf("\n"); - } -} - -void printlogo_yuyv (unsigned short *data, int w, int h) -{ - int x,y; - for (y=0; ywidth = header.ImageWidth ; - image->height = header.ImageHeight ; - - switch (header.ImageTypeCode){ - case 2: /* Uncompressed RGB */ - image->yuyv = 0 ; - image->palette_size = 0 ; - image->palette = NULL ; - break; - - default: - printf("Format not supported!\n"); - return -1 ; - } - - image->bpp = header.ImagePixelSize ; - image->pixel_size = ((image->bpp-1) / 8) + 1 ; - image->pixels = image->width * image->height; - image->size = image->pixels * image->pixel_size ; - image->data = malloc(image->size) ; - - if (image->bpp != 24) - { - printf("Bpp not supported: %d!\n", image->bpp); - return -1 ; - } - - fread(image->data, image->size, 1, file); - -/* Swapping R and B values */ - - p = image->data ; - for(i=0; i < image->pixels; i++, p++) - { - app = p->r ; - p->r = p->b ; - p->b = app ; - } - -/* Swapping image */ - - if(!(header.ImageDescriptorByte & 0x20)) - { - unsigned char *temp = malloc(image->size); - int linesize = image->pixel_size * image->width ; - void *dest = image->data, - *source = temp + image->size - linesize ; - - printf("S"); - if (temp == NULL) - { - printf("Cannot alloc temp buffer!\n"); - return -1; - } - - memcpy(temp, image->data, image->size); - for(i = 0; iheight; i++, dest+=linesize, source-=linesize) - memcpy(dest, source, linesize); - - free( temp ); - } - -#ifdef ENABLE_ASCII_BANNERS - printlogo_rgb (image->data,image->width, image->height); -#endif - - fclose (file); - return 0; -} - -int image_free (image_t *image) -{ - if(image->data != NULL) - free(image->data); - - if(image->palette != NULL) - free(image->palette); - - return 0; -} - -int image_rgb_to_yuyv (image_t *rgb_image, image_t *yuyv_image) -{ - rgb_t *rgb_ptr = (rgb_t *) rgb_image->data ; - yuyv_t yuyv ; - unsigned short *dest ; - int count = 0 ; - - yuyv_image->pixel_size = 2 ; - yuyv_image->bpp = 16 ; - yuyv_image->yuyv = 1 ; - yuyv_image->width = rgb_image->width ; - yuyv_image->height = rgb_image->height ; - yuyv_image->pixels = yuyv_image->width * yuyv_image->height ; - yuyv_image->size = yuyv_image->pixels * yuyv_image->pixel_size ; - dest = (unsigned short *) (yuyv_image->data = malloc(yuyv_image->size)) ; - yuyv_image->palette = 0 ; - yuyv_image->palette_size= 0 ; - - while((count++) < rgb_image->pixels) - { - pixel_rgb_to_yuyv (rgb_ptr++, &yuyv); - - if ((count & 1)==0) /* Was == 0 */ - memcpy (dest, ((void *)&yuyv) + 2, sizeof(short)); - else - memcpy (dest, (void *)&yuyv, sizeof(short)); - - dest ++ ; - } - -#ifdef ENABLE_ASCII_BANNERS - printlogo_yuyv (yuyv_image->data, yuyv_image->width, yuyv_image->height); -#endif - return 0 ; -} - -int image_save_header (image_t *image, char *filename, char *varname) -{ - FILE *file = fopen (filename, "w"); - char app[256], str[256]="", def_name[64] ; - int count = image->size, col=0; - unsigned char *dataptr = image->data ; - if (file==NULL) - return -1 ; - -/* Author information */ - fprintf(file, "/*\n * Generated by EasyLogo, (C) 2000 by Paolo Scaffardi\n *\n"); - fprintf(file, " * To use this, include it and call: easylogo_plot(screen,&%s, width,x,y)\n *\n", varname); - fprintf(file, " * Where:\t'screen'\tis the pointer to the frame buffer\n"); - fprintf(file, " *\t\t'width'\tis the screen width\n"); - fprintf(file, " *\t\t'x'\t\tis the horizontal position\n"); - fprintf(file, " *\t\t'y'\t\tis the vertical position\n */\n\n"); - -/* Headers */ - fprintf(file, "#include \n\n"); -/* Macros */ - strcpy(def_name, varname); - StringUpperCase (def_name); - fprintf(file, "#define DEF_%s_WIDTH\t\t%d\n", def_name, image->width); - fprintf(file, "#define DEF_%s_HEIGHT\t\t%d\n", def_name, image->height); - fprintf(file, "#define DEF_%s_PIXELS\t\t%d\n", def_name, image->pixels); - fprintf(file, "#define DEF_%s_BPP\t\t%d\n", def_name, image->bpp); - fprintf(file, "#define DEF_%s_PIXEL_SIZE\t%d\n", def_name, image->pixel_size); - fprintf(file, "#define DEF_%s_SIZE\t\t%d\n\n", def_name, image->size); -/* Declaration */ - fprintf(file, "unsigned char DEF_%s_DATA[DEF_%s_SIZE] = {\n", def_name, def_name); - -/* Data */ - while(count) - switch (col){ - case 0: - sprintf(str, " 0x%02x", *dataptr++); - col++; - count-- ; - break; - - case 16: - fprintf(file, "%s", str); - if (count > 0) - fprintf(file,","); - fprintf(file, "\n"); - - col = 0 ; - break; - - default: - strcpy(app, str); - sprintf(str, "%s, 0x%02x", app, *dataptr++); - col++ ; - count-- ; - break; - } - - if (col) - fprintf(file, "%s\n", str); - -/* End of declaration */ - fprintf(file, "};\n\n"); -/* Variable */ - fprintf(file, "fastimage_t %s = {\n", varname); - fprintf(file, " DEF_%s_DATA,\n", def_name); - fprintf(file, " DEF_%s_WIDTH,\n", def_name); - fprintf(file, " DEF_%s_HEIGHT,\n", def_name); - fprintf(file, " DEF_%s_BPP,\n", def_name); - fprintf(file, " DEF_%s_PIXEL_SIZE,\n", def_name); - fprintf(file, " DEF_%s_SIZE\n};\n", def_name); - - fclose (file); - - return 0 ; -} - -#define DEF_FILELEN 256 - -int main (int argc, char *argv[]) -{ - char - inputfile[DEF_FILELEN], - outputfile[DEF_FILELEN], - varname[DEF_FILELEN]; - - image_t rgb_logo, yuyv_logo ; - - switch (argc){ - case 2: - case 3: - case 4: - strcpy (inputfile, argv[1]); - - if (argc > 2) - strcpy (varname, argv[2]); - else - { - int pos = strchr(inputfile, '.'); - - if (pos >= 0) - { - strncpy (varname, inputfile, pos); - varname[pos] = 0 ; - } - } - - if (argc > 3) - strcpy (outputfile, argv[3]); - else - { - int pos = strchr (varname, '.'); - - if (pos > 0) - { - char app[DEF_FILELEN] ; - - strncpy(app, varname, pos); - sprintf(outputfile, "%s.h", app); - } - } - break; - - default: - printf("EasyLogo 1.0 (C) 2000 by Paolo Scaffardi\n\n"); - - printf("Syntax: easylogo inputfile [outputvar {outputfile}] \n"); - printf("\n"); - printf("Where: 'inputfile' is the TGA image to load\n"); - printf(" 'outputvar' is the variable name to create\n"); - printf(" 'outputfile' is the output header file (default is 'inputfile.h')\n"); - - return -1 ; - } - - printf("Doing '%s' (%s) from '%s'...", - outputfile, varname, inputfile); - -/* Import TGA logo */ - - printf("L"); - if (image_load_tga (&rgb_logo, inputfile)<0) - { - printf("input file not found!\n"); - exit(1); - } - -/* Convert it to YUYV format */ - - printf("C"); - image_rgb_to_yuyv (&rgb_logo, &yuyv_logo) ; - -/* Save it into a header format */ - - printf("S"); - image_save_header (&yuyv_logo, outputfile, varname) ; - -/* Free original image and copy */ - - image_free (&rgb_logo); - image_free (&yuyv_logo); - - printf("\n"); - - return 0 ; -} diff --git a/tools/easylogo/linux_logo.tga b/tools/easylogo/linux_logo.tga deleted file mode 100644 index ac53def05c..0000000000 Binary files a/tools/easylogo/linux_logo.tga and /dev/null differ diff --git a/tools/easylogo/runme.sh b/tools/easylogo/runme.sh deleted file mode 100644 index 625ebaae19..0000000000 --- a/tools/easylogo/runme.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -make -./easylogo linux_logo.tga u_boot_logo video_logo.h -mv video_logo.h ../../include diff --git a/tools/env/Makefile b/tools/env/Makefile deleted file mode 100644 index 1f16768aaf..0000000000 --- a/tools/env/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# (C) Copyright 2002-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# 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 -# - -include $(TOPDIR)/config.mk - -SRCS := $(obj)crc32.c fw_env.c fw_env_main.c -HEADERS := fw_env.h - -CPPFLAGS := -Wall -DUSE_HOSTCC - -all: $(obj)fw_printenv - -$(obj)fw_printenv: $(SRCS) $(HEADERS) - $(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv - -clean: - rm -f $(obj)fw_printenv $(obj)crc32.c - -$(obj)crc32.c: - ln -s $(src)../../lib_generic/crc32.c $(obj)crc32.c - -######################################################################### - -include $(TOPDIR)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/tools/env/README b/tools/env/README deleted file mode 100644 index d8386f7f2d..0000000000 --- a/tools/env/README +++ /dev/null @@ -1,44 +0,0 @@ - -This is a demo implementation of a Linux command line tool to access -the U-Boot's environment variables. - -For the run-time utiltity configuration uncomment the line -#define CONFIG_FILE "/etc/fw_env.config" -in fw_env.h. - -See comments in the fw_env.config file for definitions for the -particular board. - -Configuration can also be done via #defines in the fw_env.h file. The -following lines are relevant: - -#define HAVE_REDUND /* For systems with 2 env sectors */ -#define DEVICE1_NAME "/dev/mtd1" -#define DEVICE2_NAME "/dev/mtd2" -#define DEVICE1_OFFSET 0x0000 -#define ENV1_SIZE 0x4000 -#define DEVICE1_ESIZE 0x4000 -#define DEVICE2_OFFSET 0x0000 -#define ENV2_SIZE 0x4000 -#define DEVICE2_ESIZE 0x4000 - -Current configuration matches the environment layout of the TRAB -board. - -Un-define HAVE_REDUND, if you want to use the utlities on a system -that does not have support for redundant environment enabled. -If HAVE_REDUND is undefined, DEVICE2_NAME is ignored, -as is ENV2_SIZE and DEVICE2_ESIZE. - -The DEVICEx_NAME constants define which MTD character devices are to -be used to access the environment. - -The DEVICEx_OFFSET constants define the environment offset within the -MTD character device. - -ENVx_SIZE defines the size in bytes taken by the environment, which -may be less then flash sector size, if the environment takes less -then 1 sector. - -DEVICEx_ESIZE defines the size of the first sector in the flash -partition where the environment resides. diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c deleted file mode 100644 index f723b5bca1..0000000000 --- a/tools/env/fw_env.c +++ /dev/null @@ -1,768 +0,0 @@ -/* - * (C) Copyright 2000-2003 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "fw_env.h" - -typedef unsigned char uchar; - -#define CMD_GETENV "fw_printenv" -#define CMD_SETENV "fw_setenv" - -typedef struct envdev_s { - uchar devname[16]; /* Device name */ - ulong devoff; /* Device offset */ - ulong env_size; /* environment size */ - ulong erase_size; /* device erase size */ -} envdev_t; - -static envdev_t envdevices[2]; -static int curdev; - -#define DEVNAME(i) envdevices[(i)].devname -#define DEVOFFSET(i) envdevices[(i)].devoff -#define ENVSIZE(i) envdevices[(i)].env_size -#define DEVESIZE(i) envdevices[(i)].erase_size - -#define CFG_ENV_SIZE ENVSIZE(curdev) - -#define ENV_SIZE getenvsize() - -typedef struct environment_s { - ulong crc; /* CRC32 over data bytes */ - uchar flags; /* active or obsolete */ - uchar *data; -} env_t; - -static env_t environment; - -static int HaveRedundEnv = 0; - -static uchar active_flag = 1; -static uchar obsolete_flag = 0; - - -#define XMK_STR(x) #x -#define MK_STR(x) XMK_STR(x) - -static uchar default_environment[] = { -#if defined(CONFIG_BOOTARGS) - "bootargs=" CONFIG_BOOTARGS "\0" -#endif -#if defined(CONFIG_BOOTCOMMAND) - "bootcmd=" CONFIG_BOOTCOMMAND "\0" -#endif -#if defined(CONFIG_RAMBOOTCOMMAND) - "ramboot=" CONFIG_RAMBOOTCOMMAND "\0" -#endif -#if defined(CONFIG_NFSBOOTCOMMAND) - "nfsboot=" CONFIG_NFSBOOTCOMMAND "\0" -#endif -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) - "bootdelay=" MK_STR (CONFIG_BOOTDELAY) "\0" -#endif -#if defined(CONFIG_BAUDRATE) && (CONFIG_BAUDRATE >= 0) - "baudrate=" MK_STR (CONFIG_BAUDRATE) "\0" -#endif -#ifdef CONFIG_LOADS_ECHO - "loads_echo=" MK_STR (CONFIG_LOADS_ECHO) "\0" -#endif -#ifdef CONFIG_ETHADDR - "ethaddr=" MK_STR (CONFIG_ETHADDR) "\0" -#endif -#ifdef CONFIG_ETH1ADDR - "eth1addr=" MK_STR (CONFIG_ETH1ADDR) "\0" -#endif -#ifdef CONFIG_ETH2ADDR - "eth2addr=" MK_STR (CONFIG_ETH2ADDR) "\0" -#endif -#ifdef CONFIG_ETH3ADDR - "eth3addr=" MK_STR (CONFIG_ETH3ADDR) "\0" -#endif -#ifdef CONFIG_ETHPRIME - "ethprime=" CONFIG_ETHPRIME "\0" -#endif -#ifdef CONFIG_IPADDR - "ipaddr=" MK_STR (CONFIG_IPADDR) "\0" -#endif -#ifdef CONFIG_SERVERIP - "serverip=" MK_STR (CONFIG_SERVERIP) "\0" -#endif -#ifdef CFG_AUTOLOAD - "autoload=" CFG_AUTOLOAD "\0" -#endif -#ifdef CONFIG_ROOTPATH - "rootpath=" MK_STR (CONFIG_ROOTPATH) "\0" -#endif -#ifdef CONFIG_GATEWAYIP - "gatewayip=" MK_STR (CONFIG_GATEWAYIP) "\0" -#endif -#ifdef CONFIG_NETMASK - "netmask=" MK_STR (CONFIG_NETMASK) "\0" -#endif -#ifdef CONFIG_HOSTNAME - "hostname=" MK_STR (CONFIG_HOSTNAME) "\0" -#endif -#ifdef CONFIG_BOOTFILE - "bootfile=" MK_STR (CONFIG_BOOTFILE) "\0" -#endif -#ifdef CONFIG_LOADADDR - "loadaddr=" MK_STR (CONFIG_LOADADDR) "\0" -#endif -#ifdef CONFIG_PREBOOT - "preboot=" CONFIG_PREBOOT "\0" -#endif -#ifdef CONFIG_CLOCKS_IN_MHZ - "clocks_in_mhz=" "1" "\0" -#endif -#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) - "pcidelay=" MK_STR (CONFIG_PCI_BOOTDELAY) "\0" -#endif -#ifdef CONFIG_EXTRA_ENV_SETTINGS - CONFIG_EXTRA_ENV_SETTINGS -#endif - "\0" /* Termimate env_t data with 2 NULs */ -}; - -static int flash_io (int mode); -static uchar *envmatch (uchar * s1, uchar * s2); -static int env_init (void); -static int parse_config (void); - -#if defined(CONFIG_FILE) -static int get_config (char *); -#endif -static inline ulong getenvsize (void) -{ - ulong rc = CFG_ENV_SIZE - sizeof (long); - - if (HaveRedundEnv) - rc -= sizeof (char); - return rc; -} - -/* - * Search the environment for a variable. - * Return the value, if found, or NULL, if not found. - */ -unsigned char *fw_getenv (unsigned char *name) -{ - uchar *env, *nxt; - - if (env_init ()) - return (NULL); - - for (env = environment.data; *env; env = nxt + 1) { - uchar *val; - - for (nxt = env; *nxt; ++nxt) { - if (nxt >= &environment.data[ENV_SIZE]) { - fprintf (stderr, "## Error: " - "environment not terminated\n"); - return (NULL); - } - } - val = envmatch (name, env); - if (!val) - continue; - return (val); - } - return (NULL); -} - -/* - * Print the current definition of one, or more, or all - * environment variables - */ -void fw_printenv (int argc, char *argv[]) -{ - uchar *env, *nxt; - int i, n_flag; - - if (env_init ()) - return; - - if (argc == 1) { /* Print all env variables */ - for (env = environment.data; *env; env = nxt + 1) { - for (nxt = env; *nxt; ++nxt) { - if (nxt >= &environment.data[ENV_SIZE]) { - fprintf (stderr, "## Error: " - "environment not terminated\n"); - return; - } - } - - printf ("%s\n", env); - } - return; - } - - if (strcmp (argv[1], "-n") == 0) { - n_flag = 1; - ++argv; - --argc; - if (argc != 2) { - fprintf (stderr, "## Error: " - "`-n' option requires exactly one argument\n"); - return; - } - } else { - n_flag = 0; - } - - for (i = 1; i < argc; ++i) { /* print single env variables */ - uchar *name = argv[i]; - uchar *val = NULL; - - for (env = environment.data; *env; env = nxt + 1) { - - for (nxt = env; *nxt; ++nxt) { - if (nxt >= &environment.data[ENV_SIZE]) { - fprintf (stderr, "## Error: " - "environment not terminated\n"); - return; - } - } - val = envmatch (name, env); - if (val) { - if (!n_flag) { - fputs (name, stdout); - putc ('=', stdout); - } - puts (val); - break; - } - } - if (!val) - fprintf (stderr, "## Error: \"%s\" not defined\n", name); - } -} - -/* - * Deletes or sets environment variables. Returns errno style error codes: - * 0 - OK - * EINVAL - need at least 1 argument - * EROFS - certain variables ("ethaddr", "serial#") cannot be - * modified or deleted - * - */ -int fw_setenv (int argc, char *argv[]) -{ - int i, len; - uchar *env, *nxt; - uchar *oldval = NULL; - uchar *name; - - if (argc < 2) { - return (EINVAL); - } - - if (env_init ()) - return (errno); - - name = argv[1]; - - /* - * search if variable with this name already exists - */ - for (nxt = env = environment.data; *env; env = nxt + 1) { - for (nxt = env; *nxt; ++nxt) { - if (nxt >= &environment.data[ENV_SIZE]) { - fprintf (stderr, "## Error: " - "environment not terminated\n"); - return (EINVAL); - } - } - if ((oldval = envmatch (name, env)) != NULL) - break; - } - - /* - * Delete any existing definition - */ - if (oldval) { - /* - * Ethernet Address and serial# can be set only once - */ - if ((strcmp (name, "ethaddr") == 0) || - (strcmp (name, "serial#") == 0)) { - fprintf (stderr, "Can't overwrite \"%s\"\n", name); - return (EROFS); - } - - if (*++nxt == '\0') { - *env = '\0'; - } else { - for (;;) { - *env = *nxt++; - if ((*env == '\0') && (*nxt == '\0')) - break; - ++env; - } - } - *++env = '\0'; - } - - /* Delete only ? */ - if (argc < 3) - goto WRITE_FLASH; - - /* - * Append new definition at the end - */ - for (env = environment.data; *env || *(env + 1); ++env); - if (env > environment.data) - ++env; - /* - * Overflow when: - * "name" + "=" + "val" +"\0\0" > CFG_ENV_SIZE - (env-environment) - */ - len = strlen (name) + 2; - /* add '=' for first arg, ' ' for all others */ - for (i = 2; i < argc; ++i) { - len += strlen (argv[i]) + 1; - } - if (len > (&environment.data[ENV_SIZE] - env)) { - fprintf (stderr, - "Error: environment overflow, \"%s\" deleted\n", - name); - return (-1); - } - while ((*env = *name++) != '\0') - env++; - for (i = 2; i < argc; ++i) { - uchar *val = argv[i]; - - *env = (i == 2) ? '=' : ' '; - while ((*++env = *val++) != '\0'); - } - - /* end is marked with double '\0' */ - *++env = '\0'; - - WRITE_FLASH: - - /* Update CRC */ - environment.crc = crc32 (0, environment.data, ENV_SIZE); - - /* write environment back to flash */ - if (flash_io (O_RDWR)) { - fprintf (stderr, "Error: can't write fw_env to flash\n"); - return (-1); - } - - return (0); -} - -static int flash_io (int mode) -{ - int fd, fdr, rc, otherdev, len, resid; - erase_info_t erase; - char *data = NULL; - - if ((fd = open (DEVNAME (curdev), mode)) < 0) { - fprintf (stderr, - "Can't open %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - - len = sizeof (environment.crc); - if (HaveRedundEnv) { - len += sizeof (environment.flags); - } - - if (mode == O_RDWR) { - if (HaveRedundEnv) { - /* switch to next partition for writing */ - otherdev = !curdev; - if ((fdr = open (DEVNAME (otherdev), mode)) < 0) { - fprintf (stderr, - "Can't open %s: %s\n", - DEVNAME (otherdev), - strerror (errno)); - return (-1); - } - } else { - otherdev = curdev; - fdr = fd; - } - printf ("Unlocking flash...\n"); - erase.length = DEVESIZE (otherdev); - erase.start = DEVOFFSET (otherdev); - ioctl (fdr, MEMUNLOCK, &erase); - - if (HaveRedundEnv) { - erase.length = DEVESIZE (curdev); - erase.start = DEVOFFSET (curdev); - ioctl (fd, MEMUNLOCK, &erase); - environment.flags = active_flag; - } - - printf ("Done\n"); - resid = DEVESIZE (otherdev) - CFG_ENV_SIZE; - if (resid) { - if ((data = malloc (resid)) == NULL) { - fprintf (stderr, - "Cannot malloc %d bytes: %s\n", - resid, - strerror (errno)); - return (-1); - } - if (lseek (fdr, DEVOFFSET (otherdev) + CFG_ENV_SIZE, SEEK_SET) - == -1) { - fprintf (stderr, "seek error on %s: %s\n", - DEVNAME (otherdev), - strerror (errno)); - return (-1); - } - if ((rc = read (fdr, data, resid)) != resid) { - fprintf (stderr, - "read error on %s: %s\n", - DEVNAME (otherdev), - strerror (errno)); - return (-1); - } - } - - printf ("Erasing old environment...\n"); - - erase.length = DEVESIZE (otherdev); - erase.start = DEVOFFSET (otherdev); - if (ioctl (fdr, MEMERASE, &erase) != 0) { - fprintf (stderr, "MTD erase error on %s: %s\n", - DEVNAME (otherdev), - strerror (errno)); - return (-1); - } - - printf ("Done\n"); - - printf ("Writing environment to %s...\n", DEVNAME (otherdev)); - if (lseek (fdr, DEVOFFSET (otherdev), SEEK_SET) == -1) { - fprintf (stderr, - "seek error on %s: %s\n", - DEVNAME (otherdev), strerror (errno)); - return (-1); - } - if (write (fdr, &environment, len) != len) { - fprintf (stderr, - "CRC write error on %s: %s\n", - DEVNAME (otherdev), strerror (errno)); - return (-1); - } - if (write (fdr, environment.data, ENV_SIZE) != ENV_SIZE) { - fprintf (stderr, - "Write error on %s: %s\n", - DEVNAME (otherdev), strerror (errno)); - return (-1); - } - if (resid) { - if (write (fdr, data, resid) != resid) { - fprintf (stderr, - "write error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - free (data); - } - if (HaveRedundEnv) { - /* change flag on current active env partition */ - if (lseek (fd, DEVOFFSET (curdev) + sizeof (ulong), SEEK_SET) - == -1) { - fprintf (stderr, "seek error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - if (write (fd, &obsolete_flag, sizeof (obsolete_flag)) != - sizeof (obsolete_flag)) { - fprintf (stderr, - "Write error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - } - printf ("Done\n"); - printf ("Locking ...\n"); - erase.length = DEVESIZE (otherdev); - erase.start = DEVOFFSET (otherdev); - ioctl (fdr, MEMLOCK, &erase); - if (HaveRedundEnv) { - erase.length = DEVESIZE (curdev); - erase.start = DEVOFFSET (curdev); - ioctl (fd, MEMLOCK, &erase); - if (close (fdr)) { - fprintf (stderr, - "I/O error on %s: %s\n", - DEVNAME (otherdev), - strerror (errno)); - return (-1); - } - } - printf ("Done\n"); - } else { - - if (lseek (fd, DEVOFFSET (curdev), SEEK_SET) == -1) { - fprintf (stderr, - "seek error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - if (read (fd, &environment, len) != len) { - fprintf (stderr, - "CRC read error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - if ((rc = read (fd, environment.data, ENV_SIZE)) != ENV_SIZE) { - fprintf (stderr, - "Read error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - } - - if (close (fd)) { - fprintf (stderr, - "I/O error on %s: %s\n", - DEVNAME (curdev), strerror (errno)); - return (-1); - } - - /* everything ok */ - return (0); -} - -/* - * s1 is either a simple 'name', or a 'name=value' pair. - * s2 is a 'name=value' pair. - * If the names match, return the value of s2, else NULL. - */ - -static uchar *envmatch (uchar * s1, uchar * s2) -{ - - while (*s1 == *s2++) - if (*s1++ == '=') - return (s2); - if (*s1 == '\0' && *(s2 - 1) == '=') - return (s2); - return (NULL); -} - -/* - * Prevent confusion if running from erased flash memory - */ -static int env_init (void) -{ - int crc1, crc1_ok; - uchar *addr1; - - int crc2, crc2_ok; - uchar flag1, flag2, *addr2; - - if (parse_config ()) /* should fill envdevices */ - return 1; - - if ((addr1 = calloc (1, ENV_SIZE)) == NULL) { - fprintf (stderr, - "Not enough memory for environment (%ld bytes)\n", - ENV_SIZE); - return (errno); - } - - /* read environment from FLASH to local buffer */ - environment.data = addr1; - curdev = 0; - if (flash_io (O_RDONLY)) { - return (errno); - } - - crc1_ok = ((crc1 = crc32 (0, environment.data, ENV_SIZE)) - == environment.crc); - if (!HaveRedundEnv) { - if (!crc1_ok) { - fprintf (stderr, - "Warning: Bad CRC, using default environment\n"); - memcpy(environment.data, default_environment, sizeof default_environment); - } - } else { - flag1 = environment.flags; - - curdev = 1; - if ((addr2 = calloc (1, ENV_SIZE)) == NULL) { - fprintf (stderr, - "Not enough memory for environment (%ld bytes)\n", - ENV_SIZE); - return (errno); - } - environment.data = addr2; - - if (flash_io (O_RDONLY)) { - return (errno); - } - - crc2_ok = ((crc2 = crc32 (0, environment.data, ENV_SIZE)) - == environment.crc); - flag2 = environment.flags; - - if (crc1_ok && !crc2_ok) { - environment.data = addr1; - environment.flags = flag1; - environment.crc = crc1; - curdev = 0; - free (addr2); - } else if (!crc1_ok && crc2_ok) { - environment.data = addr2; - environment.flags = flag2; - environment.crc = crc2; - curdev = 1; - free (addr1); - } else if (!crc1_ok && !crc2_ok) { - fprintf (stderr, - "Warning: Bad CRC, using default environment\n"); - memcpy(environment.data, default_environment, sizeof default_environment); - curdev = 0; - free (addr1); - } else if (flag1 == active_flag && flag2 == obsolete_flag) { - environment.data = addr1; - environment.flags = flag1; - environment.crc = crc1; - curdev = 0; - free (addr2); - } else if (flag1 == obsolete_flag && flag2 == active_flag) { - environment.data = addr2; - environment.flags = flag2; - environment.crc = crc2; - curdev = 1; - free (addr1); - } else if (flag1 == flag2) { - environment.data = addr1; - environment.flags = flag1; - environment.crc = crc1; - curdev = 0; - free (addr2); - } else if (flag1 == 0xFF) { - environment.data = addr1; - environment.flags = flag1; - environment.crc = crc1; - curdev = 0; - free (addr2); - } else if (flag2 == 0xFF) { - environment.data = addr2; - environment.flags = flag2; - environment.crc = crc2; - curdev = 1; - free (addr1); - } - } - return (0); -} - - -static int parse_config () -{ - struct stat st; - -#if defined(CONFIG_FILE) - /* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */ - if (get_config (CONFIG_FILE)) { - fprintf (stderr, - "Cannot parse config file: %s\n", strerror (errno)); - return 1; - } -#else - strcpy (DEVNAME (0), DEVICE1_NAME); - DEVOFFSET (0) = DEVICE1_OFFSET; - ENVSIZE (0) = ENV1_SIZE; - DEVESIZE (0) = DEVICE1_ESIZE; -#ifdef HAVE_REDUND - strcpy (DEVNAME (1), DEVICE2_NAME); - DEVOFFSET (1) = DEVICE2_OFFSET; - ENVSIZE (1) = ENV2_SIZE; - DEVESIZE (1) = DEVICE2_ESIZE; - HaveRedundEnv = 1; -#endif -#endif - if (stat (DEVNAME (0), &st)) { - fprintf (stderr, - "Cannot access MTD device %s: %s\n", - DEVNAME (0), strerror (errno)); - return 1; - } - - if (HaveRedundEnv && stat (DEVNAME (1), &st)) { - fprintf (stderr, - "Cannot access MTD device %s: %s\n", - DEVNAME (1), strerror (errno)); - return 1; - } - return 0; -} - -#if defined(CONFIG_FILE) -static int get_config (char *fname) -{ - FILE *fp; - int i = 0; - int rc; - char dump[128]; - - if ((fp = fopen (fname, "r")) == NULL) { - return 1; - } - - while ((i < 2) && ((rc = fscanf (fp, "%s %lx %lx %lx", - DEVNAME (i), - &DEVOFFSET (i), - &ENVSIZE (i), - &DEVESIZE (i) )) != EOF)) { - - /* Skip incomplete conversions and comment strings */ - if ((rc < 3) || (*DEVNAME (i) == '#')) { - fgets (dump, sizeof (dump), fp); /* Consume till end */ - continue; - } - - i++; - } - fclose (fp); - - HaveRedundEnv = i - 1; - if (!i) { /* No valid entries found */ - errno = EINVAL; - return 1; - } else - return 0; -} -#endif diff --git a/tools/env/fw_env.config b/tools/env/fw_env.config deleted file mode 100644 index 2432bd866c..0000000000 --- a/tools/env/fw_env.config +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration file for fw_(printenv/saveenv) utility. -# Up to two entries are valid, in this case the redundand -# environment sector is assumed present. - -# MTD device name Device offset Env. size Flash sector size -/dev/mtd1 0x0000 0x4000 0x4000 -/dev/mtd2 0x0000 0x4000 0x4000 diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h deleted file mode 100644 index 13c45a2780..0000000000 --- a/tools/env/fw_env.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (C) Copyright 2002 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -/* - * To build the utility with the run-time configuration - * uncomment the next line. - * See included "fw_env.config" sample file (TRAB board) - * for notes on configuration. - */ -#define CONFIG_FILE "/etc/fw_env.config" - -#define HAVE_REDUND /* For systems with 2 env sectors */ -#define DEVICE1_NAME "/dev/mtd1" -#define DEVICE2_NAME "/dev/mtd2" -#define DEVICE1_OFFSET 0x0000 -#define ENV1_SIZE 0x4000 -#define DEVICE1_ESIZE 0x4000 -#define DEVICE2_OFFSET 0x0000 -#define ENV2_SIZE 0x4000 -#define DEVICE2_ESIZE 0x4000 - -#define CONFIG_BAUDRATE 115200 -#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ -#define CONFIG_BOOTCOMMAND \ - "bootp; " \ - "setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} " \ - "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " \ - "bootm" - -extern void fw_printenv(int argc, char *argv[]); -extern unsigned char *fw_getenv (unsigned char *name); -extern int fw_setenv (int argc, char *argv[]); - -extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned); diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c deleted file mode 100644 index 696e30efda..0000000000 --- a/tools/env/fw_env_main.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -/* - * Command line user interface to firmware (=U-Boot) environment. - * - * Implements: - * fw_printenv [ name ... ] - * - prints the values of the environment variables - * "name", or the whole environment if no names are - * specified - * fw_setenv name [ value ... ] - * - If a name without any values is given, the variable - * with this name is deleted from the environment; - * otherwise, all "value" arguments are concatenated, - * separated by sinlge blank characters, and the - * resulting string is assigned to the environment - * variable "name" - */ - -#include -#include -#include -#include "fw_env.h" - -#define CMD_PRINTENV "fw_printenv" -#define CMD_SETENV "fw_setenv" - -int -main(int argc, char *argv[]) -{ - char *p; - char *cmdname = *argv; - - if ((p = strrchr (cmdname, '/')) != NULL) { - cmdname = p + 1; - } - - if (strcmp(cmdname, CMD_PRINTENV) == 0) { - - fw_printenv (argc, argv); - - return (EXIT_SUCCESS); - - } else if (strcmp(cmdname, CMD_SETENV) == 0) { - - if (fw_setenv (argc, argv) != 0) - return (EXIT_FAILURE); - - return (EXIT_SUCCESS); - } - - fprintf (stderr, - "Identity crisis - may be called as `" CMD_PRINTENV - "' or as `" CMD_SETENV "' but not as `%s'\n", - cmdname); - return (EXIT_FAILURE); -} diff --git a/tools/envcrc.c b/tools/envcrc.c deleted file mode 100644 index 7b7718324e..0000000000 --- a/tools/envcrc.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * (C) Copyright 2001 - * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include - -#ifndef __ASSEMBLY__ -#define __ASSEMBLY__ /* Dirty trick to get only #defines */ -#endif -#define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ -#include -#undef __ASSEMBLY__ - -#if defined(CFG_ENV_IS_IN_FLASH) -# ifndef CFG_ENV_ADDR -# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET) -# endif -# ifndef CFG_ENV_OFFSET -# define CFG_ENV_OFFSET (CFG_ENV_ADDR - CFG_FLASH_BASE) -# endif -# if !defined(CFG_ENV_ADDR_REDUND) && defined(CFG_ENV_OFFSET_REDUND) -# define CFG_ENV_ADDR_REDUND (CFG_FLASH_BASE + CFG_ENV_OFFSET_REDUND) -# endif -# ifndef CFG_ENV_SIZE -# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE -# endif -# if defined(CFG_ENV_ADDR_REDUND) && !defined(CFG_ENV_SIZE_REDUND) -# define CFG_ENV_SIZE_REDUND CFG_ENV_SIZE -# endif -# if (CFG_ENV_ADDR >= CFG_MONITOR_BASE) && \ - ((CFG_ENV_ADDR + CFG_ENV_SIZE) <= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) -# define ENV_IS_EMBEDDED 1 -# endif -# if defined(CFG_ENV_ADDR_REDUND) || defined(CFG_ENV_OFFSET_REDUND) -# define CFG_REDUNDAND_ENVIRONMENT 1 -# endif -#endif /* CFG_ENV_IS_IN_FLASH */ - -#ifdef CFG_REDUNDAND_ENVIRONMENT -# define ENV_HEADER_SIZE (sizeof(unsigned long) + 1) -#else -# define ENV_HEADER_SIZE (sizeof(unsigned long)) -#endif - -#define ENV_SIZE (CFG_ENV_SIZE - ENV_HEADER_SIZE) - - -extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int); - -#ifdef ENV_IS_EMBEDDED -extern unsigned int env_size; -extern unsigned char environment; -#endif /* ENV_IS_EMBEDDED */ - -int main (int argc, char **argv) -{ -#ifdef ENV_IS_EMBEDDED - int crc; - unsigned char *envptr = &environment, - *dataptr = envptr + ENV_HEADER_SIZE; - unsigned int datasize = ENV_SIZE; - - crc = crc32 (0, dataptr, datasize); - - /* Check if verbose mode is activated passing a parameter to the program */ - if (argc > 1) { - printf ("CRC32 from offset %08X to %08X of environment = %08X\n", - (unsigned int) (dataptr - envptr), - (unsigned int) (dataptr - envptr) + datasize, - crc); - } else { - printf ("0x%08X\n", crc); - } -#else - printf ("0\n"); -#endif - return EXIT_SUCCESS; -} diff --git a/tools/gdb/Makefile b/tools/gdb/Makefile deleted file mode 100644 index 632103d453..0000000000 --- a/tools/gdb/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# (C) Copyright 2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# (C) Copyright 2000 -# Murray Jensen -# -# See file CREDITS for list of people who contributed to this -# project. -# -# 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 -# - -include $(TOPDIR)/config.mk - -BINS = gdbsend gdbcont - -COBJS = gdbsend.o gdbcont.o error.o remote.o serial.o - -OBJS := $(addprefix $(obj),$(COBJS)) -SRCS := $(COBJS:.o=.c) -BINS := $(addprefix $(obj),$(BINS)) - -# -# Use native tools and options -# -CPPFLAGS = -I$(BFD_ROOT_DIR)/include -CFLAGS = $(HOST_CFLAGS) -O $(CPPFLAGS) -CC = $(HOSTCC) -MAKEDEPEND = makedepend - -HOSTOS := $(shell uname -s | sed -e 's/\([Cc][Yy][Gg][Ww][Ii][Nn]\).*/cygwin/') - -ifeq ($(HOSTOS),cygwin) - -all: -.depend: - -else # ! CYGWIN - -all: $(obj).depend $(BINS) - -$(obj)gdbsend: $(obj)gdbsend.o $(obj)error.o $(obj)remote.o $(obj)serial.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - -$(obj)gdbcont: $(obj)gdbcont.o $(obj)error.o $(obj)remote.o $(obj)serial.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - -clean: - rm -f $(OBJS) - -distclean: clean - rm -f $(BINS) $(obj)core $(obj)*.bak $(obj).depend - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### - -endif # cygwin diff --git a/tools/gdb/error.c b/tools/gdb/error.c deleted file mode 100644 index 276a00a677..0000000000 --- a/tools/gdb/error.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include -#include -#include "error.h" - -char *pname; - -void -Warning(char *fmt, ...) -{ - va_list args; - - fprintf(stderr, "%s: WARNING: ", pname); - - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - - fprintf(stderr, "\n"); -} - -void -Error(char *fmt, ...) -{ - va_list args; - - fprintf(stderr, "%s: ERROR: ", pname); - - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - - fprintf(stderr, "\n"); - - exit(1); -} - -void -Perror(char *fmt, ...) -{ - va_list args; - int e = errno; - char *p; - - fprintf(stderr, "%s: ERROR: ", pname); - - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - - if ((p = strerror(e)) == NULL || *p == '\0') - fprintf(stderr, ": Unknown Error (%d)\n", e); - else - fprintf(stderr, ": %s\n", p); - - exit(1); -} diff --git a/tools/gdb/error.h b/tools/gdb/error.h deleted file mode 100644 index 0698213306..0000000000 --- a/tools/gdb/error.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include - -extern char *pname; - -extern void Warning(char *, ...); -extern void Error(char *, ...); -extern void Perror(char *, ...); diff --git a/tools/gdb/gdbcont.c b/tools/gdb/gdbcont.c deleted file mode 100644 index 300545d8e1..0000000000 --- a/tools/gdb/gdbcont.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include -#include -#include "serial.h" -#include "error.h" -#include "remote.h" - -char *serialdev = "/dev/term/b"; -speed_t speed = B230400; -int verbose = 0; - -int -main(int ac, char **av) -{ - int c, sfd; - - if ((pname = strrchr(av[0], '/')) == NULL) - pname = av[0]; - else - pname++; - - while ((c = getopt(ac, av, "b:p:v")) != EOF) - switch (c) { - - case 'b': - if ((speed = cvtspeed(optarg)) == B0) - Error("can't decode baud rate specified in -b option"); - break; - - case 'p': - serialdev = optarg; - break; - - case 'v': - verbose = 1; - break; - - default: - usage: - fprintf(stderr, "Usage: %s [-b bps] [-p dev] [-v]\n", pname); - exit(1); - } - if (optind != ac) - goto usage; - - if (verbose) - fprintf(stderr, "Opening serial port and sending continue...\n"); - - if ((sfd = serialopen(serialdev, speed)) < 0) - Perror("open of serial device '%s' failed", serialdev); - - remote_desc = sfd; - remote_reset(); - remote_continue(); - - if (serialclose(sfd) < 0) - Perror("close of serial device '%s' failed", serialdev); - - if (verbose) - fprintf(stderr, "Done.\n"); - - return (0); -} diff --git a/tools/gdb/gdbsend.c b/tools/gdb/gdbsend.c deleted file mode 100644 index 8cd8347159..0000000000 --- a/tools/gdb/gdbsend.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include -#include -#include -#include -#include -#include "serial.h" -#include "error.h" -#include "remote.h" - -char *serialdev = "/dev/term/b"; -speed_t speed = B230400; -int verbose = 0, docont = 0; -unsigned long addr = 0x10000UL; - -int -main(int ac, char **av) -{ - int c, sfd, ifd; - char *ifn, *image; - struct stat ist; - - if ((pname = strrchr(av[0], '/')) == NULL) - pname = av[0]; - else - pname++; - - while ((c = getopt(ac, av, "a:b:cp:v")) != EOF) - switch (c) { - - case 'a': { - char *ep; - - addr = strtol(optarg, &ep, 0); - if (ep == optarg || *ep != '\0') - Error("can't decode address specified in -a option"); - break; - } - - case 'b': - if ((speed = cvtspeed(optarg)) == B0) - Error("can't decode baud rate specified in -b option"); - break; - - case 'c': - docont = 1; - break; - - case 'p': - serialdev = optarg; - break; - - case 'v': - verbose = 1; - break; - - default: - usage: - fprintf(stderr, - "Usage: %s [-a addr] [-b bps] [-c] [-p dev] [-v] imagefile\n", - pname); - exit(1); - } - - if (optind != ac - 1) - goto usage; - ifn = av[optind++]; - - if (verbose) - fprintf(stderr, "Opening file and reading image...\n"); - - if ((ifd = open(ifn, O_RDONLY)) < 0) - Perror("can't open kernel image file '%s'", ifn); - - if (fstat(ifd, &ist) < 0) - Perror("fstat '%s' failed", ifn); - - if ((image = (char *)malloc(ist.st_size)) == NULL) - Perror("can't allocate %ld bytes for image", ist.st_size); - - if ((c = read(ifd, image, ist.st_size)) < 0) - Perror("read of %d bytes from '%s' failed", ist.st_size, ifn); - - if (c != ist.st_size) - Error("read of %ld bytes from '%s' failed (%d)", ist.st_size, ifn, c); - - if (close(ifd) < 0) - Perror("close of '%s' failed", ifn); - - if (verbose) - fprintf(stderr, "Opening serial port and sending image...\n"); - - if ((sfd = serialopen(serialdev, speed)) < 0) - Perror("open of serial device '%s' failed", serialdev); - - remote_desc = sfd; - remote_reset(); - remote_write_bytes(addr, image, ist.st_size); - - if (docont) { - if (verbose) - fprintf(stderr, "[continue]"); - remote_continue(); - } - - if (serialclose(sfd) < 0) - Perror("close of serial device '%s' failed", serialdev); - - if (verbose) - fprintf(stderr, "Done.\n"); - - return (0); -} diff --git a/tools/gdb/remote.c b/tools/gdb/remote.c deleted file mode 100644 index 5df0055ade..0000000000 --- a/tools/gdb/remote.c +++ /dev/null @@ -1,916 +0,0 @@ -/* - * taken from gdb/remote.c - * - * I am only interested in the write to memory stuff - everything else - * has been ripped out - * - * all the copyright notices etc have been left in - */ - -/* enough so that it will compile */ -#include -#include -#include -#include - -/*nicked from gcc..*/ - -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) -#include -#else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) -#include -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -#include - #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#endif /* __hpux */ -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#ifdef __cplusplus -extern "C" { -#endif - void* alloca(size_t); -#ifdef __cplusplus -} -#endif -#endif /* alloca not defined. */ - - -#include "serial.h" -#include "error.h" -#include "remote.h" -#define REGISTER_BYTES 0 -#define fprintf_unfiltered fprintf -#define fprintf_filtered fprintf -#define fputs_unfiltered fputs -#define fputs_filtered fputs -#define fputc_unfiltered fputc -#define fputc_filtered fputc -#define printf_unfiltered printf -#define printf_filtered printf -#define puts_unfiltered puts -#define puts_filtered puts -#define putchar_unfiltered putchar -#define putchar_filtered putchar -#define fputstr_unfiltered(a,b,c) fputs((a), (c)) -#define gdb_stdlog stderr -#define SERIAL_READCHAR(fd,timo) serialreadchar((fd), (timo)) -#define SERIAL_WRITE(fd, addr, len) serialwrite((fd), (addr), (len)) -#define error Error -#define perror_with_name Perror -#define gdb_flush fflush -#define max(a,b) (((a)>(b))?(a):(b)) -#define min(a,b) (((a)<(b))?(a):(b)) -#define target_mourn_inferior() {} -#define ULONGEST unsigned long -#define CORE_ADDR unsigned long - -static int putpkt (char *); -static int putpkt_binary(char *, int); -static void getpkt (char *, int); - -static int remote_debug = 0, remote_register_buf_size = 0, watchdog = 0; - -int remote_desc = -1, remote_timeout = 10; - -static void -fputstrn_unfiltered(char *s, int n, int x, FILE *fp) -{ - while (n-- > 0) - fputc(*s++, fp); -} - -void -remote_reset(void) -{ - SERIAL_WRITE(remote_desc, "+", 1); -} - -void -remote_continue(void) -{ - putpkt("c"); -} - -/* Remote target communications for serial-line targets in custom GDB protocol - Copyright 1988, 91, 92, 93, 94, 95, 96, 97, 98, 1999 - Free Software Foundation, Inc. - - This file is part of GDB. - - 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. */ -/* *INDENT-OFF* */ -/* Remote communication protocol. - - A debug packet whose contents are - is encapsulated for transmission in the form: - - $ # CSUM1 CSUM2 - - must be ASCII alphanumeric and cannot include characters - '$' or '#'. If starts with two characters followed by - ':', then the existing stubs interpret this as a sequence number. - - CSUM1 and CSUM2 are ascii hex representation of an 8-bit - checksum of , the most significant nibble is sent first. - the hex digits 0-9,a-f are used. - - Receiver responds with: - - + - if CSUM is correct and ready for next packet - - - if CSUM is incorrect - - is as follows: - Most values are encoded in ascii hex digits. Signal numbers are according - to the numbering in target.h. - - Request Packet - - set thread Hct... Set thread for subsequent operations. - c = 'c' for thread used in step and - continue; t... can be -1 for all - threads. - c = 'g' for thread used in other - operations. If zero, pick a thread, - any thread. - reply OK for success - ENN for an error. - - read registers g - reply XX....X Each byte of register data - is described by two hex digits. - Registers are in the internal order - for GDB, and the bytes in a register - are in the same order the machine uses. - or ENN for an error. - - write regs GXX..XX Each byte of register data - is described by two hex digits. - reply OK for success - ENN for an error - - write reg Pn...=r... Write register n... with value r..., - which contains two hex digits for each - byte in the register (target byte - order). - reply OK for success - ENN for an error - (not supported by all stubs). - - read mem mAA..AA,LLLL AA..AA is address, LLLL is length. - reply XX..XX XX..XX is mem contents - Can be fewer bytes than requested - if able to read only part of the data. - or ENN NN is errno - - write mem MAA..AA,LLLL:XX..XX - AA..AA is address, - LLLL is number of bytes, - XX..XX is data - reply OK for success - ENN for an error (this includes the case - where only part of the data was - written). - - write mem XAA..AA,LLLL:XX..XX - (binary) AA..AA is address, - LLLL is number of bytes, - XX..XX is binary data - reply OK for success - ENN for an error - - continue cAA..AA AA..AA is address to resume - If AA..AA is omitted, - resume at same address. - - step sAA..AA AA..AA is address to resume - If AA..AA is omitted, - resume at same address. - - continue with Csig;AA..AA Continue with signal sig (hex signal - signal number). If ;AA..AA is omitted, - resume at same address. - - step with Ssig;AA..AA Like 'C' but step not continue. - signal - - last signal ? Reply the current reason for stopping. - This is the same reply as is generated - for step or cont : SAA where AA is the - signal number. - - detach D Reply OK. - - There is no immediate reply to step or cont. - The reply comes when the machine stops. - It is SAA AA is the signal number. - - or... TAAn...:r...;n...:r...;n...:r...; - AA = signal number - n... = register number (hex) - r... = register contents - n... = `thread' - r... = thread process ID. This is - a hex integer. - n... = other string not starting - with valid hex digit. - gdb should ignore this n,r pair - and go on to the next. This way - we can extend the protocol. - or... WAA The process exited, and AA is - the exit status. This is only - applicable for certains sorts of - targets. - or... XAA The process terminated with signal - AA. - or (obsolete) NAA;tttttttt;dddddddd;bbbbbbbb - AA = signal number - tttttttt = address of symbol "_start" - dddddddd = base of data section - bbbbbbbb = base of bss section. - Note: only used by Cisco Systems - targets. The difference between this - reply and the "qOffsets" query is that - the 'N' packet may arrive spontaneously - whereas the 'qOffsets' is a query - initiated by the host debugger. - or... OXX..XX XX..XX is hex encoding of ASCII data. This - can happen at any time while the - program is running and the debugger - should continue to wait for - 'W', 'T', etc. - - thread alive TXX Find out if the thread XX is alive. - reply OK thread is still alive - ENN thread is dead - - remote restart RXX Restart the remote server - - extended ops ! Use the extended remote protocol. - Sticky -- only needs to be set once. - - kill request k - - toggle debug d toggle debug flag (see 386 & 68k stubs) - reset r reset -- see sparc stub. - reserved On other requests, the stub should - ignore the request and send an empty - response ($#). This way - we can extend the protocol and GDB - can tell whether the stub it is - talking to uses the old or the new. - search tAA:PP,MM Search backwards starting at address - AA for a match with pattern PP and - mask MM. PP and MM are 4 bytes. - Not supported by all stubs. - - general query qXXXX Request info about XXXX. - general set QXXXX=yyyy Set value of XXXX to yyyy. - query sect offs qOffsets Get section offsets. Reply is - Text=xxx;Data=yyy;Bss=zzz - - Responses can be run-length encoded to save space. A '*' means that - the next character is an ASCII encoding giving a repeat count which - stands for that many repititions of the character preceding the '*'. - The encoding is n+29, yielding a printable character where n >=3 - (which is where rle starts to win). Don't use an n > 126. - - So - "0* " means the same as "0000". */ -/* *INDENT-ON* */ - -/* This variable (available to the user via "set remotebinarydownload") - dictates whether downloads are sent in binary (via the 'X' packet). - We assume that the stub can, and attempt to do it. This will be cleared if - the stub does not understand it. This switch is still needed, though - in cases when the packet is supported in the stub, but the connection - does not allow it (i.e., 7-bit serial connection only). */ -static int remote_binary_download = 1; - -/* Have we already checked whether binary downloads work? */ -static int remote_binary_checked; - -/* Maximum number of bytes to read/write at once. The value here - is chosen to fill up a packet (the headers account for the 32). */ -#define MAXBUFBYTES(N) (((N)-32)/2) - -/* Having this larger than 400 causes us to be incompatible with m68k-stub.c - and i386-stub.c. Normally, no one would notice because it only matters - for writing large chunks of memory (e.g. in downloads). Also, this needs - to be more than 400 if required to hold the registers (see below, where - we round it up based on REGISTER_BYTES). */ -/* Round up PBUFSIZ to hold all the registers, at least. */ -#define PBUFSIZ ((REGISTER_BYTES > MAXBUFBYTES (400)) \ - ? (REGISTER_BYTES * 2 + 32) \ - : 400) - - -/* This variable sets the number of bytes to be written to the target - in a single packet. Normally PBUFSIZ is satisfactory, but some - targets need smaller values (perhaps because the receiving end - is slow). */ - -static int remote_write_size = 0x7fffffff; - -/* This variable sets the number of bits in an address that are to be - sent in a memory ("M" or "m") packet. Normally, after stripping - leading zeros, the entire address would be sent. This variable - restricts the address to REMOTE_ADDRESS_SIZE bits. HISTORY: The - initial implementation of remote.c restricted the address sent in - memory packets to ``host::sizeof long'' bytes - (typically 32 - bits). Consequently, for 64 bit targets, the upper 32 bits of an - address was never sent. Since fixing this bug may cause a break in - some remote targets this variable is principly provided to - facilitate backward compatibility. */ - -static int remote_address_size; - -/* Convert hex digit A to a number. */ - -static int -fromhex (int a) -{ - if (a >= '0' && a <= '9') - return a - '0'; - else if (a >= 'a' && a <= 'f') - return a - 'a' + 10; - else if (a >= 'A' && a <= 'F') - return a - 'A' + 10; - else { - error ("Reply contains invalid hex digit %d", a); - return -1; - } -} - -/* Convert number NIB to a hex digit. */ - -static int -tohex (int nib) -{ - if (nib < 10) - return '0' + nib; - else - return 'a' + nib - 10; -} - -/* Return the number of hex digits in num. */ - -static int -hexnumlen (ULONGEST num) -{ - int i; - - for (i = 0; num != 0; i++) - num >>= 4; - - return max (i, 1); -} - -/* Set BUF to the hex digits representing NUM. */ - -static int -hexnumstr (char *buf, ULONGEST num) -{ - int i; - int len = hexnumlen (num); - - buf[len] = '\0'; - - for (i = len - 1; i >= 0; i--) - { - buf[i] = "0123456789abcdef"[(num & 0xf)]; - num >>= 4; - } - - return len; -} - -/* Mask all but the least significant REMOTE_ADDRESS_SIZE bits. */ - -static CORE_ADDR -remote_address_masked (CORE_ADDR addr) -{ - if (remote_address_size > 0 - && remote_address_size < (sizeof (ULONGEST) * 8)) - { - /* Only create a mask when that mask can safely be constructed - in a ULONGEST variable. */ - ULONGEST mask = 1; - mask = (mask << remote_address_size) - 1; - addr &= mask; - } - return addr; -} - -/* Determine whether the remote target supports binary downloading. - This is accomplished by sending a no-op memory write of zero length - to the target at the specified address. It does not suffice to send - the whole packet, since many stubs strip the eighth bit and subsequently - compute a wrong checksum, which causes real havoc with remote_write_bytes. - - NOTE: This can still lose if the serial line is not eight-bit clean. In - cases like this, the user should clear "remotebinarydownload". */ -static void -check_binary_download (CORE_ADDR addr) -{ - if (remote_binary_download && !remote_binary_checked) - { - char *buf = alloca (PBUFSIZ); - char *p; - remote_binary_checked = 1; - - p = buf; - *p++ = 'X'; - p += hexnumstr (p, (ULONGEST) addr); - *p++ = ','; - p += hexnumstr (p, (ULONGEST) 0); - *p++ = ':'; - *p = '\0'; - - putpkt_binary (buf, (int) (p - buf)); - getpkt (buf, 0); - - if (buf[0] == '\0') - remote_binary_download = 0; - } - - if (remote_debug) - { - if (remote_binary_download) - fprintf_unfiltered (gdb_stdlog, - "binary downloading suppported by target\n"); - else - fprintf_unfiltered (gdb_stdlog, - "binary downloading NOT suppported by target\n"); - } -} - -/* Write memory data directly to the remote machine. - This does not inform the data cache; the data cache uses this. - MEMADDR is the address in the remote memory space. - MYADDR is the address of the buffer in our space. - LEN is the number of bytes. - - Returns number of bytes transferred, or 0 for error. */ - -int -remote_write_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - unsigned char *buf = alloca (PBUFSIZ); - int max_buf_size; /* Max size of packet output buffer */ - int origlen; - extern int verbose; - - /* Verify that the target can support a binary download */ - check_binary_download (memaddr); - - /* Chop the transfer down if necessary */ - - max_buf_size = min (remote_write_size, PBUFSIZ); - if (remote_register_buf_size != 0) - max_buf_size = min (max_buf_size, remote_register_buf_size); - - /* Subtract header overhead from max payload size - $M,:#nn */ - max_buf_size -= 2 + hexnumlen (memaddr + len - 1) + 1 + hexnumlen (len) + 4; - - origlen = len; - while (len > 0) - { - unsigned char *p, *plen; - int todo; - int i; - - /* construct "M"","":" */ - /* sprintf (buf, "M%lx,%x:", (unsigned long) memaddr, todo); */ - memaddr = remote_address_masked (memaddr); - p = buf; - if (remote_binary_download) - { - *p++ = 'X'; - todo = min (len, max_buf_size); - } - else - { - *p++ = 'M'; - todo = min (len, max_buf_size / 2); /* num bytes that will fit */ - } - - p += hexnumstr ((char *)p, (ULONGEST) memaddr); - *p++ = ','; - - plen = p; /* remember where len field goes */ - p += hexnumstr ((char *)p, (ULONGEST) todo); - *p++ = ':'; - *p = '\0'; - - /* We send target system values byte by byte, in increasing byte - addresses, each byte encoded as two hex characters (or one - binary character). */ - if (remote_binary_download) - { - int escaped = 0; - for (i = 0; - (i < todo) && (i + escaped) < (max_buf_size - 2); - i++) - { - switch (myaddr[i] & 0xff) - { - case '$': - case '#': - case 0x7d: - /* These must be escaped */ - escaped++; - *p++ = 0x7d; - *p++ = (myaddr[i] & 0xff) ^ 0x20; - break; - default: - *p++ = myaddr[i] & 0xff; - break; - } - } - - if (i < todo) - { - /* Escape chars have filled up the buffer prematurely, - and we have actually sent fewer bytes than planned. - Fix-up the length field of the packet. */ - - /* FIXME: will fail if new len is a shorter string than - old len. */ - - plen += hexnumstr ((char *)plen, (ULONGEST) i); - *plen++ = ':'; - } - } - else - { - for (i = 0; i < todo; i++) - { - *p++ = tohex ((myaddr[i] >> 4) & 0xf); - *p++ = tohex (myaddr[i] & 0xf); - } - *p = '\0'; - } - - putpkt_binary ((char *)buf, (int) (p - buf)); - getpkt ((char *)buf, 0); - - if (buf[0] == 'E') - { - /* There is no correspondance between what the remote protocol uses - for errors and errno codes. We would like a cleaner way of - representing errors (big enough to include errno codes, bfd_error - codes, and others). But for now just return EIO. */ - errno = EIO; - return 0; - } - - /* Increment by i, not by todo, in case escape chars - caused us to send fewer bytes than we'd planned. */ - myaddr += i; - memaddr += i; - len -= i; - - if (verbose) - putc('.', stderr); - } - return origlen; -} - -/* Stuff for dealing with the packets which are part of this protocol. - See comment at top of file for details. */ - -/* Read a single character from the remote end, masking it down to 7 bits. */ - -static int -readchar (int timeout) -{ - int ch; - - ch = SERIAL_READCHAR (remote_desc, timeout); - - switch (ch) - { - case SERIAL_EOF: - error ("Remote connection closed"); - case SERIAL_ERROR: - perror_with_name ("Remote communication error"); - case SERIAL_TIMEOUT: - return ch; - default: - return ch & 0x7f; - } -} - -static int -putpkt (buf) - char *buf; -{ - return putpkt_binary (buf, strlen (buf)); -} - -/* Send a packet to the remote machine, with error checking. The data - of the packet is in BUF. The string in BUF can be at most PBUFSIZ - 5 - to account for the $, # and checksum, and for a possible /0 if we are - debugging (remote_debug) and want to print the sent packet as a string */ - -static int -putpkt_binary (buf, cnt) - char *buf; - int cnt; -{ - int i; - unsigned char csum = 0; - char *buf2 = alloca (PBUFSIZ); - char *junkbuf = alloca (PBUFSIZ); - - int ch; - int tcount = 0; - char *p; - - /* Copy the packet into buffer BUF2, encapsulating it - and giving it a checksum. */ - - if (cnt > BUFSIZ - 5) /* Prosanity check */ - abort (); - - p = buf2; - *p++ = '$'; - - for (i = 0; i < cnt; i++) - { - csum += buf[i]; - *p++ = buf[i]; - } - *p++ = '#'; - *p++ = tohex ((csum >> 4) & 0xf); - *p++ = tohex (csum & 0xf); - - /* Send it over and over until we get a positive ack. */ - - while (1) - { - int started_error_output = 0; - - if (remote_debug) - { - *p = '\0'; - fprintf_unfiltered (gdb_stdlog, "Sending packet: "); - fputstrn_unfiltered (buf2, p - buf2, 0, gdb_stdlog); - fprintf_unfiltered (gdb_stdlog, "..."); - gdb_flush (gdb_stdlog); - } - if (SERIAL_WRITE (remote_desc, buf2, p - buf2)) - perror_with_name ("putpkt: write failed"); - - /* read until either a timeout occurs (-2) or '+' is read */ - while (1) - { - ch = readchar (remote_timeout); - - if (remote_debug) - { - switch (ch) - { - case '+': - case SERIAL_TIMEOUT: - case '$': - if (started_error_output) - { - putchar_unfiltered ('\n'); - started_error_output = 0; - } - } - } - - switch (ch) - { - case '+': - if (remote_debug) - fprintf_unfiltered (gdb_stdlog, "Ack\n"); - return 1; - case SERIAL_TIMEOUT: - tcount++; - if (tcount > 3) - return 0; - break; /* Retransmit buffer */ - case '$': - { - /* It's probably an old response, and we're out of sync. - Just gobble up the packet and ignore it. */ - getpkt (junkbuf, 0); - continue; /* Now, go look for + */ - } - default: - if (remote_debug) - { - if (!started_error_output) - { - started_error_output = 1; - fprintf_unfiltered (gdb_stdlog, "putpkt: Junk: "); - } - fputc_unfiltered (ch & 0177, gdb_stdlog); - } - continue; - } - break; /* Here to retransmit */ - } - - } -} - -/* Come here after finding the start of the frame. Collect the rest - into BUF, verifying the checksum, length, and handling run-length - compression. Returns 0 on any error, 1 on success. */ - -static int -read_frame (char *buf) -{ - unsigned char csum; - char *bp; - int c; - - csum = 0; - bp = buf; - - while (1) - { - c = readchar (remote_timeout); - - switch (c) - { - case SERIAL_TIMEOUT: - if (remote_debug) - fputs_filtered ("Timeout in mid-packet, retrying\n", gdb_stdlog); - return 0; - case '$': - if (remote_debug) - fputs_filtered ("Saw new packet start in middle of old one\n", - gdb_stdlog); - return 0; /* Start a new packet, count retries */ - case '#': - { - unsigned char pktcsum; - - *bp = '\000'; - - pktcsum = fromhex (readchar (remote_timeout)) << 4; - pktcsum |= fromhex (readchar (remote_timeout)); - - if (csum == pktcsum) - { - return 1; - } - - if (remote_debug) - { - fprintf_filtered (gdb_stdlog, - "Bad checksum, sentsum=0x%x, csum=0x%x, buf=", - pktcsum, csum); - fputs_filtered (buf, gdb_stdlog); - fputs_filtered ("\n", gdb_stdlog); - } - return 0; - } - case '*': /* Run length encoding */ - csum += c; - c = readchar (remote_timeout); - csum += c; - c = c - ' ' + 3; /* Compute repeat count */ - - if (c > 0 && c < 255 && bp + c - 1 < buf + PBUFSIZ - 1) - { - memset (bp, *(bp - 1), c); - bp += c; - continue; - } - - *bp = '\0'; - printf_filtered ("Repeat count %d too large for buffer: ", c); - puts_filtered (buf); - puts_filtered ("\n"); - return 0; - default: - if (bp < buf + PBUFSIZ - 1) - { - *bp++ = c; - csum += c; - continue; - } - - *bp = '\0'; - puts_filtered ("Remote packet too long: "); - puts_filtered (buf); - puts_filtered ("\n"); - - return 0; - } - } -} - -/* Read a packet from the remote machine, with error checking, and - store it in BUF. BUF is expected to be of size PBUFSIZ. If - FOREVER, wait forever rather than timing out; this is used while - the target is executing user code. */ - -static void -getpkt (buf, forever) - char *buf; - int forever; -{ - int c; - int tries; - int timeout; - int val; - - strcpy (buf, "timeout"); - - if (forever) - { - timeout = watchdog > 0 ? watchdog : -1; - } - - else - timeout = remote_timeout; - -#define MAX_TRIES 3 - - for (tries = 1; tries <= MAX_TRIES; tries++) - { - /* This can loop forever if the remote side sends us characters - continuously, but if it pauses, we'll get a zero from readchar - because of timeout. Then we'll count that as a retry. */ - - /* Note that we will only wait forever prior to the start of a packet. - After that, we expect characters to arrive at a brisk pace. They - should show up within remote_timeout intervals. */ - - do - { - c = readchar (timeout); - - if (c == SERIAL_TIMEOUT) - { - if (forever) /* Watchdog went off. Kill the target. */ - { - target_mourn_inferior (); - error ("Watchdog has expired. Target detached.\n"); - } - if (remote_debug) - fputs_filtered ("Timed out.\n", gdb_stdlog); - goto retry; - } - } - while (c != '$'); - - /* We've found the start of a packet, now collect the data. */ - - val = read_frame (buf); - - if (val == 1) - { - if (remote_debug) - { - fprintf_unfiltered (gdb_stdlog, "Packet received: "); - fputstr_unfiltered (buf, 0, gdb_stdlog); - fprintf_unfiltered (gdb_stdlog, "\n"); - } - SERIAL_WRITE (remote_desc, "+", 1); - return; - } - - /* Try the whole thing again. */ - retry: - SERIAL_WRITE (remote_desc, "-", 1); - } - - /* We have tried hard enough, and just can't receive the packet. Give up. */ - - printf_unfiltered ("Ignoring packet error, continuing...\n"); - SERIAL_WRITE (remote_desc, "+", 1); -} diff --git a/tools/gdb/remote.h b/tools/gdb/remote.h deleted file mode 100644 index f14dacb07a..0000000000 --- a/tools/gdb/remote.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -extern int remote_desc, remote_timeout; - -extern void remote_reset(void); -extern void remote_continue(void); -extern int remote_write_bytes(unsigned long, char *, int); diff --git a/tools/gdb/serial.c b/tools/gdb/serial.c deleted file mode 100644 index 2f2e5291d9..0000000000 --- a/tools/gdb/serial.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include -#include -#include "serial.h" - -#if defined(__sun__) || \ - defined(__OpenBSD__) || \ - defined(__FreeBSD__) || \ - defined(__NetBSD__) || \ - defined(__APPLE__) -static struct termios tios = { BRKINT, 0, B115200|CS8|CREAD, 0, { 0 } }; -#else -static struct termios tios = { BRKINT, 0, B115200|CS8|CREAD, 0, 0 }; -#endif - -static struct speedmap { - char *str; - speed_t val; -} speedmap[] = { - { "50", B50 }, { "75", B75 }, { "110", B110 }, - { "134", B134 }, { "150", B150 }, { "200", B200 }, - { "300", B300 }, { "600", B600 }, { "1200", B1200 }, - { "1800", B1800 }, { "2400", B2400 }, { "4800", B4800 }, - { "9600", B9600 }, { "19200", B19200 }, { "38400", B38400 }, - { "57600", B57600 }, -#ifdef B76800 - { "76800", B76800 }, -#endif - { "115200", B115200 }, -#ifdef B153600 - { "153600", B153600 }, -#endif - { "230400", B230400 }, -#ifdef B307200 - { "307200", B307200 }, -#endif -#ifdef B460800 - { "460800", B460800 } -#endif -}; -static int nspeeds = sizeof speedmap / sizeof speedmap[0]; - -speed_t -cvtspeed(char *str) -{ - struct speedmap *smp = speedmap, *esmp = &speedmap[nspeeds]; - - while (smp < esmp) { - if (strcmp(str, smp->str) == 0) - return (smp->val); - smp++; - } - return B0; -} - -int -serialopen(char *device, speed_t speed) -{ - int fd; - - if (cfsetospeed(&tios, speed) < 0) - return -1; - - if ((fd = open(device, O_RDWR)) < 0) - return -1; - - if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) { - (void)close(fd); - return -1; - } - - return fd; -} - -int -serialreadchar(int fd, int timeout) -{ - fd_set fds; - struct timeval tv; - int n; - char ch; - - tv.tv_sec = timeout; - tv.tv_usec = 0; - - FD_ZERO(&fds); - FD_SET(fd, &fds); - - /* this is a fucking horrible quick hack - fix this */ - - if ((n = select(fd + 1, &fds, 0, 0, &tv)) < 0) - return SERIAL_ERROR; - - if (n == 0) - return SERIAL_TIMEOUT; - - if ((n = read(fd, &ch, 1)) < 0) - return SERIAL_ERROR; - - if (n == 0) - return SERIAL_EOF; - - return ch; -} - -int -serialwrite(int fd, char *buf, int len) -{ - int n; - - do { - n = write(fd, buf, len); - if (n < 0) - return 1; - len -= n; - buf += n; - } while (len > 0); - return 0; -} - -int -serialclose(int fd) -{ - return close(fd); -} diff --git a/tools/gdb/serial.h b/tools/gdb/serial.h deleted file mode 100644 index 3ed509ee78..0000000000 --- a/tools/gdb/serial.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * (C) Copyright 2000 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include - -#define SERIAL_ERROR -1 /* General error, see errno for details */ -#define SERIAL_TIMEOUT -2 -#define SERIAL_EOF -3 - -extern speed_t cvtspeed(char *); -extern int serialopen(char *, speed_t); -extern int serialreadchar(int, int); -extern int serialwrite(int, char *, int); -extern int serialclose(int); diff --git a/tools/gen_eth_addr.c b/tools/gen_eth_addr.c deleted file mode 100644 index 75be385547..0000000000 --- a/tools/gen_eth_addr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright 2001 - * Murray Jensen - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - -#include -#include -#include -#include - -int -main(int argc, char *argv[]) -{ - unsigned long ethaddr_low, ethaddr_high; - - srandom(time(0) | getpid()); - - /* - * setting the 2nd LSB in the most significant byte of - * the address makes it a locally administered ethernet - * address - */ - ethaddr_high = (random() & 0xfeff) | 0x0200; - ethaddr_low = random(); - - printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n", - ethaddr_high >> 8, ethaddr_high & 0xff, - ethaddr_low >> 24, (ethaddr_low >> 16) & 0xff, - (ethaddr_low >> 8) & 0xff, ethaddr_low & 0xff); - - return (0); -} diff --git a/tools/img2brec.sh b/tools/img2brec.sh deleted file mode 100755 index 0fcdba27d4..0000000000 --- a/tools/img2brec.sh +++ /dev/null @@ -1,388 +0,0 @@ -#!/bin/sh - -# This script converts binary files (u-boot.bin) into so called -# bootstrap records that are accepted by Motorola's MC9328MX1/L -# (a.k.a. DragaonBall i.MX) in "Bootstrap Mode" -# -# The code for the SynchFlash programming routines is taken from -# Bootloader\Bin\SyncFlash\programBoot_b.txt contained in -# Motorolas LINUX_BSP_0_3_8.tar.gz -# -# The script could easily extended for AMD flash routines. -# -# 2004-06-23 - steven.scholz@imc-berlin.de - -################################################################################# -# From the posting to the U-Boot-Users mailing list, 23 Jun 2004: -# =============================================================== -# I just hacked a simple script that converts u-boot.bin into a text file -# containg processor init code, SynchFlash programming code and U-Boot data in -# form of so called b-records. -# -# This can be used to programm U-Boot into (Synch)Flash using the Bootstrap -# Mode of the MC9328MX1/L -# -# 0AFE1F3410202E2E2E000000002073756363656564/ -# 0AFE1F44102E0A0000206661696C656420210A0000/ -# 0AFE100000 -# ... -# MX1ADS Sync-flash Programming Utility v0.5 2002/08/21 -# -# Source address (stored in 0x0AFE0000): 0x0A000000 -# Target address (stored in 0x0AFE0004): 0x0C000000 -# Size (stored in 0x0AFE0008): 0x0001A320 -# -# Press any key to start programming ... -# Erasing ... -# Blank checking ... -# Programming ... -# Verifying flash ... succeed. -# -# Programming finished. -# -# So no need for a BDI2000 anymore... ;-) -# -# This is working on my MX1ADS eval board. Hope this could be useful for -# someone. -################################################################################# - -if [ "$#" -lt 1 -o "$#" -gt 2 ] ; then - echo "Usage: $0 infile [outfile]" >&2 - echo " $0 u-boot.bin [u-boot.brec]" >&2 - exit 1 -fi - -if [ "$#" -ge 1 ] ; then - INFILE=$1 -fi - -if [ ! -f $INFILE ] ; then - echo "Error: file '$INFILE' does not exist." >&2 - exit 1 -fi - -FILESIZE=`filesize $INFILE` - -output_init() -{ -echo "\ -******************************************** -* Initialize I/O Pad Driving Strength * -******************************************** -0021B80CC4000003AB -******************************************** -* Initialize SDRAM * -******************************************** -00221000C492120200 ; pre-charge command -08200000E4 ; special read - -00221000C4A2120200 ; auto-refresh command -08000000E4 ; 8 special read -08000000E4 ; 8 special read -08000000E4 ; 8 special read -08000000E4 ; 8 special read -08000000E4 ; 8 special read -08000000E4 ; 8 special read -08000000E4 ; 8 special read -08000000E4 ; 8 special read - -00221000C4B2120200 ; set mode register -08111800E4 ; special read - -00221000C482124200 ; set normal mode - " -} - -output_uboot() -{ -echo "\ -******************************************** -* U-Boot image as bootstrap records * -* will be stored in SDRAM at 0x0A000000 * -******************************************** - " - -cat $INFILE | \ -hexdump -v -e "\"0A0%05.5_ax10\" 16/1 \"%02x\"\"\r\n\"" | \ -tr [:lower:] [:upper:] -} - -output_flashprog() -{ -echo "\ -******************************************** -* Address of arguments to flashProg * -* ---------------------------------------- * -* Source : 0x0A000000 * -* Destination : 0x0C000000 * " - -# get the real size of the U-Boot image -printf "* Size : 0x%08X *\r\n" $FILESIZE -printf "********************************************\r\n" -printf "0AFE0000CC0A0000000C000000%08X\r\n" $FILESIZE - -#;0AFE0000CC0A0000000C00000000006000 - -echo "\ -******************************************** -* Flash Program * -******************************************** -0AFE10001008D09FE5AC0000EA00F0A0E1A42DFE0A -0AFE1010100080FE0A0DC0A0E100D82DE904B04CE2 -0AFE1020109820A0E318309FE5003093E5033082E0 -0AFE103010003093E5013003E2FF3003E20300A0E1 -0AFE10401000A81BE9A01DFE0A0DC0A0E100D82DE9 -0AFE10501004B04CE204D04DE20030A0E10D304BE5 -0AFE1060109820A0E330309FE5003093E5033082E0 -0AFE107010003093E5013903E2000053E3F7FFFF0A -0AFE1080104020A0E310309FE5003093E5032082E0 -0AFE1090100D305BE5003082E500A81BE9A01DFE0A -0AFE10A0100DC0A0E100D82DE904B04CE20000A0E1 -0AFE10B010D7FFFFEB0030A0E1FF3003E2000053E3 -0AFE10C010FAFFFF0A10309FE5003093E5003093E5 -0AFE10D010FF3003E20300A0E100A81BE9A01DFE0A -0AFE10E0100DC0A0E100D82DE904B04CE204D04DE2 -0AFE10F0100030A0E10D304BE50D305BE52332A0E1 -0AFE1100100E304BE50E305BE5090053E30300009A -0AFE1110100E305BE5373083E20E304BE5020000EA -0AFE1120100E305BE5303083E20E304BE50E305BE5 -0AFE1130100300A0E1C3FFFFEB0D305BE50F3003E2 -0AFE1140100E304BE50E305BE5090053E30300009A -0AFE1150100E305BE5373083E20E304BE5020000EA -0AFE1160100E305BE5303083E20E304BE50E305BE5 -0AFE1170100300A0E1B3FFFFEB00A81BE90DC0A0E1 -0AFE11801000D82DE904B04CE21CD04DE210000BE5 -0AFE11901014100BE518200BE588009FE5E50200EB -0AFE11A01010301BE51C300BE514301BE520300BE5 -0AFE11B0100030A0E324300BE524201BE518301BE5 -0AFE11C010030052E10000003A120000EA1C004BE2 -0AFE11D010002090E520104BE2003091E500C093E5 -0AFE11E010043083E2003081E5003092E5042082E2 -0AFE11F010002080E50C0053E10200000A0030A0E3 -0AFE12001028300BE5050000EA24301BE5043083E2 -0AFE12101024300BE5E7FFFFEA0130A0E328300BE5 -0AFE12201028001BE500A81BE9E81EFE0A0DC0A0E1 -0AFE12301000D82DE904B04CE214D04DE210000BE5 -0AFE12401014100BE56C009FE5BA0200EB10301BE5 -0AFE12501018300BE50030A0E31C300BE51C201BE5 -0AFE12601014301BE5030052E10000003A0D0000EA -0AFE12701018304BE2002093E5001092E5042082E2 -0AFE128010002083E5010071E30200000A0030A0E3 -0AFE12901020300BE5050000EA1C301BE5043083E2 -0AFE12A0101C300BE5ECFFFFEA0130A0E320300BE5 -0AFE12B01020001BE500A81BE9001FFE0A0DC0A0E1 -0AFE12C01000D82DE904B04CE224D04DE20130A0E3 -0AFE12D01024300BE5A4229FE58139A0E3023A83E2 -0AFE12E010003082E59820A0E390329FE5003093E5 -0AFE12F010033082E0003093E5023903E2000053E3 -0AFE1300100300001A74229FE58139A0E3033A83E2 -0AFE131010003082E568029FE5860200EBAF36A0E3 -0AFE1320100E3883E2003093E510300BE554029FE5 -0AFE133010800200EB10301BE5233CA0E1FF3003E2 -0AFE1340100300A0E165FFFFEB10301BE52338A0E1 -0AFE135010FF3003E20300A0E160FFFFEB10301BE5 -0AFE1360102334A0E1FF3003E20300A0E15BFFFFEB -0AFE13701010305BE50300A0E158FFFFEB0A00A0E3 -0AFE13801030FFFFEB0D00A0E32EFFFFEBAF36A0E3 -0AFE1390100E3883E2043083E2003093E514300BE5 -0AFE13A010E4019FE5630200EB14301BE5233CA0E1 -0AFE13B010FF3003E20300A0E148FFFFEB14301BE5 -0AFE13C0102338A0E1FF3003E20300A0E143FFFFEB -0AFE13D01014301BE52334A0E1FF3003E20300A0E1 -0AFE13E0103EFFFFEB14305BE50300A0E13BFFFFEB -0AFE13F0100A00A0E313FFFFEB0D00A0E311FFFFEB -0AFE140010AF36A0E30E3883E2083083E2003093E5 -0AFE14101018300BE574019FE5460200EB18301BE5 -0AFE142010233CA0E1FF3003E20300A0E12BFFFFEB -0AFE14301018301BE52338A0E1FF3003E20300A0E1 -0AFE14401026FFFFEB18301BE52334A0E1FF3003E2 -0AFE1450100300A0E121FFFFEB18305BE50300A0E1 -0AFE1460101EFFFFEB0A00A0E3F6FEFFEB0D00A0E3 -0AFE147010F4FEFFEBE6FEFFEB0030A0E1FF3003E2 -0AFE148010000053E30000001A020000EA03FFFFEB -0AFE1490102D004BE5F6FFFFEAF4009FE5250200EB -0AFE14A010FEFEFFEB2D004BE5CD0000EBC00000EB -0AFE14B010E0009FE51F0200EB18301BE528300BE5 -0AFE14C01014301BE52C300BE52C001BE5100100EB -0AFE14D01028301BE5013643E228300BE52C301BE5 -0AFE14E010013683E22C300BE528301BE5000053E3 -0AFE14F010F4FFFFCAAE0000EB14001BE518101BE5 -0AFE15001049FFFFEB0030A0E1FF3003E2000053E3 -0AFE151010E6FFFF0A80009FE5060200EB10001BE5 -0AFE15201014101BE518201BE5D00000EB10001BE5 -0AFE15301014101BE518201BE50FFFFFEB0030A0E1 -0AFE154010FF3003E2000053E30200000A4C009FE5 -0AFE155010F80100EB010000EA44009FE5F50100EB -0AFE156010930000EB3C009FE5F20100EB0000A0E3 -0AFE157010A4FEFFEB0030A0E30300A0E100A81BE9 -0AFE158010A01DFE0AA41DFE0AE01DFE0A0C1EFE0A -0AFE159010381EFE0A641EFE0A181FFE0A281FFE0A -0AFE15A0103C1FFE0A481FFE0AB41EFE0A0DC0A0E1 -0AFE15B01000D82DE904B04CE204D04DE210000BE5 -0AFE15C01010301BE5013043E210300BE5010073E3 -0AFE15D010FAFFFF1A00A81BE90DC0A0E100D82DE9 -0AFE15E01004B04CE208D04DE210000BE510301BE5 -0AFE15F01014300BE514301BE50300A0E100A81BE9 -0AFE1600100DC0A0E100D82DE904B04CE204D04DE2 -0AFE1610102228A0E3012A82E2042082E2E134A0E3 -0AFE162010023883E2033C83E2003082E50333A0E3 -0AFE163010053983E2003093E510300BE500A81BE9 -0AFE1640100DC0A0E100D82DE904B04CE204D04DE2 -0AFE1650102228A0E3012A82E2042082E29134A0E3 -0AFE166010023883E2033C83E2003082E5C136A0E3 -0AFE167010003093E510300BE52228A0E3012A82E2 -0AFE168010042082E2E134A0E3023883E2033C83E2 -0AFE169010003082E50333A0E3073983E20020A0E3 -0AFE16A010002083E52228A0E3012A82E2042082E2 -0AFE16B0108134A0E3023883E2033C83E2003082E5 -0AFE16C0100333A0E3003093E510300BE5CBFFFFEB -0AFE16D01010301BE50300A0E100A81BE90DC0A0E1 -0AFE16E01000D82DE904B04CE208D04DE2D3FFFFEB -0AFE16F0100030A0E110300BE510301BE5023503E2 -0AFE170010000053E30500000A10301BE5073703E2 -0AFE171010000053E30100000A10001BE5ADFFFFEB -0AFE17201010301BE5803003E2000053E30500000A -0AFE17301010301BE51C3003E2000053E30100000A -0AFE17401010001BE5A3FFFFEB10201BE50235A0E3 -0AFE175010803083E2030052E10200001A0130A0E3 -0AFE17601014300BE5010000EA0030A0E314300BE5 -0AFE17701014001BE500A81BE90DC0A0E100D82DE9 -0AFE17801004B04CE204D04DE22228A0E3012A82E2 -0AFE179010042082E29134A0E3023883E2033C83E2 -0AFE17A010003082E5C136A0E3003093E510300BE5 -0AFE17B01000A81BE90DC0A0E100D82DE904B04CE2 -0AFE17C010ECFFFFEB2228A0E3012A82E2042082E2 -0AFE17D0108134A0E3023883E2033C83E2003082E5 -0AFE17E01000A81BE90DC0A0E100D82DE904B04CE2 -0AFE17F01004D04DE22228A0E3012A82E2042082E2 -0AFE1800102238A0E3013A83E2043083E2003093E5 -0AFE181010023183E3003082E52228A0E3012A82E2 -0AFE1820102238A0E3013A83E2003093E5023183E3 -0AFE183010003082E5FA0FA0E35BFFFFEB2228A0E3 -0AFE184010012A82E2042082E2B134A0E3023883E2 -0AFE185010033C83E2003082E50333A0E3233983E2 -0AFE186010033B83E2003093E510300BE500A81BE9 -0AFE1870100DC0A0E100D82DE904B04CE21CD04DE2 -0AFE18801010000BE514100BE518200BE50030A0E3 -0AFE1890101C300BE51C201BE518301BE5030052E1 -0AFE18A0100000003A190000EAB2FFFFEB2228A0E3 -0AFE18B010012A82E2042082E2F134A0E3023883E2 -0AFE18C010033C83E2003082E514201BE51C301BE5 -0AFE18D010031082E010201BE51C301BE5033082E0 -0AFE18E010003093E5003081E57BFFFFEB0030A0E1 -0AFE18F010FF3003E2000053E3FAFFFF0AACFFFFEB -0AFE1900101C301BE5043083E21C300BE5E0FFFFEA -0AFE19101000A81BE90DC0A0E100D82DE904B04CE2 -0AFE1920100CD04DE210000BE52228A0E3012A82E2 -0AFE193010042082E28134A0E3023883E2033C83E2 -0AFE194010003082E510301BE5003093E514300BE5 -0AFE1950102228A0E3012A82E2042082E29134A0E3 -0AFE196010023883E2033C83E2003082E510301BE5 -0AFE197010003093E518300BE52228A0E3012A82E2 -0AFE198010042082E2E134A0E3023883E2033C83E2 -0AFE199010003082E50229A0E310301BE5032082E0 -0AFE19A0100030A0E3003082E52228A0E3012A82E2 -0AFE19B010042082E28134A0E3023883E2033C83E2 -0AFE19C010003082E510201BE50D3AA0E3D03083E2 -0AFE19D010033883E1003082E53FFFFFEB0030A0E1 -0AFE19E010FF3003E2000053E3FAFFFF0A70FFFFEB -0AFE19F01000A81BE90DC0A0E100D82DE904B04CE2 -0AFE1A00105CFFFFEB2228A0E3012A82E2042082E2 -0AFE1A1010E134A0E3023883E2033C83E2003082E5 -0AFE1A20100333A0E3033983E20020A0E3002083E5 -0AFE1A30102228A0E3012A82E2042082E28134A0E3 -0AFE1A4010023883E2033C83E2003082E50323A0E3 -0AFE1A5010032982E20339A0E3C03083E2033883E1 -0AFE1A6010003082E500A81BE90DC0A0E100D82DE9 -0AFE1A701004B04CE23FFFFFEB2228A0E3012A82E2 -0AFE1A8010042082E2E134A0E3023883E2033C83E2 -0AFE1A9010003082E50333A0E30A3983E20020A0E3 -0AFE1AA010002083E52228A0E3012A82E2042082E2 -0AFE1AB0108134A0E3023883E2033C83E2003082E5 -0AFE1AC0100323A0E30A2982E20339A0E3C03083E2 -0AFE1AD010033883E1003082E500A81BE90DC0A0E1 -0AFE1AE01000D82DE904B04CE28729A0E3222E82E2 -0AFE1AF0108739A0E3223E83E2003093E51E3CC3E3 -0AFE1B0010003082E58729A0E38E2F82E28739A0E3 -0AFE1B10108E3F83E2003093E51E3CC3E3003082E5 -0AFE1B20108139A0E3823D83E20520A0E3002083E5 -0AFE1B30108129A0E3822D82E2042082E20139A0E3 -0AFE1B4010273083E2003082E58139A0E3823D83E2 -0AFE1B50100C3083E20120A0E3002083E58129A0E3 -0AFE1B6010822D82E2102082E22A3DA0E3013083E2 -0AFE1B7010003082E58139A0E3823D83E2243083E2 -0AFE1B80100F20A0E3002083E58139A0E3823D83E2 -0AFE1B9010283083E28A20A0E3002083E58139A0E3 -0AFE1BA010823D83E22C3083E20820A0E3002083E5 -0AFE1BB01000A81BE90DC0A0E100D82DE904B04CE2 -0AFE1BC0108139A0E3823D83E2183083E2003093E5 -0AFE1BD010013003E2FF3003E20300A0E100A81BE9 -0AFE1BE0100DC0A0E100D82DE904B04CE204D04DE2 -0AFE1BF0100030A0E10D304BE58139A0E3823D83E2 -0AFE1C0010183083E2003093E5013903E2000053E3 -0AFE1C1010F8FFFF0A8139A0E3813D83E20D205BE5 -0AFE1C2010002083E50D305BE50A0053E30A00001A -0AFE1C30108139A0E3823D83E2183083E2003093E5 -0AFE1C4010013903E2000053E3F8FFFF0A8139A0E3 -0AFE1C5010813D83E20D20A0E3002083E500A81BE9 -0AFE1C60100DC0A0E100D82DE904B04CE20000A0E1 -0AFE1C7010CFFFFFEB0030A0E1FF3003E2000053E3 -0AFE1C8010FAFFFF0A8139A0E3023A83E2003093E5 -0AFE1C9010FF3003E20300A0E100A81BE90DC0A0E1 -0AFE1CA01000D82DE904B04CE204D04DE20030A0E1 -0AFE1CB0100D304BE50D305BE52332A0E10E304BE5 -0AFE1CC0100E305BE5090053E30300009A0E305BE5 -0AFE1CD010373083E20E304BE5020000EA0E305BE5 -0AFE1CE010303083E20E304BE50E305BE50300A0E1 -0AFE1CF010BAFFFFEB0D305BE50F3003E20E304BE5 -0AFE1D00100E305BE5090053E30300009A0E305BE5 -0AFE1D1010373083E20E304BE5020000EA0E305BE5 -0AFE1D2010303083E20E304BE50E305BE50300A0E1 -0AFE1D3010AAFFFFEB00A81BE90DC0A0E100D82DE9 -0AFE1D401004B04CE204D04DE210000BE510301BE5 -0AFE1D50100030D3E5000053E30000001A080000EA -0AFE1D601010104BE2003091E50320A0E10020D2E5 -0AFE1D7010013083E2003081E50200A0E197FFFFEB -0AFE1D8008F1FFFFEA00A81BE9 -0AFE1DA4100A0D4D58314144532053796E632D666C -0AFE1DB4106173682050726F6772616D6D696E6720 -0AFE1DC4105574696C6974792076302E3520323030 -0AFE1DD410322F30382F32310A0D000000536F7572 -0AFE1DE41063652061646472657373202873746F72 -0AFE1DF410656420696E2030783041464530303030 -0AFE1E0410293A2030780000005461726765742061 -0AFE1E1410646472657373202873746F7265642069 -0AFE1E24106E2030783041464530303034293A2030 -0AFE1E34107800000053697A652020202020202020 -0AFE1E44102020202873746F72656420696E203078 -0AFE1E54103041464530303038293A203078000000 -0AFE1E6410507265737320616E79206B657920746F -0AFE1E74102073746172742070726F6772616D6D69 -0AFE1E84106E67202E2E2E00000A0D45726173696E -0AFE1E94106720666C617368202E2E2E000A0D5072 -0AFE1EA4106F6772616D6D696E67202E2E2E000000 -0AFE1EB4100A0D50726F6772616D6D696E67206669 -0AFE1EC4106E69736865642E0A0D50726573732027 -0AFE1ED410612720746F20636F6E74696E7565202E -0AFE1EE4102E2E2E000A0D566572696679696E6720 -0AFE1EF410666C617368202E2E2E0000000A0D426C -0AFE1F0410616E6B20636865636B696E67202E2E2E -0AFE1F1410000000000A45726173696E67202E2E2E -0AFE1F2410000000000A50726F6772616D6D696E67 -0AFE1F3410202E2E2E000000002073756363656564 -0AFE1F44102E0A0000206661696C656420210A0000 -0AFE100000 - " -} - -######################################################### - -if [ "$#" -eq 2 ] ; then - output_init > $2 - output_uboot >> $2 - output_flashprog >> $2 -else - output_init; - output_uboot; - output_flashprog; -fi diff --git a/tools/img2srec.c b/tools/img2srec.c deleted file mode 100644 index b04abbd8b4..0000000000 --- a/tools/img2srec.c +++ /dev/null @@ -1,413 +0,0 @@ -/************************************************************************* -| COPYRIGHT (c) 2000 BY ABATRON AG -|************************************************************************* -| -| PROJECT NAME: Linux Image to S-record Conversion Utility -| FILENAME : img2srec.c -| -| COMPILER : GCC -| -| TARGET OS : LINUX / UNIX -| TARGET HW : - -| -| PROGRAMMER : Abatron / RD -| CREATION : 07.07.00 -| -|************************************************************************* -| -| DESCRIPTION : -| -| Utility to convert a Linux Boot Image to S-record: -| ================================================== -| -| This command line utility can be used to convert a Linux boot image -| (zimage.initrd) to S-Record format used for flash programming. -| This conversion takes care of the special sections "IMAGE" and INITRD". -| -| img2srec [-o offset] image > image.srec -| -| -| Build the utility: -| ================== -| -| To build the utility use GCC as follows: -| -| gcc img2srec.c -o img2srec -| -| -|************************************************************************* -| -| -| UPDATES : -| -| DATE NAME CHANGES -| ----------------------------------------------------------- -| Latest update -| -| 07.07.00 aba Initial release -| -|*************************************************************************/ - -/************************************************************************* -| INCLUDES -|*************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -extern int errno; - -/************************************************************************* -| DEFINES -|*************************************************************************/ - -#define FALSE 0 -#define TRUE 1 - -/************************************************************************* -| MACROS -|*************************************************************************/ - -/************************************************************************* -| TYPEDEFS -|*************************************************************************/ - -typedef uint8_t CHAR; -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef int BOOL; - -/************************************************************************* -| LOCALS -|*************************************************************************/ - -/************************************************************************* -| PROTOTYPES -|*************************************************************************/ - -static char *ExtractHex(DWORD *value, char *getPtr); -static char *ExtractDecimal(DWORD *value, char *getPtr); -static void ExtractNumber(DWORD *value, char *getPtr); -static BYTE *ExtractWord(WORD *value, BYTE *buffer); -static BYTE *ExtractLong(DWORD *value, BYTE *buffer); -static BYTE *ExtractBlock(WORD count, BYTE *data, BYTE *buffer); -static char *WriteHex(char *pa, BYTE value, WORD *pCheckSum); -static char *BuildSRecord(char *pa, WORD sType, DWORD addr, - const BYTE *data, int nCount); -static void ConvertELF(char *fileName, DWORD loadOffset); -int main(int argc, char *argv[]); - -/************************************************************************* -| FUNCTIONS -|*************************************************************************/ - -static char* ExtractHex (DWORD* value, char* getPtr) -{ - DWORD num; - DWORD digit; - BYTE c; - - while (*getPtr == ' ') getPtr++; - num = 0; - for (;;) { - c = *getPtr; - if ((c >= '0') && (c <= '9')) digit = (DWORD)(c - '0'); - else if ((c >= 'A') && (c <= 'F')) digit = (DWORD)(c - 'A' + 10); - else if ((c >= 'a') && (c <= 'f')) digit = (DWORD)(c - 'a' + 10); - else break; - num <<= 4; - num += digit; - getPtr++; - } /* for */ - *value = num; - return getPtr; -} /* ExtractHex */ - -static char* ExtractDecimal (DWORD* value, char* getPtr) -{ - DWORD num; - DWORD digit; - BYTE c; - - while (*getPtr == ' ') getPtr++; - num = 0; - for (;;) { - c = *getPtr; - if ((c >= '0') && (c <= '9')) digit = (DWORD)(c - '0'); - else break; - num *= 10; - num += digit; - getPtr++; - } /* for */ - *value = num; - return getPtr; -} /* ExtractDecimal */ - - -static void ExtractNumber (DWORD* value, char* getPtr) -{ - BOOL neg = FALSE;; - - while (*getPtr == ' ') getPtr++; - if (*getPtr == '-') { - neg = TRUE; - getPtr++; - } /* if */ - if ((*getPtr == '0') && ((*(getPtr+1) == 'x') || (*(getPtr+1) == 'X'))) { - getPtr +=2; - (void)ExtractHex(value, getPtr); - } /* if */ - else { - (void)ExtractDecimal(value, getPtr); - } /* else */ - if (neg) *value = -(*value); -} /* ExtractNumber */ - - -static BYTE* ExtractWord(WORD* value, BYTE* buffer) -{ - WORD x; - x = (WORD)*buffer++; - x = (x<<8) + (WORD)*buffer++; - *value = x; - return buffer; -} /* ExtractWord */ - - -static BYTE* ExtractLong(DWORD* value, BYTE* buffer) -{ - DWORD x; - x = (DWORD)*buffer++; - x = (x<<8) + (DWORD)*buffer++; - x = (x<<8) + (DWORD)*buffer++; - x = (x<<8) + (DWORD)*buffer++; - *value = x; - return buffer; -} /* ExtractLong */ - - -static BYTE* ExtractBlock(WORD count, BYTE* data, BYTE* buffer) -{ - while (count--) *data++ = *buffer++; - return buffer; -} /* ExtractBlock */ - - -static char* WriteHex(char* pa, BYTE value, WORD* pCheckSum) -{ - WORD temp; - - static char ByteToHex[] = "0123456789ABCDEF"; - - *pCheckSum += value; - temp = value / 16; - *pa++ = ByteToHex[temp]; - temp = value % 16; - *pa++ = ByteToHex[temp]; - return pa; -} - - -static char* BuildSRecord(char* pa, WORD sType, DWORD addr, - const BYTE* data, int nCount) -{ - WORD addrLen; - WORD sRLen; - WORD checkSum; - WORD i; - - switch (sType) { - case 0: - case 1: - case 9: - addrLen = 2; - break; - case 2: - case 8: - addrLen = 3; - break; - case 3: - case 7: - addrLen = 4; - break; - default: - return pa; - } /* switch */ - - *pa++ = 'S'; - *pa++ = (char)(sType + '0'); - sRLen = addrLen + nCount + 1; - checkSum = 0; - pa = WriteHex(pa, (BYTE)sRLen, &checkSum); - - /* Write address field */ - for (i = 1; i <= addrLen; i++) { - pa = WriteHex(pa, (BYTE)(addr >> (8 * (addrLen - i))), &checkSum); - } /* for */ - - /* Write code/data fields */ - for (i = 0; i < nCount; i++) { - pa = WriteHex(pa, *data++, &checkSum); - } /* for */ - - /* Write checksum field */ - checkSum = ~checkSum; - pa = WriteHex(pa, (BYTE)checkSum, &checkSum); - *pa++ = '\0'; - return pa; -} - - -static void ConvertELF(char* fileName, DWORD loadOffset) -{ - FILE* file; - int i; - int rxCount; - BYTE rxBlock[1024]; - DWORD loadSize; - DWORD firstAddr; - DWORD loadAddr; - DWORD loadDiff = 0; - Elf32_Ehdr elfHeader; - Elf32_Shdr sectHeader[32]; - BYTE* getPtr; - char srecLine[128]; - char *hdr_name; - - - /* open file */ - if ((file = fopen(fileName,"rb")) == NULL) { - fprintf (stderr, "Can't open %s: %s\n", fileName, strerror(errno)); - return; - } /* if */ - - /* read ELF header */ - rxCount = fread(rxBlock, 1, sizeof elfHeader, file); - getPtr = ExtractBlock(sizeof elfHeader.e_ident, elfHeader.e_ident, rxBlock); - getPtr = ExtractWord(&elfHeader.e_type, getPtr); - getPtr = ExtractWord(&elfHeader.e_machine, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_version, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_entry, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_phoff, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_shoff, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_flags, getPtr); - getPtr = ExtractWord(&elfHeader.e_ehsize, getPtr); - getPtr = ExtractWord(&elfHeader.e_phentsize, getPtr); - getPtr = ExtractWord(&elfHeader.e_phnum, getPtr); - getPtr = ExtractWord(&elfHeader.e_shentsize, getPtr); - getPtr = ExtractWord(&elfHeader.e_shnum, getPtr); - getPtr = ExtractWord(&elfHeader.e_shstrndx, getPtr); - if ( (rxCount != sizeof elfHeader) - || (elfHeader.e_ident[0] != ELFMAG0) - || (elfHeader.e_ident[1] != ELFMAG1) - || (elfHeader.e_ident[2] != ELFMAG2) - || (elfHeader.e_ident[3] != ELFMAG3) - || (elfHeader.e_type != ET_EXEC) - ) { - fclose(file); - fprintf (stderr, "*** illegal file format\n"); - return; - } /* if */ - - /* read all section headers */ - fseek(file, elfHeader.e_shoff, SEEK_SET); - for (i = 0; i < elfHeader.e_shnum; i++) { - rxCount = fread(rxBlock, 1, sizeof sectHeader[0], file); - getPtr = ExtractLong((DWORD *)§Header[i].sh_name, rxBlock); - getPtr = ExtractLong((DWORD *)§Header[i].sh_type, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_flags, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_addr, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_offset, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_size, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_link, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_info, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_addralign, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_entsize, getPtr); - if (rxCount != sizeof sectHeader[0]) { - fclose(file); - fprintf (stderr, "*** illegal file format\n"); - return; - } /* if */ - } /* for */ - - if ((hdr_name = strrchr(fileName, '/')) == NULL) { - hdr_name = fileName; - } else { - ++hdr_name; - } - /* write start record */ - (void)BuildSRecord(srecLine, 0, 0, (BYTE *)hdr_name, strlen(hdr_name)); - printf("%s\r\n",srecLine); - - /* write data records */ - firstAddr = ~0; - loadAddr = 0; - for (i = 0; i < elfHeader.e_shnum; i++) { - if ( (sectHeader[i].sh_type == SHT_PROGBITS) - && (sectHeader[i].sh_size != 0) - ) { - loadSize = sectHeader[i].sh_size; - if (sectHeader[i].sh_flags != 0) { - loadAddr = sectHeader[i].sh_addr; - loadDiff = loadAddr - sectHeader[i].sh_offset; - } /* if */ - else { - loadAddr = sectHeader[i].sh_offset + loadDiff; - } /* else */ - - if (loadAddr < firstAddr) - firstAddr = loadAddr; - - /* build s-records */ - loadSize = sectHeader[i].sh_size; - fseek(file, sectHeader[i].sh_offset, SEEK_SET); - while (loadSize) { - rxCount = fread(rxBlock, 1, (loadSize > 32) ? 32 : loadSize, file); - if (rxCount < 0) { - fclose(file); - fprintf (stderr, "*** illegal file format\n"); - return; - } /* if */ - (void)BuildSRecord(srecLine, 3, loadAddr + loadOffset, rxBlock, rxCount); - loadSize -= rxCount; - loadAddr += rxCount; - printf("%s\r\n",srecLine); - } /* while */ - } /* if */ - } /* for */ - - /* add end record */ - (void)BuildSRecord(srecLine, 7, firstAddr + loadOffset, 0, 0); - printf("%s\r\n",srecLine); - fclose(file); -} /* ConvertELF */ - - -/************************************************************************* -| MAIN -|*************************************************************************/ - -int main( int argc, char *argv[ ]) -{ - DWORD offset; - - if (argc == 2) { - ConvertELF(argv[1], 0); - } /* if */ - else if ((argc == 4) && (strcmp(argv[1], "-o") == 0)) { - ExtractNumber(&offset, argv[2]); - ConvertELF(argv[3], offset); - } /* if */ - else { - fprintf (stderr, "Usage: img2srec [-o offset] \n"); - } /* if */ - - return 0; -} /* main */ diff --git a/tools/inca-swap-bytes.c b/tools/inca-swap-bytes.c deleted file mode 100644 index 3a6d82d54a..0000000000 --- a/tools/inca-swap-bytes.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include -#include - -#ifndef BUFSIZ -# define BUFSIZ 4096 -#endif - -#undef BUFSIZ -# define BUFSIZ 64 -int main (void) -{ - short ibuff[BUFSIZ], obuff[BUFSIZ]; - int rc, i, len; - - while ((rc = read (0, ibuff, sizeof (ibuff))) > 0) { - memset (obuff, 0, sizeof (obuff)); - for (i = 0; i < (rc + 1) / 2; i++) { - obuff[i] = ibuff[i ^ 1]; - } - - len = (rc + 1) & ~1; - - if (write (1, obuff, len) != len) { - perror ("read error"); - return (EXIT_FAILURE); - } - - memset (ibuff, 0, sizeof (ibuff)); - } - - if (rc < 0) { - perror ("read error"); - return (EXIT_FAILURE); - } - return (EXIT_SUCCESS); -} diff --git a/tools/logos/denx.bmp b/tools/logos/denx.bmp deleted file mode 100644 index c4cde09d59..0000000000 Binary files a/tools/logos/denx.bmp and /dev/null differ diff --git a/tools/mpc86x_clk.c b/tools/mpc86x_clk.c deleted file mode 100644 index 8dfbd4e3d0..0000000000 --- a/tools/mpc86x_clk.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * (C) Copyright 2003 Intracom S.A. - * Pantelis Antoniou - * - * This little program makes an exhaustive search for the - * correct terms of pdf, mfi, mfn, mfd, s, dbrmo, in PLPRCR. - * The goal is to produce a gclk2 from a xin input, while respecting - * all the restrictions on their combination. - * - * Generaly you select the first row of the produced table. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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 - */ - - -#include -#include - -#define DPREF_MIN 10000000 -#define DPREF_MAX 32000000 - -#define DPGDCK_MAX 320000000 -#define DPGDCK_MIN 160000000 - -#define S_MIN 0 -#define S_MAX 2 - -#define MFI_MIN 5 -#define MFI_MAX 15 - -#define MFN_MIN 0 -#define MFN_MAX 15 - -#define MFD_MIN 0 -#define MFD_MAX 31 - -#define MF_MIN 5 -#define MF_MAX 15 - -#define PDF_MIN 0 -#define PDF_MAX 15 - -#define GCLK2_MAX 150000000 - -static int calculate (int xin, int target_clock, - int ppm, int pdf, int mfi, int mfn, int mfd, int s, - int *dprefp, int *dpgdckp, int *jdbckp, - int *gclk2p, int *dbrmop) -{ - unsigned int dpref, dpgdck, jdbck, gclk2, t1, t2, dbrmo; - - /* valid MFI? */ - if (mfi < MFI_MIN) - return -1; - - /* valid num, denum? */ - if (mfn > 0 && mfn >= mfd) - return -1; - - dpref = xin / (pdf + 1); - - /* valid dpef? */ - if (dpref < DPREF_MIN || dpref > DPREF_MAX) - return -1; - - if (mfn == 0) { - dpgdck = (2 * mfi * xin) / (pdf + 1) ; - dbrmo = 0; - } else { - /* 5 <= mfi + (mfn / mfd + 1) <= 15 */ - t1 = mfd + 1; - t2 = mfi * t1 + mfn; - if ( MF_MIN * t1 > t2 || MF_MAX * t1 < t2) - return -1; - - dpgdck = (unsigned int)(2 * (mfi * mfd + mfi + mfn) * - (unsigned int)xin) / - ((mfd + 1) * (pdf + 1)); - - dbrmo = 10 * mfn < (mfd + 1); - } - - /* valid dpgclk? */ - if (dpgdck < DPGDCK_MIN || dpgdck > DPGDCK_MAX) - return -1; - - jdbck = dpgdck >> s; - gclk2 = jdbck / 2; - - /* valid gclk2 */ - if (gclk2 > GCLK2_MAX) - return -1; - - t1 = abs(gclk2 - target_clock); - - /* XXX max 1MHz dev. in clock */ - if (t1 > 1000000) - return -1; - - /* dev within range (XXX gclk2 scaled to avoid overflow) */ - if (t1 * 1000 > (unsigned int)ppm * (gclk2 / 1000)) - return -1; - - *dprefp = dpref; - *dpgdckp = dpgdck; - *jdbckp = jdbck; - *gclk2p = gclk2; - *dbrmop = dbrmo; - - return gclk2; -} - -int conf_clock(int xin, int target_clock, int ppm) -{ - int pdf, s, mfn, mfd, mfi; - int dpref, dpgdck, jdbck, gclk2, xout, dbrmo; - int found = 0; - - /* integer multipliers */ - for (pdf = PDF_MIN; pdf <= PDF_MAX; pdf++) { - for (mfi = MFI_MIN; mfi <= MFI_MAX; mfi++) { - for (s = 0; s <= S_MAX; s++) { - xout = calculate(xin, target_clock, - ppm, pdf, mfi, 0, 0, s, - &dpref, &dpgdck, &jdbck, - &gclk2, &dbrmo); - if (xout < 0) - continue; - - if (found == 0) { - printf("pdf mfi mfn mfd s dbrmo dpref dpgdck jdbck gclk2 exact?\n"); - printf("--- --- --- --- - ----- ----- ------ ----- ----- ------\n"); - } - - printf("%3d %3d --- --- %1d %5d %9d %9d %9d %9d%s\n", - pdf, mfi, s, dbrmo, - dpref, dpgdck, jdbck, gclk2, - gclk2 == target_clock ? " YES" : ""); - - found++; - } - } - } - - /* fractional multipliers */ - for (pdf = PDF_MIN; pdf <= PDF_MAX; pdf++) { - for (mfi = MFI_MIN; mfi <= MFI_MAX; mfi++) { - for (mfn = 1; mfn <= MFN_MAX; mfn++) { - for (mfd = 1; mfd <= MFD_MAX; mfd++) { - for (s = 0; s <= S_MAX; s++) { - xout = calculate(xin, target_clock, - ppm, pdf, mfi, mfn, mfd, s, - &dpref, &dpgdck, &jdbck, - &gclk2, &dbrmo); - if (xout < 0) - continue; - - if (found == 0) { - printf("pdf mfi mfn mfd s dbrmo dpref dpgdck jdbck gclk2 exact?\n"); - printf("--- --- --- --- - ----- ----- ------ ----- ----- ------\n"); - } - - printf("%3d %3d %3d %3d %1d %5d %9d %9d %9d %9d%s\n", - pdf, mfi, mfn, mfd, s, - dbrmo, dpref, dpgdck, jdbck, gclk2, - gclk2 == target_clock ? " YES" : ""); - - found++; - } - } - } - - } - } - - return found; -} - -int main(int argc, char *argv[]) -{ - int xin, want_gclk2, found, ppm = 100; - - if (argc < 3) { - fprintf(stderr, "usage: mpc86x_clk [ppm]\n"); - fprintf(stderr, " default ppm is 100\n"); - return 10; - } - - xin = atoi(argv[1]); - want_gclk2 = atoi(argv[2]); - if (argc >= 4) - ppm = atoi(argv[3]); - - found = conf_clock(xin, want_gclk2, ppm); - if (found <= 0) { - fprintf(stderr, "cannot produce gclk2 %d from xin %d\n", - want_gclk2, xin); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/tools/ncb.c b/tools/ncb.c deleted file mode 100644 index 74deebb652..0000000000 --- a/tools/ncb.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include - -int main (int argc, char *argv[]) -{ - int s, len, o, port = 6666; - char buf[512]; - struct sockaddr_in addr; - int addr_len = sizeof addr; - - if (argc > 1) - port = atoi (argv[1]); - - s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); - - o = 1; - len = 4; - setsockopt (3, SOL_SOCKET, SO_REUSEADDR, &o, len); - - addr.sin_family = AF_INET; - addr.sin_port = htons (port); - addr.sin_addr.s_addr = INADDR_ANY; /* receive broadcasts */ - - bind (s, (struct sockaddr *) &addr, sizeof addr); - - for (;;) { - len = recvfrom (s, buf, sizeof buf, 0, (struct sockaddr *) &addr, &addr_len); - if (len < 0) - break; - write (1, buf, len); - } - - return 0; -} diff --git a/tools/scripts/README b/tools/scripts/README deleted file mode 100644 index 046c1d411c..0000000000 --- a/tools/scripts/README +++ /dev/null @@ -1,67 +0,0 @@ -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# The files in this directory are free software; you can redistribute -# them and/or modify them 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. -# -# These files are distributed in the hope that they 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 -# - -This directory contains scripts that help to perform certain actions -that need to be done frequently when working with U-Boot. - -They are meant as EXAMPLE code, so it is very likely that you will -have to modify them before use. - - -Short description: -================== - -dot.kermrc: - - Example for "~/.kermrc" Kermit init file for use with U-Boot - - by Wolfgang Denk, 24 Jun 2001 - -flash_param: - - "kermit" script to automatically initialize the environment - variables on your target. This is most useful during - development when your environment variables are stored in an - embedded flash sector which is erased whenever you install a - new U-Boot image. - - by Swen Anderson, 10 May 2001 - -send_cmd: - - send_cmd U_BOOT_COMMAND - - "kermit" script to send a U-Boot command and print the - results. When used from a shell with history (like the bash) - this indirectly adds kind of history to U-Boot ;-) - - by Swen Anderson, 10 May 2001 - -send_image: - - send_image FILE_NAME OFFSET - - "kermit" script to automatically download a file to the - target using the "loadb" command (kermit binary protocol) - - by Swen Anderson, 10 May 2001 diff --git a/tools/scripts/dot.kermrc b/tools/scripts/dot.kermrc deleted file mode 100644 index 0fc6c15d35..0000000000 --- a/tools/scripts/dot.kermrc +++ /dev/null @@ -1,16 +0,0 @@ -set line /dev/ttyS0 -set speed 115200 -set carrier-watch off -set handshake none -set flow-control none -robust -set file type bin -set file name lit -set rec pack 1000 -set send pack 1000 -set window 5 -set prompt Kermit> -define sz !sz \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 < \v(line) > \v(line) -define rz !rz \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 < \v(line) > \v(line) -define sx !sx \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 < \v(line) > \v(line) -define rx !rx \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 < \v(line) > \v(line) diff --git a/tools/scripts/flash_param b/tools/scripts/flash_param deleted file mode 100644 index 847f99e1eb..0000000000 --- a/tools/scripts/flash_param +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/kermit + -# usage: ./flash_param parameters -# Parameters: IP Address ETH Address ERIC Number -# Format: xxx.xxx.xxx.xxx xx:xx:xx:xx:xx:xx xxxx - -set line /dev/ttyS0 -set speed 115200 -set serial 8N1 -set carrier-watch off -set handshake none -#set flow-control none -set flow-control xon/xoff -#robust -set file type bin -set file name lit -set rec pack 1000 -set send pack 1000 -set window 5 -set prompt Kermit> -#robust -# Milliseconds to pause between each OUTPUT character -set output pacing 1 - -out \13 -in 10 => -#first erase the environment memory within NVRAM -out mw f0000000 0 200\13 -in 10 => -out reset\13 -in 5 autoboot -out \13\13 -in 10 => -#set additional env parameter -out setenv ethaddr \%2\13 -in 10 => -out setenv serial# ERIC 1.0 \%3\13 -in 10 => -out setenv eric_id \%3\13 -in 10 => -#out setenv prec_videocard_bus unknown\13 -#in 10 => -#out setenv prec_bios_type unknown\13 -#in 10 => -out setenv eric_passwd .eRIC.\13 -in 10 => -#out setenv bootargs root=/dev/ram ramdisk_size=8192 init=/sbin/init ip=\%1:192.168.1.100:192.168.1.254:255.255.255.0\13 -#out setenv bootargs root=/dev/ram ramdisk_size=8192 init=/sbin/init ip=\%1:192.168.0.1\13 -#out setenv bootargs root=/dev/ram ramdisk_size=8192 init=/sbin/init ip=\%1\13 -out setenv bootargs console=/dev/ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.26:/eric_root_devel ip=\%1:192.168.1.26\13 -in 10 => -out setenv bootcmd bootm FFC00000\13 -in 10 => -out saveenv\13 -in 10 => -out reset\13 -in 5 autoboot -out \13\13 -in 10 => -quit -exit 0 diff --git a/tools/scripts/send_cmd b/tools/scripts/send_cmd deleted file mode 100644 index 4131331f03..0000000000 --- a/tools/scripts/send_cmd +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/kermit + -set line /dev/ttyS0 -set speed 115200 -set serial 8N1 -set carrier-watch off -set handshake none -set flow-control none -robust -set file type bin -set file name lit -set rec pack 1000 -set send pack 1000 -set window 5 -set prompt Kermit> - -#out \13 -#in 10 => -out \%1 \%2 \%3 \%4 \%5 \%6 \%7\13 -in 10 => -quit -exit 0 diff --git a/tools/scripts/send_image b/tools/scripts/send_image deleted file mode 100644 index 9b89d6b059..0000000000 --- a/tools/scripts/send_image +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/kermit + -# usage: send_image FILE_NAME OFFSET -# e.g. send_image output.bin 1F00000 -set line /dev/ttyS0 -set speed 115200 -set serial 8N1 -set carrier-watch off -set handshake none -set flow-control none -robust -set file type bin -set file name lit -set rec pack 1000 -set send pack 1000 -set window 5 -set prompt Kermit> - -out \13 -in 10 => -out loadb \%2 \13 -in 10 download ... -send \%1 -out \13 -in 10 ## Start Addr -quit -exit 0 diff --git a/tools/setlocalversion b/tools/setlocalversion deleted file mode 100755 index 9a23825218..0000000000 --- a/tools/setlocalversion +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# Print additional version information for non-release trees. - -usage() { - echo "Usage: $0 [srctree]" >&2 - exit 1 -} - -cd "${1:-.}" || usage - -# Check for git and a git repo. -if head=`git rev-parse --verify HEAD 2>/dev/null`; then - # Do we have an untagged version? - if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then - printf '%s%s' -g `echo "$head" | cut -c1-8` - fi - - # Are there uncommitted changes? - if git diff-files | read dummy; then - printf '%s' -dirty - fi -fi -- cgit v1.2.3