1*78f6622aSwdenk /* 2*78f6622aSwdenk * (C) Copyright 2000 3*78f6622aSwdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4*78f6622aSwdenk * 5*78f6622aSwdenk * See file CREDITS for list of people who contributed to this 6*78f6622aSwdenk * project. 7*78f6622aSwdenk * 8*78f6622aSwdenk * This program is free software; you can redistribute it and/or 9*78f6622aSwdenk * modify it under the terms of the GNU General Public License as 10*78f6622aSwdenk * published by the Free Software Foundation; either version 2 of 11*78f6622aSwdenk * the License, or (at your option) any later version. 12*78f6622aSwdenk * 13*78f6622aSwdenk * This program is distributed in the hope that it will be useful, 14*78f6622aSwdenk * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*78f6622aSwdenk * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*78f6622aSwdenk * GNU General Public License for more details. 17*78f6622aSwdenk * 18*78f6622aSwdenk * You should have received a copy of the GNU General Public License 19*78f6622aSwdenk * along with this program; if not, write to the Free Software 20*78f6622aSwdenk * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21*78f6622aSwdenk * MA 02111-1307 USA 22*78f6622aSwdenk */ 23*78f6622aSwdenk 24*78f6622aSwdenk /* 25*78f6622aSwdenk * Definitions for Command Processor 26*78f6622aSwdenk */ 27*78f6622aSwdenk #ifndef __COMMAND_H 28*78f6622aSwdenk #define __COMMAND_H 29*78f6622aSwdenk 30*78f6622aSwdenk #ifndef NULL 31*78f6622aSwdenk #define NULL 0 32*78f6622aSwdenk #endif 33*78f6622aSwdenk 34*78f6622aSwdenk #ifndef __ASSEMBLY__ 35*78f6622aSwdenk /* 36*78f6622aSwdenk * Monitor Command Table 37*78f6622aSwdenk */ 38*78f6622aSwdenk 39*78f6622aSwdenk struct cmd_tbl_s { 40*78f6622aSwdenk char *name; /* Command Name */ 41*78f6622aSwdenk int lmin; /* minimum abbreviated length */ 42*78f6622aSwdenk int maxargs; /* maximum number of arguments */ 43*78f6622aSwdenk int repeatable; /* autorepeat allowed? */ 44*78f6622aSwdenk /* Implementation function */ 45*78f6622aSwdenk int (*cmd)(struct cmd_tbl_s *, int, int, char *[]); 46*78f6622aSwdenk char *usage; /* Usage message (short) */ 47*78f6622aSwdenk #ifdef CFG_LONGHELP 48*78f6622aSwdenk char *help; /* Help message (long) */ 49*78f6622aSwdenk #endif 50*78f6622aSwdenk }; 51*78f6622aSwdenk 52*78f6622aSwdenk typedef struct cmd_tbl_s cmd_tbl_t; 53*78f6622aSwdenk 54*78f6622aSwdenk extern cmd_tbl_t cmd_tbl[]; 55*78f6622aSwdenk 56*78f6622aSwdenk #ifdef CFG_LONGHELP 57*78f6622aSwdenk #define MK_CMD_TBL_ENTRY(name,lmin,maxargs,rep,cmd,usage,help) \ 58*78f6622aSwdenk { name, lmin, maxargs, rep, cmd, usage, help } 59*78f6622aSwdenk #else /* no help info */ 60*78f6622aSwdenk #define MK_CMD_TBL_ENTRY(name,lmin,maxargs,rep,cmd,usage,help) \ 61*78f6622aSwdenk { name, lmin, maxargs, rep, cmd, usage } 62*78f6622aSwdenk #endif 63*78f6622aSwdenk 64*78f6622aSwdenk /* common/command.c */ 65*78f6622aSwdenk cmd_tbl_t *find_cmd(const char *cmd); 66*78f6622aSwdenk 67*78f6622aSwdenk /* 68*78f6622aSwdenk * Monitor Command 69*78f6622aSwdenk * 70*78f6622aSwdenk * All commands use a common argument format: 71*78f6622aSwdenk * 72*78f6622aSwdenk * void function (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); 73*78f6622aSwdenk */ 74*78f6622aSwdenk 75*78f6622aSwdenk typedef void command_t (cmd_tbl_t *, int, int, char *[]); 76*78f6622aSwdenk 77*78f6622aSwdenk #endif /* __ASSEMBLY__ */ 78*78f6622aSwdenk 79*78f6622aSwdenk /* 80*78f6622aSwdenk * Command Flags: 81*78f6622aSwdenk */ 82*78f6622aSwdenk #define CMD_FLAG_REPEAT 0x0001 /* repeat last command */ 83*78f6622aSwdenk #define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */ 84*78f6622aSwdenk 85*78f6622aSwdenk /* 86*78f6622aSwdenk * Configurable monitor commands definitions have been moved 87*78f6622aSwdenk * to include/cmd_confdefs.h 88*78f6622aSwdenk */ 89*78f6622aSwdenk 90*78f6622aSwdenk #endif /* __COMMAND_H */ 91