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 <system_def.h>
29 #include <rtems/error.h>
30 #include <rtems/monitor.h>
31 #include <rtems/shell.h>
33 #define BUILD_VERSION_STRING(major,minor,patch) \
34 __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
36 #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
38 #if RTEMS_VER_CODE < VER_CODE(4,7,99)
39 #define rtems_shell_add_cmd shell_add_cmd
40 #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
41 shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,shell_init,m_forever)
42 #elif RTEMS_VER_CODE < VER_CODE(4,9,99)
43 #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
44 rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait)
48 bad_rtems_status(rtems_status_code status, int fail_level, const char *text)
50 printf("ERROR: %s status %s", text, rtems_status_text(status));
51 status = rtems_task_delete( RTEMS_SELF );
54 int testcmd_forshell(int argc, char **argv)
57 printf("Command %s called\n",argv[0]);
66 rtems_task_argument ignored
69 rtems_status_code status;
71 printf( "\n\nRTEMS v "
72 BUILD_VERSION_STRING(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
75 rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL);
76 /*rtems_capture_cli_init (0);*/
78 printf( "Starting application " SW_VER_ID " v "
79 BUILD_VERSION_STRING(SW_VER_MAJOR,SW_VER_MINOR,SW_VER_PATCH)
82 Task_1_name = rtems_build_name( 'T', 'S', 'K', '1' );
84 status = rtems_task_create(
87 RTEMS_MINIMUM_STACK_SIZE+0x10000,
88 RTEMS_DEFAULT_MODES /*& ~(RTEMS_TIMESLICE_MASK) | RTEMS_TIMESLICE*/,
89 RTEMS_DEFAULT_ATTRIBUTES,
92 check_rtems_status(status, 0, "rtems_task_create of Task_1");
94 status = rtems_task_start( Task_1_id, Task_1, 0 );
95 check_rtems_status(status, 0, "rtems_task_start of Task_1\n");
97 rtems_shell_init("SHLL",RTEMS_MINIMUM_STACK_SIZE+0x1000,
98 SHELL_TASK_PRIORITY,"/dev/console",1,0, NULL);
100 rtems_shell_add_cmd("testcmd", "app",
101 "test command for shell",
104 //rtems_monitor_wakeup();
106 status = rtems_task_delete( RTEMS_SELF );
108 printf( "*** END OF TEST2 ***\n" );