3 * This routine is the initialization task for this test program.
4 * It is called from init_exec and has the responsibility for creating
5 * and starting the tasks that make up the test. If the time of day
6 * clock is required for the test, it should also be set to a known
7 * value by this function.
9 * Input parameters: NONE
11 * Output parameters: NONE
13 * COPYRIGHT (c) 1989-1999.
14 * On-Line Applications Research Corporation (OAR).
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.com/license/LICENSE.
20 * $Id: init.c,v 1.12.4.1 2003/09/04 18:46:30 joel Exp $
23 #define CONFIGURE_INIT
24 #include "rtems_shell_local_config.h"
29 #include <rtems/error.h>
30 #include <rtems/monitor.h>
31 #include <rtems/shell.h>
33 #include <rtems/rtems_bsdnet.h>
35 #include <orte_rtems_shell.h>
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
44 #define CONFIGURE_SHELL_COMMANDS_INIT
45 #define CONFIGURE_SHELL_COMMANDS_ALL
46 #define CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING
47 #define CONFIGURE_SHELL_MOUNT_MSDOS
48 #define CONFIGURE_SHELL_MOUNT_NFS
50 #include <rtems/shellconfig.h>
52 #define BUILD_VERSION_STRING(major, minor, patch) \
53 __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
56 #define VER_CODE(major, minor, patch) (major*0x10000+minor*0x100+patch)
59 #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__, __RTEMS_MINOR__, __RTEMS_REVISION__)
61 #if RTEMS_VER_CODE < VER_CODE(4, 10, 99)
62 #ifndef RTEMS_USE_LOOPBACK
63 #define RTEMS_USE_LOOPBACK 1
67 #include "networkconfig.h"
69 #if RTEMS_VER_CODE < VER_CODE(4, 7, 99)
70 #define rtems_shell_add_cmd shell_add_cmd
71 #define rtems_shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, m_forever, m_wait, m_login_check) \
72 shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, B19200 | CS8, m_forever)
73 #elif RTEMS_VER_CODE < VER_CODE(4, 9, 99)
74 #define rtems_shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, m_forever, m_wait, m_login_check) \
75 rtems_shell_init(m_task_name, m_task_stacksize, m_task_priority, m_devname, m_forever, m_wait)
79 bad_rtems_status(rtems_status_code status, int fail_level, const char *text)
81 printf("ERROR: %s status %s", text, rtems_status_text(status));
82 status = rtems_task_delete(RTEMS_SELF);
86 testcmd_forshell(int argc, char **argv)
90 printf("Command %s called\n", argv[0]);
91 for (i = 1; i < argc; i++)
93 printf("%s", argv[i]);
100 rtems_task_argument ignored
103 rtems_status_code status;
105 printf("\n\nRTEMS v "
106 BUILD_VERSION_STRING(__RTEMS_MAJOR__, __RTEMS_MINOR__, __RTEMS_REVISION__)
109 rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL);
110 /*rtems_capture_cli_init (0);*/
112 if (rtems_bsdnet_initialize_network() < 0)
113 printf("Network initialization failed\n");
115 printf("Network initialization OK\n");
118 printf("Starting shell with ORTE commands included\n");
120 rtems_shell_init("SHLL", RTEMS_MINIMUM_STACK_SIZE+0x1000,
121 SHELL_TASK_PRIORITY, "/dev/console", 1, 0, NULL);
123 rtems_shell_add_cmd("testcmd", "app",
124 "test command for shell",
127 #ifdef CONFIG_OC_ETH_ORTE_MANAGER
128 rtems_shell_add_cmd("ortemanager", "orte",
129 "start orte manager",
131 #endif /*CONFIG_OC_ETH_ORTE_MANAGER*/
133 #ifdef CONFIG_OC_ETH_ORTE_EXAMPLES
134 rtems_shell_add_cmd("orte_h_publisher", "orte",
135 "start orte_h_publisher",
136 orte_h_publisher_main);
138 rtems_shell_add_cmd("orte_h_subscriber", "orte",
139 "start orte_h_subscriber",
140 orte_h_subscriber_main);
142 rtems_shell_add_cmd("orte_m_subscriber", "orte",
143 "start orte_m_subscriber",
144 orte_m_subscriber_main);
146 rtems_shell_add_cmd("orteping", "orte",
150 rtems_shell_add_cmd("orte_spy", "orte",
154 rtems_shell_add_cmd("orte_r_publisher", "orte",
155 "start orte_r_publisher",
156 orte_r_publisher_main);
158 rtems_shell_add_cmd("orte_r_subscriber_besteffort", "orte",
159 "start orte_r_subscriber_besteffort",
160 orte_r_subscriber_besteffort_main);
162 rtems_shell_add_cmd("orte_r_subscriber_reliable", "orte",
163 "start orte_r_subscriber_reliable",
164 orte_r_subscriber_reliable_main);
165 #endif /*CONFIG_OC_ETH_ORTE_EXAMPLES*/
167 rtems_shell_add_cmd("spawn", "orte",
168 "spawn task or command in background",
171 //rtems_monitor_wakeup();
173 status = rtems_task_delete(RTEMS_SELF);
175 printf("*** END OF TEST2 ***\n");