diff options
Diffstat (limited to 'clients/net-snk/app/main.c')
-rw-r--r-- | clients/net-snk/app/main.c | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/clients/net-snk/app/main.c b/clients/net-snk/app/main.c new file mode 100644 index 0000000..ed0a291 --- /dev/null +++ b/clients/net-snk/app/main.c @@ -0,0 +1,96 @@ +/****************************************************************************** + * Copyright (c) 2004, 2008 IBM Corporation + * All rights reserved. + * This program and the accompanying materials + * are made available under the terms of the BSD License + * which accompanies this distribution, and is available at + * http://www.opensource.org/licenses/bsd-license.php + * + * Contributors: + * IBM Corporation - initial implementation + *****************************************************************************/ + +#include <string.h> +#include <stdio.h> +#include <of.h> +#include <netapps/netapps.h> +#include <libbootmsg.h> + +#ifdef SNK_BIOSEMU_APPS +extern int biosemu(char argc, char**argv); +extern int vbe_get_info(char argc, char**argv); +#endif + +#ifdef SNK_GENMODULE_APPS +extern int forth(int, char*[]); +extern int snkshell(void); +#endif + +#ifdef SNK_LJTAG_PROCESS +extern int ljtag(char argc, char**argv); +#endif + +extern void _callback_entry(void); + +int +main(int argc, char *argv[]) +{ + int i; + of_set_callback((void *) &_callback_entry); + +#ifdef SNK_LJTAG_PROCESS + return ljtag(argc, argv); +#else + if (strcmp(argv[0], "netboot") == 0 && argc >= 5) + return netboot(argc, argv); + if (strcmp(argv[0], "netflash") == 0) + return netflash(argc, argv); + if (strcmp(argv[0], "ping") == 0) + return ping(argc, argv); +#ifdef SNK_BIOSEMU_APPS + // BIOS Emulator applications + if (strcmp(argv[0], "biosemu") == 0) + return biosemu(argc, argv); + if (strcmp(argv[0], "get_vbe_info") == 0) + return vbe_get_info(argc, argv); +#endif +#ifdef SNK_GENMODULE_APPS + if (strcmp(argv[0], "forth") == 0) + return forth(argc, argv); + if (strcmp(argv[0], "snkshell") == 0) + return snkshell(); +#endif +#endif + + printf("Unknown client application called\n"); + for (i = 0; i < argc; i++) + printf("argv[%d] %s\n", i, argv[i]); + + return -1; +} + +int +callback(int argc, char *argv[]) +{ + int i; + + printf("\n"); + + /* + * Register your application's callback handler here, similar to + * the way you would register an application. + * Please note that callback functions can be called safely only after + * your application has called of_yield(). If you return or exit() from + * your client application, the callback can no longer be used. + */ +#if 0 + if (strcmp(argv[0], "example") == 0) + return example(argc, argv); +#endif + + printf("No such callback function\n"); + for (i = 0; i < argc; i++) + printf("argv[%d] %s\n", i, argv[i]); + + return (-1); +} |