From 78f6622a1f135b8f3eabdba71cf26e8371f7eeef Mon Sep 17 00:00:00 2001 From: wdenk Date: Tue, 27 Aug 2002 10:27:51 +0000 Subject: [PATCH] Initial revision --- drivers/serial.c | 100 +++++++++++++++++++++ include/cmd_autoscript.h | 47 ++++++++++ include/cmd_bedbug.h | 117 +++++++++++++++++++++++++ include/cmd_bootm.h | 65 ++++++++++++++ include/cmd_cache.h | 51 +++++++++++ include/cmd_console.h | 42 +++++++++ include/cmd_dcr.h | 55 ++++++++++++ include/cmd_doc.h | 55 ++++++++++++ include/cmd_dtt.h | 46 ++++++++++ include/cmd_eeprom.h | 59 +++++++++++++ include/cmd_elf.h | 34 ++++++++ include/cmd_fdc.h | 47 ++++++++++ include/cmd_flash.h | 73 ++++++++++++++++ include/cmd_i2c.h | 103 ++++++++++++++++++++++ include/cmd_ide.h | 62 ++++++++++++++ include/cmd_immap.h | 181 +++++++++++++++++++++++++++++++++++++++ include/cmd_mem.h | 112 ++++++++++++++++++++++++ include/cmd_mii.h | 46 ++++++++++ include/cmd_misc.h | 58 +++++++++++++ include/cmd_net.h | 74 ++++++++++++++++ include/cmd_nvedit.h | 91 ++++++++++++++++++++ include/cmd_pcmcia.h | 44 ++++++++++ include/cmd_reginfo.h | 40 +++++++++ include/cmd_rtc.h | 50 +++++++++++ include/cmd_scsi.h | 62 ++++++++++++++ include/cmd_usb.h | 77 +++++++++++++++++ include/command.h | 90 +++++++++++++++++++ 27 files changed, 1881 insertions(+) create mode 100644 drivers/serial.c create mode 100644 include/cmd_autoscript.h create mode 100644 include/cmd_bedbug.h create mode 100644 include/cmd_bootm.h create mode 100644 include/cmd_cache.h create mode 100644 include/cmd_console.h create mode 100644 include/cmd_dcr.h create mode 100644 include/cmd_doc.h create mode 100644 include/cmd_dtt.h create mode 100644 include/cmd_eeprom.h create mode 100644 include/cmd_elf.h create mode 100644 include/cmd_fdc.h create mode 100644 include/cmd_flash.h create mode 100644 include/cmd_i2c.h create mode 100644 include/cmd_ide.h create mode 100644 include/cmd_immap.h create mode 100644 include/cmd_mem.h create mode 100644 include/cmd_mii.h create mode 100644 include/cmd_misc.h create mode 100644 include/cmd_net.h create mode 100644 include/cmd_nvedit.h create mode 100644 include/cmd_pcmcia.h create mode 100644 include/cmd_reginfo.h create mode 100644 include/cmd_rtc.h create mode 100644 include/cmd_scsi.h create mode 100644 include/cmd_usb.h create mode 100644 include/command.h diff --git a/drivers/serial.c b/drivers/serial.c new file mode 100644 index 0000000000..5e2115e24b --- /dev/null +++ b/drivers/serial.c @@ -0,0 +1,100 @@ +/* + * (C) Copyright 2000 + * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. + * + * 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 + +#ifdef CFG_NS16550_SERIAL + +#include +#ifdef CFG_NS87308 +#include +#endif + +#if CONFIG_CONS_INDEX == 1 +static NS16550_t console = (NS16550_t) CFG_NS16550_COM1; +#elif CONFIG_CONS_INDEX == 2 +static NS16550_t console = (NS16550_t) CFG_NS16550_COM2; +#elif CONFIG_CONS_INDEX == 3 +static NS16550_t console = (NS16550_t) CFG_NS16550_COM3; +#elif CONFIG_CONS_INDEX == 4 +static NS16550_t console = (NS16550_t) CFG_NS16550_COM4; +#else +#error no valid console defined +#endif + +int serial_init (void) +{ + DECLARE_GLOBAL_DATA_PTR; + + int clock_divisor = CFG_NS16550_CLK / 16 / gd->baudrate; + +#ifdef CFG_NS87308 + initialise_ns87308(); +#endif + + NS16550_init(console, clock_divisor); + + return (0); +} + +void +serial_putc(const char c) +{ + if (c == '\n') + NS16550_putc(console, '\r'); + + NS16550_putc(console, c); +} + +void +serial_puts (const char *s) +{ + while (*s) { + serial_putc (*s++); + } +} + + +int +serial_getc(void) +{ + return NS16550_getc(console); +} + +int +serial_tstc(void) +{ + return NS16550_tstc(console); +} + +void +serial_setbrg (void) +{ + DECLARE_GLOBAL_DATA_PTR; + + int clock_divisor = CFG_NS16550_CLK / 16 / gd->baudrate; + + NS16550_reinit(console, clock_divisor); +} + +#endif diff --git a/include/cmd_autoscript.h b/include/cmd_autoscript.h new file mode 100644 index 0000000000..520cfc9daa --- /dev/null +++ b/include/cmd_autoscript.h @@ -0,0 +1,47 @@ +/* + * (C) Copyright 2001 + * Kyle Harris, kharris@nexus-tech.net + * + * 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 + */ + +#ifndef _CMD_AUTOSCRIPT_H_ +#define _CMD_AUTOSCRIPT_H_ + +#define AUTOSCRIPT_MAGIC 0x09011962 + +#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) + +#define CMD_TBL_AUTOSCRIPT MK_CMD_TBL_ENTRY( \ + "autoscr", 5, 2, 0, do_autoscript, \ + "autoscr - run script from memory\n", \ + "[addr] - run script starting at addr. " \ + "A valid autoscr header must be present\n" \ +), + +int autoscript (ulong addr); +int do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else + +#define CMD_TBL_AUTOSCRIPT + +#endif + +#endif /* _CMD_AUTOSCRIPT_H_ */ diff --git a/include/cmd_bedbug.h b/include/cmd_bedbug.h new file mode 100644 index 0000000000..105441e44c --- /dev/null +++ b/include/cmd_bedbug.h @@ -0,0 +1,117 @@ +/* + * BedBug Functions + */ +#ifndef _CMD_BEDBUG_H +#define _CMD_BEDBUG_H + +#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) + +#define CMD_TBL_DIS MK_CMD_TBL_ENTRY( \ + "ds", 2, 3, 1, do_bedbug_dis, \ + "ds - disassemble memory\n", \ + "ds
[# instructions]\n" \ + ), + +#define CMD_TBL_ASM MK_CMD_TBL_ENTRY( \ + "as", 2, 2, 0, do_bedbug_asm, \ + "as - assemble memory\n", \ + "as
\n" \ + ), + +#define CMD_TBL_BREAK MK_CMD_TBL_ENTRY( \ + "break", 2, 3, 0, do_bedbug_break, \ + "break - set or clear a breakpoint\n", \ + " - Set or clear a breakpoint\n" \ + "break
- Break at an address\n" \ + "break off - Disable breakpoint.\n" \ + "break show - List breakpoints.\n" \ + ), + +#define CMD_TBL_CONTINUE MK_CMD_TBL_ENTRY( \ + "continue", 4, 1, 0, do_bedbug_continue, \ + "continue- continue from a breakpoint\n", \ + " - continue from a breakpoint.\n" \ + ), + +#define CMD_TBL_STEP MK_CMD_TBL_ENTRY( \ + "step", 4, 1, 1, do_bedbug_step, \ + "step - single step execution.\n", \ + " - single step execution.\n" \ + ), + +#define CMD_TBL_NEXT MK_CMD_TBL_ENTRY( \ + "next", 4, 1, 1, do_bedbug_next, \ + "next - single step execution, stepping over subroutines.\n",\ + " - single step execution, stepping over subroutines.\n" \ + ), + +#define CMD_TBL_STACK MK_CMD_TBL_ENTRY( \ + "where", 5, 1, 1, do_bedbug_stack, \ + "where - Print the running stack.\n", \ + " - Print the running stack.\n" \ + ), + +#define CMD_TBL_RDUMP MK_CMD_TBL_ENTRY( \ + "rdump", 5, 1, 1, do_bedbug_rdump, \ + "rdump - Show registers.\n", \ + " - Show registers.\n" \ + ), + +extern int do_bedbug_dis (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_asm (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_break (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_continue (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_step (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_next (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_stack (cmd_tbl_t *, int, int, char *[]); +extern int do_bedbug_rdump (cmd_tbl_t *, int, int, char *[]); + +/* Supporting routines */ +extern int bedbug_puts (const char *); +extern void bedbug_init (void); +extern void do_bedbug_breakpoint (struct pt_regs *); +extern void bedbug_main_loop (unsigned long, struct pt_regs *); + + +typedef struct { + int hw_debug_enabled; + int stopped; + int current_bp; + struct pt_regs *regs; + + void (*do_break) (cmd_tbl_t *, int, int, char *[]); + void (*break_isr) (struct pt_regs *); + int (*find_empty) (void); + int (*set) (int, unsigned long); + int (*clear) (int); +} CPU_DEBUG_CTX; + +#else /* ! CFG_CMD_BEDBUG */ + +#define CMD_TBL_DIS +#define CMD_TBL_ASM +#define CMD_TBL_BREAK +#define CMD_TBL_CONTINUE +#define CMD_TBL_STEP +#define CMD_TBL_NEXT +#define CMD_TBL_STACK +#define CMD_TBL_RDUMP + +#endif /* CFG_CMD_BEDBUG */ +#endif /* _CMD_BEDBUG_H */ + + +/* + * Copyright (c) 2001 William L. Pitts + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ diff --git a/include/cmd_bootm.h b/include/cmd_bootm.h new file mode 100644 index 0000000000..20c12676a7 --- /dev/null +++ b/include/cmd_bootm.h @@ -0,0 +1,65 @@ +/* + * (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 + */ + +/* + * Boot support + */ +#ifndef _CMD_BOOTM_H +#define _CMD_BOOTM_H +int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#define CMD_TBL_BOOTM MK_CMD_TBL_ENTRY( \ + "bootm", 5, CFG_MAXARGS, 1, do_bootm, \ + "bootm - boot application image from memory\n", \ + "[addr [arg ...]]\n - boot application image stored in memory\n" \ + " passing arguments 'arg ...'; when booting a Linux kernel,\n" \ + " 'arg' can be the address of an initrd image\n" \ +), + +#if (CONFIG_COMMANDS & CFG_CMD_BOOTD) +int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#define CMD_TBL_BOOTD MK_CMD_TBL_ENTRY( \ + "bootd", 4, 1, 1, do_bootd, \ + "bootd - boot default, i.e., run 'bootcmd'\n", \ + NULL \ +), +#else +#define CMD_TBL_BOOTD +#endif + +#if (CONFIG_COMMANDS & CFG_CMD_IMI) +int do_iminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#define CMD_TBL_IMINFO MK_CMD_TBL_ENTRY( \ + "iminfo", 3, CFG_MAXARGS, 1, do_iminfo, \ + "iminfo - print header information for application image\n", \ + "addr [addr ...]\n" \ + " - print header information for application image starting at\n" \ + " address 'addr' in memory; this includes verification of the\n" \ + " image contents (magic number, header and payload checksums)\n" \ +), +#else +#define CMD_TBL_IMINFO +#endif + +#endif /* _CMD_BOOTM_H */ diff --git a/include/cmd_cache.h b/include/cmd_cache.h new file mode 100644 index 0000000000..479a846709 --- /dev/null +++ b/include/cmd_cache.h @@ -0,0 +1,51 @@ +/* + * (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 + */ + +/* + * Cache support: switch on or off, get status + */ +#ifndef _CMD_CACHE_H +#define _CMD_CACHE_H + +#if (CONFIG_COMMANDS & CFG_CMD_CACHE) +#define CMD_TBL_ICACHE MK_CMD_TBL_ENTRY( \ + "icache", 2, 2, 1, do_icache, \ + "icache - enable or disable instruction cache\n", \ + "[on, off]\n" \ + " - enable or disable instruction cache\n" \ +), + +#define CMD_TBL_DCACHE MK_CMD_TBL_ENTRY( \ + "dcache", 2, 2, 1, do_dcache, \ + "dcache - enable or disable data cache\n", \ + "[on, off]\n" \ + " - enable or disable data (writethrough) cache\n" \ +), +int do_icache (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_dcache (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_ICACHE +#define CMD_TBL_DCACHE +#endif /* CFG_CMD_CACHE */ + +#endif /* _CMD_CACHE_H */ diff --git a/include/cmd_console.h b/include/cmd_console.h new file mode 100644 index 0000000000..4ac8b83b40 --- /dev/null +++ b/include/cmd_console.h @@ -0,0 +1,42 @@ +/* + * (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 + */ + +/* + * Network boot support + */ +#ifndef _CMD_CONSOLE_H +#define _CMD_CONSOLE_H + +#if (CONFIG_COMMANDS & CFG_CMD_CONSOLE) +#define CMD_TBL_CONINFO MK_CMD_TBL_ENTRY( \ + "coninfo", 5, 3, 1, do_coninfo, \ + "coninfo - print console devices and informations\n", \ + "" \ +), +int do_coninfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_CONINFO +#endif /* CFG_CMD_CONSOLE */ + +#endif diff --git a/include/cmd_dcr.h b/include/cmd_dcr.h new file mode 100644 index 0000000000..97196ad37c --- /dev/null +++ b/include/cmd_dcr.h @@ -0,0 +1,55 @@ +/* + * (C) Copyright 2001 + * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. + * + * 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 + */ + +/* + * IBM 4XX DCR Functions + */ +#ifndef _CMD_DCR_H +#define _CMD_DCR_H + +#if defined(CONFIG_4xx) && defined(CFG_CMD_SETGETDCR) +#define CMD_TBL_GETDCR MK_CMD_TBL_ENTRY( \ + "getdcr", 6, 2, 1, do_getdcr, \ + "getdcr - Get an IBM PPC 4xx DCR's value\n", \ + "dcrn - return a DCR's value.\n" \ +), +#define CMD_TBL_SETDCR MK_CMD_TBL_ENTRY( \ + "setdcr", 6, 2, 1, do_setdcr, \ + "setdcr - Set an IBM PPC 4xx DCR's value\n", \ + "dcrn - set a DCR's value.\n" \ +), +extern int do_getdcr (cmd_tbl_t *, int, int, char *[]); +extern int do_setdcr (cmd_tbl_t *, int, int, char *[]); + +/* Supporting routines */ +extern unsigned long get_dcr(unsigned short dcrn); +extern unsigned long set_dcr(unsigned short dcrn, unsigned long value); + +#else + +#define CMD_TBL_GETDCR +#define CMD_TBL_SETDCR + +#endif /* CONFIG_4xx & CFG_CMD_SETGETDCR */ + +#endif /* _CMD_DCR_H */ diff --git a/include/cmd_doc.h b/include/cmd_doc.h new file mode 100644 index 0000000000..07aa864124 --- /dev/null +++ b/include/cmd_doc.h @@ -0,0 +1,55 @@ +/* + * 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 + */ + +/* + * Disk-On-Chip support + */ +#ifndef _CMD_DOC_H +#define _CMD_DOC_H + +#include +#include + + +#if (CONFIG_COMMANDS & CFG_CMD_DOC) +#define CMD_TBL_DOC MK_CMD_TBL_ENTRY( \ + "doc", 3, 5, 1, do_doc, \ + "doc - Disk-On-Chip sub-system\n", \ + "info - show available DOC devices\n" \ + "doc device [dev] - show or set current device\n" \ + "doc read addr off size\n" \ + "doc write addr off size - read/write `size'" \ + " bytes starting at offset `off'\n" \ + " to/from memory address `addr'\n" \ + "doc erase off size - erase `size' bytes of DOC from offset `off'\n" \ +), + +#define CMD_TBL_DOCBOOT MK_CMD_TBL_ENTRY( \ + "docboot", 4, 4, 1, do_docboot, \ + "docboot - boot from DOC device\n", \ + "loadAddr dev\n" \ +), + +int do_doc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_DOC +#define CMD_TBL_DOCBOOT +#endif + +#endif /* _CMD_DOC_H */ diff --git a/include/cmd_dtt.h b/include/cmd_dtt.h new file mode 100644 index 0000000000..57192a3479 --- /dev/null +++ b/include/cmd_dtt.h @@ -0,0 +1,46 @@ +/* + * (C) Copyright 2001 + * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. + * + * 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 + */ + +/* + * Read Digital Thermometers & Thermostats + */ +#ifndef _CMD_DTT_H +#define _CMD_DTT_H + +#if (CONFIG_COMMANDS & CFG_CMD_DTT) + +#define CMD_TBL_DTT MK_CMD_TBL_ENTRY( \ + "dtt", 3, 1, 1, do_dtt, \ + "dtt - Digital Thermometer and Themostat\n", \ + " - Read temperature from digital thermometer and thermostat.\n" \ +), +extern int do_dtt (cmd_tbl_t *, int, int, char *[]); + +#else + +#define CMD_TBL_DTT + +#endif /* (CONFIG_COMMANDS & CFG_CMD_DTT) */ + +#endif /* _CMD_DTT_H */ + diff --git a/include/cmd_eeprom.h b/include/cmd_eeprom.h new file mode 100644 index 0000000000..26d929dc4e --- /dev/null +++ b/include/cmd_eeprom.h @@ -0,0 +1,59 @@ +/* + * (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 + */ + +/* + * EEPROM support + */ +#ifndef _CMD_EEPROM_H +#define _CMD_EEPROM_H + +#include +#include + +#if (CONFIG_COMMANDS & CFG_CMD_EEPROM) + +#ifdef CFG_I2C_MULTI_EEPROMS +#define CMD_TBL_EEPROM MK_CMD_TBL_ENTRY( \ + "eeprom", 3, 6, 1, do_eeprom, \ + "eeprom - EEPROM sub-system\n", \ + "read devaddr addr off cnt\n" \ + "eeprom write devaddr addr off cnt\n" \ + " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'\n" \ +), +#else /* One EEPROM */ +#define CMD_TBL_EEPROM MK_CMD_TBL_ENTRY( \ + "eeprom", 3, 5, 1, do_eeprom, \ + "eeprom - EEPROM sub-system\n", \ + "read addr off cnt\n" \ + "eeprom write addr off cnt\n" \ + " - read/write `cnt' bytes at EEPROM offset `off'\n" \ +), +#endif /* CFG_I2C_MULTI_EEPROMS */ +int do_eeprom (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else + +#define CMD_TBL_EEPROM + +#endif /* CFG_CMD_EEPROM */ + +#endif /* _CMD_EEPROM_H */ diff --git a/include/cmd_elf.h b/include/cmd_elf.h new file mode 100644 index 0000000000..64c52bc63a --- /dev/null +++ b/include/cmd_elf.h @@ -0,0 +1,34 @@ +/* + * Elf Load/Boot Functions + */ +#ifndef _CMD_ELF_H +#define _CMD_ELF_H + +#if (CONFIG_COMMANDS & CFG_CMD_ELF) + +#define CMD_TBL_BOOTELF MK_CMD_TBL_ENTRY( \ + "bootelf", 7, 2, 0, do_bootelf, \ + "bootelf - Boot from an ELF image in memory\n", \ + " [address] - load address of ELF image.\n" \ + ), + +#define CMD_TBL_BOOTVX MK_CMD_TBL_ENTRY( \ + "bootvx", 6, 2, 0, do_bootvx, \ + "bootvx - Boot vxWorks from an ELF image\n", \ + " [address] - load address of vxWorks ELF image.\n" \ + ), + +extern int do_bootelf (cmd_tbl_t *, int, int, char *[]); +extern int do_bootvx (cmd_tbl_t *, int, int, char *[]); + +/* Supporting routines */ +extern int valid_elf_image (unsigned long); +extern unsigned long load_elf_image (unsigned long); + +#else /* ! CFG_CMD_ELF */ + +#define CMD_TBL_BOOTELF +#define CMD_TBL_BOOTVX + +#endif /* CFG_CMD_ELF */ +#endif /* _CMD_ELF_H */ diff --git a/include/cmd_fdc.h b/include/cmd_fdc.h new file mode 100644 index 0000000000..f51df1f5a8 --- /dev/null +++ b/include/cmd_fdc.h @@ -0,0 +1,47 @@ +/* + * (C) Copyright 2001 + * Denis Peter, MPL AG, d.peter@mpl.ch + * + * 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 + */ + +/* + * Floppy support + */ +#ifndef _CMD_FDC_H +#define _CMD_FDC_H + +#include +#include + + +#if (CONFIG_COMMANDS & CFG_CMD_FDC) + +#define CMD_TBL_FDC MK_CMD_TBL_ENTRY( \ + "fdcboot", 4, 3, 1, do_fdcboot, \ + "fdcboot - boot from floppy device\n", \ + "loadAddr drive\n" \ +), +int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_FDC +#endif + +#endif /* _CMD_FDC_H */ diff --git a/include/cmd_flash.h b/include/cmd_flash.h new file mode 100644 index 0000000000..6f5c6cd045 --- /dev/null +++ b/include/cmd_flash.h @@ -0,0 +1,73 @@ +/* + * (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 + */ + +/* + * FLASH support + */ +#ifndef _CMD_FLASH_H +#define _CMD_FLASH_H + +#if (CONFIG_COMMANDS & CFG_CMD_FLASH) +#define CMD_TBL_FLINFO MK_CMD_TBL_ENTRY( \ + "flinfo", 3, 2, 1, do_flinfo, \ + "flinfo - print FLASH memory information\n", \ + "\n - print information for all FLASH memory banks\n" \ + "flinfo N\n - print information for FLASH memory bank # N\n" \ +), + +#define CMD_TBL_FLERASE MK_CMD_TBL_ENTRY( \ + "erase", 3, 3, 1, do_flerase, \ + "erase - erase FLASH memory\n", \ + "start end\n" \ + " - erase FLASH from addr 'start' to addr 'end'\n" \ + "erase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n" \ + "erase bank N\n - erase FLASH bank # N\n" \ + "erase all\n - erase all FLASH banks\n" \ +), + +#define CMD_TBL_PROTECT MK_CMD_TBL_ENTRY( \ + "protect", 4, 4, 1, do_protect, \ + "protect - enable or disable FLASH write protection\n", \ + "on start end\n" \ + " - protect FLASH from addr 'start' to addr 'end'\n" \ + "protect on N:SF[-SL]\n" \ + " - protect sectors SF-SL in FLASH bank # N\n" \ + "protect on bank N\n - protect FLASH bank # N\n" \ + "protect on all\n - protect all FLASH banks\n" \ + "protect off start end\n" \ + " - make FLASH from addr 'start' to addr 'end' writable\n" \ + "protect off N:SF[-SL]\n" \ + " - make sectors SF-SL writable in FLASH bank # N\n" \ + "protect off bank N\n - make FLASH bank # N writable\n" \ + "protect off all\n - make all FLASH banks writable\n" \ +), +int do_flinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_FLINFO +#define CMD_TBL_FLERASE +#define CMD_TBL_PROTECT +#endif /* CFG_CMD_FLASH */ + +#endif /* _CMD_FLASH_H */ diff --git a/include/cmd_i2c.h b/include/cmd_i2c.h new file mode 100644 index 0000000000..7334fd4f7a --- /dev/null +++ b/include/cmd_i2c.h @@ -0,0 +1,103 @@ +/* + * (C) Copyright 2001 + * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com. + * + * 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 + */ + +/* + * I2C Functions + */ +#ifndef _CMD_I2C_H +#define _CMD_I2C_H + +#if (CONFIG_COMMANDS & CFG_CMD_I2C) +#define CMD_TBL_IMD MK_CMD_TBL_ENTRY( \ + "imd", 3, 4, 1, do_i2c_md, \ + "imd - i2c memory display\n", \ + "chip address[.0, .1, .2] [# of objects]\n - i2c memory display\n" \ +), +#define CMD_TBL_IMM MK_CMD_TBL_ENTRY( \ + "imm", 3, 3, 1, do_i2c_mm, \ + "imm - i2c memory modify (auto-incrementing)\n", \ + "chip address[.0, .1, .2]\n" \ + " - memory modify, auto increment address\n" \ +), +#define CMD_TBL_INM MK_CMD_TBL_ENTRY( \ + "inm", 3, 3, 1, do_i2c_nm, \ + "inm - memory modify (constant address)\n", \ + "chip address[.0, .1, .2]\n - memory modify, read and keep address\n" \ +), +#define CMD_TBL_IMW MK_CMD_TBL_ENTRY( \ + "imw", 3, 5, 1, do_i2c_mw, \ + "imw - memory write (fill)\n", \ + "chip address[.0, .1, .2] value [count]\n - memory write (fill)\n" \ +), +#define CMD_TBL_ICRC MK_CMD_TBL_ENTRY( \ + "icrc32", 4, 5, 1, do_i2c_crc, \ + "icrc32 - checksum calculation\n", \ + "chip address[.0, .1, .2] count\n - compute CRC32 checksum\n" \ +), +#define CMD_TBL_IPROBE MK_CMD_TBL_ENTRY( \ + "iprobe", 3, 1, 1, do_i2c_probe, \ + "iprobe - probe to discover valid I2C chip addresses\n", \ + "\n -discover valid I2C chip addresses\n" \ +), +/* + * Require full name for "iloop" because it is an infinite loop! + */ +#define CMD_TBL_ILOOP MK_CMD_TBL_ENTRY( \ + "iloop", 5, 5, 1, do_i2c_loop, \ + "iloop - infinite loop on address range\n", \ + "chip address[.0, .1, .2] [# of objects]\n" \ + " - loop, reading a set of addresses\n" \ +), +#if (CONFIG_COMMANDS & CFG_CMD_SDRAM) +#define CMD_TBL_ISDRAM MK_CMD_TBL_ENTRY( \ + "isdram", 6, 2, 1, do_sdram, \ + "isdram - print SDRAM configuration information\n", \ + "chip\n - print SDRAM configuration information\n" \ + " (valid chip values 50..57)\n" \ +), +#else +#define CMD_TBL_ISDRAM +#endif + + +int do_i2c_md(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2c_mm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2c_nm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2c_mw(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2c_crc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2c_probe(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_sdram(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_IMD +#define CMD_TBL_IMM +#define CMD_TBL_INM +#define CMD_TBL_IMW +#define CMD_TBL_ICRC +#define CMD_TBL_IPROBE +#define CMD_TBL_ILOOP +#define CMD_TBL_ISDRAM +#endif /* CFG_CMD_MEMORY */ + +#endif /* _CMD_I2C_H */ diff --git a/include/cmd_ide.h b/include/cmd_ide.h new file mode 100644 index 0000000000..0433c20fc7 --- /dev/null +++ b/include/cmd_ide.h @@ -0,0 +1,62 @@ +/* + * (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 + */ + +/* + * IDE support + */ +#ifndef _CMD_IDE_H +#define _CMD_IDE_H + +#include +#include + + +#if (CONFIG_COMMANDS & CFG_CMD_IDE) +#define CMD_TBL_IDE MK_CMD_TBL_ENTRY( \ + "ide", 3, 5, 1, do_ide, \ + "ide - IDE sub-system\n", \ + "reset - reset IDE controller\n" \ + "ide info - show available IDE devices\n" \ + "ide device [dev] - show or set current device\n" \ + "ide part [dev] - print partition table of one or all IDE devices\n" \ + "ide read addr blk# cnt\n" \ + "ide write addr blk# cnt - read/write `cnt'" \ + " blocks starting at block `blk#'\n" \ + " to/from memory address `addr'\n" \ +), + +#define CMD_TBL_DISK MK_CMD_TBL_ENTRY( \ + "diskboot", 4, 3, 1, do_diskboot, \ + "diskboot- boot from IDE device\n", \ + "loadAddr dev:part\n" \ +), + +int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_IDE +#define CMD_TBL_DISK +#endif + +#endif /* _CMD_IDE_H */ diff --git a/include/cmd_immap.h b/include/cmd_immap.h new file mode 100644 index 0000000000..9febee2f36 --- /dev/null +++ b/include/cmd_immap.h @@ -0,0 +1,181 @@ +/* + * (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 + */ + +/* + * PowerPC 8xx/8260 Internal Memory Map commands + */ +#ifndef _CMD_IMMAP_H +#define _CMD_IMMAP_H + +#if (CONFIG_COMMANDS & CFG_CMD_IMMAP) && \ + (defined(CONFIG_8xx) || defined(CONFIG_8260)) + +#define CMD_TBL_SIUINFO MK_CMD_TBL_ENTRY( \ + "siuinfo", 3, 1, 1, do_siuinfo, \ + "siuinfo - print System Interface Unit (SIU) registers\n", \ + NULL \ +), + +#define CMD_TBL_MEMCINFO MK_CMD_TBL_ENTRY( \ + "memcinfo", 4, 1, 1, do_memcinfo, \ + "memcinfo- print Memory Controller registers\n", \ + NULL \ +), + +#define CMD_TBL_SITINFO MK_CMD_TBL_ENTRY( \ + "sitinfo", 3, 1, 1, do_sitinfo, \ + "sitinfo - print System Integration Timers (SIT) registers\n", \ + NULL \ +), + +#ifdef CONFIG_8260 +#define CMD_TBL_ICINFO MK_CMD_TBL_ENTRY( \ + "icinfo", 3, 1, 1, do_icinfo, \ + "icinfo - print Interrupt Controller registers\n", \ + NULL \ +), +#endif + +#define CMD_TBL_CARINFO MK_CMD_TBL_ENTRY( \ + "carinfo", 3, 1, 1, do_carinfo, \ + "carinfo - print Clocks and Reset registers\n", \ + NULL \ +), + +#define CMD_TBL_IOPINFO MK_CMD_TBL_ENTRY( \ + "iopinfo", 4, 1, 1, do_iopinfo, \ + "iopinfo - print I/O Port registers\n", \ + NULL \ +), + +#define CMD_TBL_IOPSET MK_CMD_TBL_ENTRY( \ + "iopset", 4, 5, 0, do_iopset, \ + "iopset - set I/O Port registers\n", \ + "PORT PIN CMD VALUE\nPORT: A-D, PIN: 0-31, CMD: [dat|dir|odr|sor], VALUE: 0|1" \ +), + +#define CMD_TBL_DMAINFO MK_CMD_TBL_ENTRY( \ + "dmainfo", 3, 1, 1, do_dmainfo, \ + "dmainfo - print SDMA/IDMA registers\n", \ + NULL \ +), + +#define CMD_TBL_FCCINFO MK_CMD_TBL_ENTRY( \ + "fccinfo", 3, 1, 1, do_fccinfo, \ + "fccinfo - print FCC registers\n", \ + NULL \ +), + +#define CMD_TBL_BRGINFO MK_CMD_TBL_ENTRY( \ + "brginfo", 3, 1, 1, do_brginfo, \ + "brginfo - print Baud Rate Generator (BRG) registers\n", \ + NULL \ +), + +#define CMD_TBL_I2CINFO MK_CMD_TBL_ENTRY( \ + "i2cinfo", 4, 1, 1, do_i2cinfo, \ + "i2cinfo - print I2C registers\n", \ + NULL \ +), + +#define CMD_TBL_SCCINFO MK_CMD_TBL_ENTRY( \ + "sccinfo", 3, 1, 1, do_sccinfo, \ + "sccinfo - print SCC registers\n", \ + NULL \ +), + +#define CMD_TBL_SMCINFO MK_CMD_TBL_ENTRY( \ + "smcinfo", 3, 1, 1, do_smcinfo, \ + "smcinfo - print SMC registers\n", \ + NULL \ +), + +#define CMD_TBL_SPIINFO MK_CMD_TBL_ENTRY( \ + "spiinfo", 3, 1, 1, do_spiinfo, \ + "spiinfo - print Serial Peripheral Interface (SPI) registers\n",\ + NULL \ +), + +#define CMD_TBL_MUXINFO MK_CMD_TBL_ENTRY( \ + "muxinfo", 3, 1, 1, do_muxinfo, \ + "muxinfo - print CPM Multiplexing registers\n", \ + NULL \ +), + +#define CMD_TBL_SIINFO MK_CMD_TBL_ENTRY( \ + "siinfo", 3, 1, 1, do_siinfo, \ + "siinfo - print Serial Interface (SI) registers\n", \ + NULL \ +), + +#define CMD_TBL_MCCINFO MK_CMD_TBL_ENTRY( \ + "mccinfo", 3, 1, 1, do_mccinfo, \ + "mccinfo - print MCC registers\n", \ + NULL \ +), + +int do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_memcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_sitinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#ifdef CONFIG_8260 +int do_icinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#endif +int do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_dmainfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_fccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_sccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_smcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_spiinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_muxinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_siinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else + +#define CMD_TBL_SIUINFO +#define CMD_TBL_MEMCINFO +#define CMD_TBL_SITINFO +#ifdef CONFIG_8260 +#define CMD_TBL_ICINFO +#endif +#define CMD_TBL_CARINFO +#define CMD_TBL_IOPINFO +#define CMD_TBL_IOPSET +#define CMD_TBL_DMAINFO +#define CMD_TBL_FCCINFO +#define CMD_TBL_BRGINFO +#define CMD_TBL_I2CINFO +#define CMD_TBL_SCCINFO +#define CMD_TBL_SMCINFO +#define CMD_TBL_SPIINFO +#define CMD_TBL_MUXINFO +#define CMD_TBL_SIINFO +#define CMD_TBL_MCCINFO + +#endif /* CFG_CMD_IMMAP && (CONFIG_8xx || CONFIG_8260) */ + +#endif /* _CMD_IMMAP_H */ diff --git a/include/cmd_mem.h b/include/cmd_mem.h new file mode 100644 index 0000000000..aa0c540c10 --- /dev/null +++ b/include/cmd_mem.h @@ -0,0 +1,112 @@ +/* + * (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 + */ + +/* + * Memory Functions + */ +#ifndef _CMD_MEM_H +#define _CMD_MEM_H + +#if (CONFIG_COMMANDS & CFG_CMD_MEMORY) +#define CMD_TBL_MD MK_CMD_TBL_ENTRY( \ + "md", 2, 3, 1, do_mem_md, \ + "md - memory display\n", \ + "[.b, .w, .l] address [# of objects]\n - memory display\n" \ +), +#define CMD_TBL_MM MK_CMD_TBL_ENTRY( \ + "mm", 2, 2, 1, do_mem_mm, \ + "mm - memory modify (auto-incrementing)\n", \ + "[.b, .w, .l] address\n" \ + " - memory modify, auto increment address\n" \ +), +#define CMD_TBL_NM MK_CMD_TBL_ENTRY( \ + "nm", 2, 2, 1, do_mem_nm, \ + "nm - memory modify (constant address)\n", \ + "[.b, .w, .l] address\n - memory modify, read and keep address\n" \ +), +#define CMD_TBL_MW MK_CMD_TBL_ENTRY( \ + "mw", 2, 4, 1, do_mem_mw, \ + "mw - memory write (fill)\n", \ + "[.b, .w, .l] address value [count]\n - write memory\n" \ +), +#define CMD_TBL_CP MK_CMD_TBL_ENTRY( \ + "cp", 2, 4, 1, do_mem_cp, \ + "cp - memory copy\n", \ + "[.b, .w, .l] source target count\n - copy memory\n" \ +), +#define CMD_TBL_CMP MK_CMD_TBL_ENTRY( \ + "cmp", 3, 4, 1, do_mem_cmp, \ + "cmp - memory compare\n", \ + "[.b, .w, .l] addr1 addr2 count\n - compare memory\n" \ +), +#define CMD_TBL_CRC MK_CMD_TBL_ENTRY( \ + "crc32", 3, 4, 1, do_mem_crc, \ + "crc32 - checksum calculation\n", \ + "address count [addr]\n - compute CRC32 checksum [save at addr]\n" \ +), +#define CMD_TBL_BASE MK_CMD_TBL_ENTRY( \ + "base", 2, 2, 1, do_mem_base, \ + "base - print or set address offset\n", \ + "\n - print address offset for memory commands\n" \ + "base off\n - set address offset for memory commands to 'off'\n" \ +), +/* + * Require full name for "loop" and "mtest" because these are infinite loops! + */ +#define CMD_TBL_LOOP MK_CMD_TBL_ENTRY( \ + "loop", 4, 3, 1, do_mem_loop, \ + "loop - infinite loop on address range\n", \ + "[.b, .w, .l] address number_of_objects\n" \ + " - loop on a set of addresses\n" \ +), +#define CMD_TBL_MTEST MK_CMD_TBL_ENTRY( \ + "mtest", 5, 4, 1, do_mem_mtest, \ + "mtest - simple RAM test\n", \ + "[start [end [pattern]]]\n" \ + " - simple RAM read/write test\n" \ +), +int do_mem_md (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_mm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_nm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_mw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_cp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_MD +#define CMD_TBL_MM +#define CMD_TBL_NM +#define CMD_TBL_MW +#define CMD_TBL_CP +#define CMD_TBL_CMP +#define CMD_TBL_CRC +#define CMD_TBL_BASE +#define CMD_TBL_LOOP +#define CMD_TBL_MTEST +#endif /* CFG_CMD_MEMORY */ + +#endif /* _CMD_MEM_H */ diff --git a/include/cmd_mii.h b/include/cmd_mii.h new file mode 100644 index 0000000000..7ded0cc93c --- /dev/null +++ b/include/cmd_mii.h @@ -0,0 +1,46 @@ +/* + * (C) Copyright 2001 + * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com + * + * 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 + */ + +/* + * MII Functions + */ +#ifndef _CMD_MII_H +#define _CMD_MII_H + +#if (CONFIG_COMMANDS & CFG_CMD_MII) +#define CMD_TBL_MII MK_CMD_TBL_ENTRY( \ + "mii", 3, 5, 1, do_mii, \ + "mii - MII utility commands\n", \ + "\ +info - display MII PHY info\n\ +mii read - read MII PHY register \n\ +mii write - write MII PHY register \n" \ +), + +int do_mii (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_MII +#endif /* CFG_CMD_MII */ + +#endif /* _CMD_MII_H */ diff --git a/include/cmd_misc.h b/include/cmd_misc.h new file mode 100644 index 0000000000..873f5c4320 --- /dev/null +++ b/include/cmd_misc.h @@ -0,0 +1,58 @@ +/* + * (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 + */ + +/* + * Miscellanious commands + */ +#ifndef _CMD_MISC_H +#define _CMD_MISC_H + +#if (CONFIG_COMMANDS & CFG_CMD_IRQ) +#define CMD_TBL_IRQINFO MK_CMD_TBL_ENTRY( \ + "irqinfo", 3, 1, 1, do_irqinfo, \ + "irqinfo - print information about IRQs\n", \ + NULL \ +), + +/* Implemented in $(CPU)/interrupts.c */ +int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_IRQINFO +#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */ + +#if (CONFIG_COMMANDS & CFG_CMD_MISC) +#define CMD_TBL_MISC MK_CMD_TBL_ENTRY( \ + "sleep", 5, 2, 2, do_sleep, \ + "sleep - delay execution for some time\n", \ + "N\n" \ + " - delay execution for N seconds (N is _decimal_ !!!)\n" \ +), + +/* Implemented in common/cmd_misc.c */ +int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_MISC +#endif /* CFG_CMD_MISC */ + +#endif /* _CMD_MISC_H */ diff --git a/include/cmd_net.h b/include/cmd_net.h new file mode 100644 index 0000000000..2fa848bb68 --- /dev/null +++ b/include/cmd_net.h @@ -0,0 +1,74 @@ +/* + * (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 + */ + +/* + * Network boot support + */ +#ifndef _CMD_NET_H +#define _CMD_NET_H + +#if (CONFIG_COMMANDS & CFG_CMD_NET) +#define CMD_TBL_BOOTP MK_CMD_TBL_ENTRY( \ + "bootp", 5, 3, 1, do_bootp, \ + "bootp - boot image via network using BootP/TFTP protocol\n", \ + "[loadAddress] [bootfilename]\n" \ +), +int do_bootp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#define CMD_TBL_TFTPB MK_CMD_TBL_ENTRY( \ + "tftpboot", 4, 3, 1, do_tftpb, \ + "tftpboot- boot image via network using TFTP protocol\n" \ + " and env variables ipaddr and serverip\n", \ + "[loadAddress] [bootfilename]\n" \ +), + +int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + + +#define CMD_TBL_RARPB MK_CMD_TBL_ENTRY( \ + "rarpboot", 4, 3, 1, do_rarpb, \ + "rarpboot- boot image via network using RARP/TFTP protocol\n", \ + "[loadAddress] [bootfilename]\n" \ +), + +int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#if (CONFIG_COMMANDS & CFG_CMD_DHCP) +#define CMD_TBL_DHCP MK_CMD_TBL_ENTRY( \ + "dhcp", 4, 3, 1, do_dhcp, \ + "dhcp - invoke DHCP client to obtain IP/boot params\n", \ + "\n" \ +), + +int do_dhcp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_DHCP +#endif /* CFG_CMD_DHCP */ + +#else +#define CMD_TBL_BOOTP +#define CMD_TBL_TFTPB +#define CMD_TBL_RARPB +#define CMD_TBL_DHCP +#endif /* CFG_CMD_NET */ + +#endif diff --git a/include/cmd_nvedit.h b/include/cmd_nvedit.h new file mode 100644 index 0000000000..345127dd9d --- /dev/null +++ b/include/cmd_nvedit.h @@ -0,0 +1,91 @@ +/* + * (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 + */ + +/* + * Boot support + */ +#ifndef _CMD_NVEDIT_H +#define _CMD_NVEDIT_H + +#define CMD_TBL_PRINTENV MK_CMD_TBL_ENTRY( \ + "printenv", 4, CFG_MAXARGS, 1, do_printenv, \ + "printenv- print environment variables\n", \ + "\n - print values of all environment variables\n" \ + "printenv name ...\n" \ + " - print value of environment variable 'name'\n" \ +), +int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#define CMD_TBL_SETENV MK_CMD_TBL_ENTRY( \ + "setenv", 6, CFG_MAXARGS, 0, do_setenv, \ + "setenv - set environment variables\n", \ + "name value ...\n" \ + " - set environment variable 'name' to 'value ...'\n" \ + "setenv name\n" \ + " - delete environment variable 'name'\n" \ +), +int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#if ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == (CFG_CMD_ENV|CFG_CMD_FLASH)) +#define CMD_TBL_SAVEENV MK_CMD_TBL_ENTRY( \ + "saveenv", 4, 1, 0, do_saveenv, \ + "saveenv - save environment variables to persistent storage\n", \ + NULL \ +), +int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_SAVEENV +#endif /* CFG_CMD_ENV */ + +#if (CONFIG_COMMANDS & CFG_CMD_ASKENV) +#define CMD_TBL_ASKENV MK_CMD_TBL_ENTRY( \ + "askenv", 8, CFG_MAXARGS, 1, do_askenv, \ + "askenv - get environment variables from stdin\n", \ + "name [message] [size]\n" \ + " - get environment variable 'name' from stdin (max 'size' chars)\n" \ + "askenv name\n" \ + " - get environment variable 'name' from stdin\n" \ + "askenv name size\n" \ + " - get environment variable 'name' from stdin (max 'size' chars)\n" \ + "askenv name [message] size\n" \ + " - display 'message' string and get environment variable 'name'" \ + "from stdin (max 'size' chars)\n" \ +), +int do_askenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_ASKENV +#endif /* CFG_CMD_ASKENV */ + +#if (CONFIG_COMMANDS & CFG_CMD_RUN) +#define CMD_TBL_RUN MK_CMD_TBL_ENTRY( \ + "run", 3, CFG_MAXARGS, 1, do_run, \ + "run - run commands in an environment variable\n", \ + "var [...]\n" \ + " - run the commands in the environment variable(s) 'var'\n" \ +), +int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_RUN +#endif /* CFG_CMD_RUN */ + +#endif /* _CMD_NVEDIT_H */ diff --git a/include/cmd_pcmcia.h b/include/cmd_pcmcia.h new file mode 100644 index 0000000000..24a207bd08 --- /dev/null +++ b/include/cmd_pcmcia.h @@ -0,0 +1,44 @@ +/* + * (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 + */ + +/* + * PCMCIA support + */ +#ifndef _CMD_PCMCIA_H +#define _CMD_PCMCIA_H + +#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) +#define CMD_TBL_PINIT MK_CMD_TBL_ENTRY( \ + "pinit", 4, 2, 1, do_pinit, \ + "pinit - PCMCIA sub-system\n", \ + "on - power on PCMCIA socket\n" \ + "pinit off - power off PCMCIA socket\n" \ +), + +int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +#else +#define CMD_TBL_PINIT +#endif + +#endif /* _CMD_PCMCIA_H */ + diff --git a/include/cmd_reginfo.h b/include/cmd_reginfo.h new file mode 100644 index 0000000000..d4e995d1a7 --- /dev/null +++ b/include/cmd_reginfo.h @@ -0,0 +1,40 @@ +/* + * (C) Copyright 2000 + * Subodh Nijsure, SkyStream Networks, snijsure@skystream.com + * + * 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 + */ + +#ifndef _CMD_REGINFO_H_ +#define _CMD_REGINFO_H_ + +#if (defined(CONFIG_8xx) || defined(CONFIG_405GP)) && \ + (CONFIG_COMMANDS & CFG_CMD_REGINFO) +#define CMD_TBL_REGINFO MK_CMD_TBL_ENTRY( \ + "reginfo", 3, 2, 1, do_reginfo, \ + "reginfo - print register information\n", \ +), + +int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else +#define CMD_TBL_REGINFO +#endif /* CONFIG_8xx && CFG_CMD_REGINFO */ + +#endif /* _CMD_REGINFO_H_ */ diff --git a/include/cmd_rtc.h b/include/cmd_rtc.h new file mode 100644 index 0000000000..2149f78352 --- /dev/null +++ b/include/cmd_rtc.h @@ -0,0 +1,50 @@ +/* + * (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 + */ + +#ifndef _CMD_RTC_H_ +#define _CMD_RTC_H_ + +#include +#include + +#if (CONFIG_COMMANDS & CFG_CMD_DATE) + +#define CMD_TBL_DATE MK_CMD_TBL_ENTRY( \ + "date", 3, 2, 1, do_date, \ + "date - get/set/reset date & time\n", \ + "[MMDDhhmm[[CC]YY][.ss]]\ndate reset\n" \ + " - without arguments: print date & time\n" \ + " - with numeric argument: set the system date & time\n" \ + " - with 'reset' argument: reset the RTC\n" \ +), + +int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +#else + +#define CMD_TBL_DATE + +#endif /* CFG_CMD_DATE */ + + +#endif /* _CMD_RTC_H_ */ diff --git a/include/cmd_scsi.h b/include/cmd_scsi.h new file mode 100644 index 0000000000..4dca059abb --- /dev/null +++ b/include/cmd_scsi.h @@ -0,0 +1,62 @@ +/* + * (C) Copyright 2001 + * Denis Peter, MPL AG Switzerland + * + * 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 + * + */ +#ifndef _CMD_SCSI_H +#define _CMD_SCSI_H + +#include +#include + + +#if (CONFIG_COMMANDS & CFG_CMD_SCSI) + +#define CMD_TBL_SCSI MK_CMD_TBL_ENTRY( \ + "scsi", 4, 5, 1, do_scsi, \ + "scsi - SCSI sub-system\n", \ + "reset - reset SCSI controller\n" \ + "scsi info - show available SCSI devices\n" \ + "scsi scan - (re-)scan SCSI bus\n" \ + "scsi device [dev] - show or set current device\n" \ + "scsi part [dev] - print partition table of one or all SCSI devices\n" \ + "scsi read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"\ + " to memory address `addr'\n" \ +), + + +#define CMD_TBL_SCSIBOOT MK_CMD_TBL_ENTRY( \ + "scsiboot", 5, 3, 1, do_scsiboot, \ + "scsiboot- boot from SCSI device\n", \ + "loadAddr dev:part\n" \ +), + +int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + + +#else +#define CMD_TBL_SCSI +#define CMD_TBL_SCSIBOOT +#endif + +#endif /* _CMD_SCSI_H */ + diff --git a/include/cmd_usb.h b/include/cmd_usb.h new file mode 100644 index 0000000000..b7b4e831b5 --- /dev/null +++ b/include/cmd_usb.h @@ -0,0 +1,77 @@ +/* + * (C) Copyright 2001 + * Denis Peter, MPL AG Switzerland + * + * 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 + * + */ +#ifndef _CMD_USB_H +#define _CMD_USB_H + +#include +#include + + +#if (CONFIG_COMMANDS & CFG_CMD_USB) + +#ifdef CONFIG_USB_STORAGE +#define CMD_TBL_USB MK_CMD_TBL_ENTRY( \ + "usb", 4, 5, 1, do_usb, \ + "usb - USB sub-system\n", \ + "reset - reset (rescan) USB controller\n" \ + "usb stop [f] - stop USB [f]=force stop\n" \ + "usb tree - show USB device tree\n" \ + "usb info [dev] - show available USB devices\n" \ + "usb scan - (re-)scan USB bus for storage devices\n" \ + "usb device [dev] - show or set current USB storage device\n" \ + "usb part [dev] - print partition table of one or all USB storage devices\n" \ + "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"\ + " to memory address `addr'\n" \ +), + + +#define CMD_TBL_USBBOOT MK_CMD_TBL_ENTRY( \ + "usbboot", 5, 3, 1, do_usbboot, \ + "usbboot - boot from USB device\n", \ + "loadAddr dev:part\n" \ +), + +#else +#define CMD_TBL_USB MK_CMD_TBL_ENTRY( \ + "usb", 4, 5, 1, do_usb, \ + "usb - USB sub-system\n", \ + "reset - reset (rescan) USB controller\n" \ + "usb tree - show USB device tree\n" \ + "usb info [dev] - show available USB devices\n" \ +), + +#define CMD_TBL_USBBOOT +#endif + +int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + + +#else +#define CMD_TBL_USB +#define CMD_TBL_USBBOOT +#endif + +#endif /* _CMD_USB_H */ + diff --git a/include/command.h b/include/command.h new file mode 100644 index 0000000000..9453c0d1c0 --- /dev/null +++ b/include/command.h @@ -0,0 +1,90 @@ +/* + * (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 + */ + +/* + * Definitions for Command Processor + */ +#ifndef __COMMAND_H +#define __COMMAND_H + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef __ASSEMBLY__ +/* + * Monitor Command Table + */ + +struct cmd_tbl_s { + char *name; /* Command Name */ + int lmin; /* minimum abbreviated length */ + int maxargs; /* maximum number of arguments */ + int repeatable; /* autorepeat allowed? */ + /* Implementation function */ + int (*cmd)(struct cmd_tbl_s *, int, int, char *[]); + char *usage; /* Usage message (short) */ +#ifdef CFG_LONGHELP + char *help; /* Help message (long) */ +#endif +}; + +typedef struct cmd_tbl_s cmd_tbl_t; + +extern cmd_tbl_t cmd_tbl[]; + +#ifdef CFG_LONGHELP +#define MK_CMD_TBL_ENTRY(name,lmin,maxargs,rep,cmd,usage,help) \ + { name, lmin, maxargs, rep, cmd, usage, help } +#else /* no help info */ +#define MK_CMD_TBL_ENTRY(name,lmin,maxargs,rep,cmd,usage,help) \ + { name, lmin, maxargs, rep, cmd, usage } +#endif + +/* common/command.c */ +cmd_tbl_t *find_cmd(const char *cmd); + +/* + * Monitor Command + * + * All commands use a common argument format: + * + * void function (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + */ + +typedef void command_t (cmd_tbl_t *, int, int, char *[]); + +#endif /* __ASSEMBLY__ */ + +/* + * Command Flags: + */ +#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */ +#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */ + +/* + * Configurable monitor commands definitions have been moved + * to include/cmd_confdefs.h + */ + +#endif /* __COMMAND_H */ -- 2.39.5