xref: /rk3399_rockchip-uboot/include/command.h (revision 0d4983930a3559be92452761cfa268ee9d0f2773)
178f6622aSwdenk /*
278f6622aSwdenk  * (C) Copyright 2000
378f6622aSwdenk  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
478f6622aSwdenk  *
578f6622aSwdenk  * See file CREDITS for list of people who contributed to this
678f6622aSwdenk  * project.
778f6622aSwdenk  *
878f6622aSwdenk  * This program is free software; you can redistribute it and/or
978f6622aSwdenk  * modify it under the terms of the GNU General Public License as
1078f6622aSwdenk  * published by the Free Software Foundation; either version 2 of
1178f6622aSwdenk  * the License, or (at your option) any later version.
1278f6622aSwdenk  *
1378f6622aSwdenk  * This program is distributed in the hope that it will be useful,
1478f6622aSwdenk  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1578f6622aSwdenk  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1678f6622aSwdenk  * GNU General Public License for more details.
1778f6622aSwdenk  *
1878f6622aSwdenk  * You should have received a copy of the GNU General Public License
1978f6622aSwdenk  * along with this program; if not, write to the Free Software
2078f6622aSwdenk  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2178f6622aSwdenk  * MA 02111-1307 USA
2278f6622aSwdenk  */
2378f6622aSwdenk 
2478f6622aSwdenk /*
2578f6622aSwdenk  *  Definitions for Command Processor
2678f6622aSwdenk  */
2778f6622aSwdenk #ifndef __COMMAND_H
2878f6622aSwdenk #define __COMMAND_H
2978f6622aSwdenk 
3078f6622aSwdenk #ifndef NULL
3178f6622aSwdenk #define NULL	0
3278f6622aSwdenk #endif
3378f6622aSwdenk 
3478f6622aSwdenk #ifndef	__ASSEMBLY__
3578f6622aSwdenk /*
3678f6622aSwdenk  * Monitor Command Table
3778f6622aSwdenk  */
3878f6622aSwdenk 
3978f6622aSwdenk struct cmd_tbl_s {
4078f6622aSwdenk 	char		*name;		/* Command Name			*/
4178f6622aSwdenk 	int		maxargs;	/* maximum number of arguments	*/
4278f6622aSwdenk 	int		repeatable;	/* autorepeat allowed?		*/
4378f6622aSwdenk 					/* Implementation function	*/
4478f6622aSwdenk 	int		(*cmd)(struct cmd_tbl_s *, int, int, char *[]);
4578f6622aSwdenk 	char		*usage;		/* Usage message	(short)	*/
4678f6622aSwdenk #ifdef	CFG_LONGHELP
4778f6622aSwdenk 	char		*help;		/* Help  message	(long)	*/
4878f6622aSwdenk #endif
4978f6622aSwdenk };
5078f6622aSwdenk 
5178f6622aSwdenk typedef struct cmd_tbl_s	cmd_tbl_t;
5278f6622aSwdenk 
538bde7f77Swdenk extern cmd_tbl_t  __u_boot_cmd_start;
548bde7f77Swdenk extern cmd_tbl_t  __u_boot_cmd_end;
5578f6622aSwdenk 
5678f6622aSwdenk 
5778f6622aSwdenk /* common/command.c */
5878f6622aSwdenk cmd_tbl_t *find_cmd(const char *cmd);
5978f6622aSwdenk 
6078f6622aSwdenk /*
6178f6622aSwdenk  * Monitor Command
6278f6622aSwdenk  *
6378f6622aSwdenk  * All commands use a common argument format:
6478f6622aSwdenk  *
6578f6622aSwdenk  * void function (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
6678f6622aSwdenk  */
6778f6622aSwdenk 
6878f6622aSwdenk typedef	void 	command_t (cmd_tbl_t *, int, int, char *[]);
6978f6622aSwdenk 
7078f6622aSwdenk #endif	/* __ASSEMBLY__ */
7178f6622aSwdenk 
7278f6622aSwdenk /*
7378f6622aSwdenk  * Command Flags:
7478f6622aSwdenk  */
7578f6622aSwdenk #define CMD_FLAG_REPEAT		0x0001	/* repeat last command		*/
7678f6622aSwdenk #define CMD_FLAG_BOOTD		0x0002	/* command is from bootd	*/
7778f6622aSwdenk 
7878f6622aSwdenk /*
7978f6622aSwdenk  * Configurable monitor commands definitions have been moved
8078f6622aSwdenk  * to include/cmd_confdefs.h
8178f6622aSwdenk  */
8278f6622aSwdenk 
838bde7f77Swdenk 
848bde7f77Swdenk #define Struct_Section  __attribute__ ((unused,section (".u_boot_cmd")))
858bde7f77Swdenk 
868bde7f77Swdenk #ifdef  CFG_LONGHELP
878bde7f77Swdenk 
88*0d498393Swdenk #define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \
89*0d498393Swdenk cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage, help}
908bde7f77Swdenk 
918bde7f77Swdenk #else	/* no long help info */
928bde7f77Swdenk 
93*0d498393Swdenk #define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \
94*0d498393Swdenk cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage}
958bde7f77Swdenk 
968bde7f77Swdenk #endif	/* CFG_LONGHELP */
978bde7f77Swdenk 
9878f6622aSwdenk #endif	/* __COMMAND_H */
99