From 193dcca84ef8e4b205f085eb759bca7097ce032b Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Tue, 3 Jun 2003 12:37:16 +0000 Subject: [PATCH] 2003-06-03 Marcel Telka * src/cmd/Makefile.am (libcmd_a_SOURCES): Removed quit.c, help.c, and detectflash.c. * src/cmd/cmd.c (cmd_run, cmd_params, cmd_get_number): Functions moved to module libbrux, file cmd/cmd.c. * src/cmd/detectflash.c: File moved to module libbrux, directory cmd. * src/cmd/help.c: Ditto. * src/cmd/quit.c: Ditto. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@466 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 9 +++++ jtag/src/cmd/Makefile.am | 3 -- jtag/src/cmd/cmd.c | 52 ------------------------- jtag/src/cmd/detectflash.c | 63 ------------------------------ jtag/src/cmd/help.c | 79 -------------------------------------- jtag/src/cmd/quit.c | 54 -------------------------- 6 files changed, 9 insertions(+), 251 deletions(-) delete mode 100644 jtag/src/cmd/detectflash.c delete mode 100644 jtag/src/cmd/help.c delete mode 100644 jtag/src/cmd/quit.c diff --git a/jtag/ChangeLog b/jtag/ChangeLog index d77f42b1..68bffd1b 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,12 @@ +2003-06-03 Marcel Telka + + * src/cmd/Makefile.am (libcmd_a_SOURCES): Removed quit.c, help.c, and detectflash.c. + * src/cmd/cmd.c (cmd_run, cmd_params, cmd_get_number): Functions moved to module libbrux, + file cmd/cmd.c. + * src/cmd/detectflash.c: File moved to module libbrux, directory cmd. + * src/cmd/help.c: Ditto. + * src/cmd/quit.c: Ditto. + 2003-06-03 Marcel Telka * include/Makefile.am (noinst_HEADERS): Added cmd.h. diff --git a/jtag/src/cmd/Makefile.am b/jtag/src/cmd/Makefile.am index 875205f4..2568c7ea 100644 --- a/jtag/src/cmd/Makefile.am +++ b/jtag/src/cmd/Makefile.am @@ -26,8 +26,6 @@ include $(top_srcdir)/Makefile.rules noinst_LIBRARIES = libcmd.a libcmd_a_SOURCES = \ - quit.c \ - help.c \ frequency.c \ cable.c \ discovery.c \ @@ -41,7 +39,6 @@ libcmd_a_SOURCES = \ endian.c \ peekpoke.c \ readmem.c \ - detectflash.c \ flashmem.c \ script.c \ cmd.c diff --git a/jtag/src/cmd/cmd.c b/jtag/src/cmd/cmd.c index d37a8b3c..5509b445 100644 --- a/jtag/src/cmd/cmd.c +++ b/jtag/src/cmd/cmd.c @@ -74,58 +74,6 @@ const cmd_t *cmds[] = { NULL /* last must be NULL */ }; -int -cmd_run( char *params[] ) -{ - int i; - - if (!params[0]) - return 1; - - for (i = 0; cmds[i]; i++) - if (strcmp( cmds[i]->name, params[0] ) == 0) { - int r = cmds[i]->run( params ); - if (r < 0) - printf( _("%s: syntax error!\n"), params[0] ); - return r; - } - - printf( _("%s: unknown command\n"), params[0] ); - return 1; -} - -int -cmd_params( char *params[] ) -{ - int i = 0; - - while (params[i]) - i++; - - return i; -} - -int -cmd_get_number( char *s, unsigned int *i ) -{ - int n; - int r; - int l; - - if (!s || !i) - return -1; - - l = strlen( s ); - r = sscanf( s, "0x%x%n", i, &n); - if (r == 1 && n == l) - return 0; - r = sscanf( s, "%u%n", i, &n ); - if (r == 1 && n == l) - return 0; - - return -1; -} - int cmd_test_cable( void ) { diff --git a/jtag/src/cmd/detectflash.c b/jtag/src/cmd/detectflash.c deleted file mode 100644 index 4ea98838..00000000 --- a/jtag/src/cmd/detectflash.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003 ETC s.r.o. - * - * 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. - * - * Written by Marcel Telka , 2003. - * - */ - -#include - -#include - -#include - -#include "cmd.h" - -static int -cmd_detectflash_run( char *params[] ) -{ - if (cmd_params( params ) != 1) - return -1; - - if (!bus) { - printf( _("Error: Bus driver missing.\n") ); - return 1; - } - - detectflash( bus ); - - return 1; -} - -static void -cmd_detectflash_help( void ) -{ - printf( _( - "Usage: %s\n" - "Detect flash memory type connected to a part.\n" - ), "detectflash" ); -} - -cmd_t cmd_detectflash = { - "detectflash", - N_("detect parameters of flash chips attached to a part"), - cmd_detectflash_help, - cmd_detectflash_run -}; diff --git a/jtag/src/cmd/help.c b/jtag/src/cmd/help.c deleted file mode 100644 index a6e03e4d..00000000 --- a/jtag/src/cmd/help.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003 ETC s.r.o. - * - * 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. - * - * Written by Marcel Telka , 2003. - * - */ - -#include - -#include -#include - -#include "cmd.h" - -extern cmd_t *cmds[]; - -static int -cmd_help_run( char *params[] ) -{ - int i; - - /* short description generation */ - if (!params[1]) { - int i; - printf( _("Command list:\n\n") ); - for (i = 0; cmds[i]; i++) - printf( _("%-13s %s\n"), cmds[i]->name, cmds[i]->desc ? _(cmds[i]->desc) : _("(no description available)") ); - printf( _("\nType \"help COMMAND\" for details about particular command.\n") ); - return 1; - } - - if (params[2]) - return -1; - - /* search and print help for particular command */ - for (i = 0; cmds[i]; i++) - if (strcmp( cmds[i]->name, params[1] ) == 0) { - if (cmds[i]->help) - cmds[i]->help(); - return 1; - } - - printf( _("%s: unknown command\n"), params[1] ); - - return 1; -} - -static void -cmd_help_help( void ) -{ - printf( _( - "Usage: %s [COMMAND]\n" - "Print short help for COMMAND, or list of available commands.\n" - ), "help" ); -} - -cmd_t cmd_help = { - "help", - N_("display this help"), - cmd_help_help, - cmd_help_run -}; diff --git a/jtag/src/cmd/quit.c b/jtag/src/cmd/quit.c deleted file mode 100644 index 9b4084b2..00000000 --- a/jtag/src/cmd/quit.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003 ETC s.r.o. - * - * 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. - * - * Written by Marcel Telka , 2003. - * - */ - -#include - -#include - -#include "cmd.h" - -static int -cmd_quit_run( char *params[] ) -{ - if (params[1]) - return -1; - - return 0; -} - -static void -cmd_quit_help( void ) -{ - printf( _( - "Usage: %s\n" - "Exit from %s.\n" - ), "quit", PACKAGE ); -} - -cmd_t cmd_quit = { - "quit", - N_("exit from jtag"), - cmd_quit_help, - cmd_quit_run -};