]> rtime.felk.cvut.cz Git - can-benchmark.git/blob - rtems/gw/cangw/init.c
Adds conditional compilation for benchmarking and shell initialization cleanup.
[can-benchmark.git] / rtems / gw / cangw / init.c
1 /*  Init
2  *
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.
8  *
9  *  Input parameters:  NONE
10  *
11  *  Output parameters:  NONE
12  *
13  *  COPYRIGHT (c) 1989-1999.
14  *  On-Line Applications Research Corporation (OAR).
15  *
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.
19  *
20  *  $Id: init.c,v 1.12.4.1 2003/09/04 18:46:30 joel Exp $
21  */
22
23 #define CONFIGURE_INIT
24 #include <system_def.h>
25 #include "system.h"
26 #include "app_def.h"\r
27 #include <unistd.h>
28 #include <fcntl.h>
29 #include <stdio.h>
30 #include <errno.h>
31 #include <stdlib.h>
32 #include <rtems/error.h>
33 #include <rtems/monitor.h>
34 #include <rtems/shell.h>
35
36 #include <bsp/mscan.h>
37 #include <bsp/mscan-base.h>
38
39 #include "helpers.h"
40
41 #define BUILD_VERSION_STRING(major,minor,patch) \
42         __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
43
44 #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
45 \r
46 \r
47 #define CONFIGURE_SHELL_USER_COMMANDS &shell_command_print_can_totals\r
48 #define CONFIGURE_SHELL_COMMANDS_INIT\r
49 #define CONFIGURE_SHELL_COMMANDS_ALL\r
50 \r
51 #include <rtems/shellconfig.h>\r
52 #include <rtems/shell.h>\r
53 \r
54
55 rtems_task Init(rtems_task_argument ignored){
56     rtems_status_code status;
57     
58     printf( "\n\nRTEMS v "
59             BUILD_VERSION_STRING(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
60         "\n");
61     
62     rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL);
63     
64     printf( "Starting application " SW_VER_ID " v "
65             BUILD_VERSION_STRING(SW_VER_MAJOR,SW_VER_MINOR,SW_VER_PATCH)
66         "\n" );
67 \r
68     /* Inits */\r
69 #ifdef BENCH_BUILD\r
70     start_can(0, NULL);\r
71     start_net(0, NULL);\r
72 #ifdef LOAD_BUILD\r
73     start_load(0, NULL);\r
74 #endif\r
75 #endif\r
76 \r
77 #ifndef BENCH_BUILD        \r
78     rtems_shell_init(\r
79         "SHLL", /* task name */\r
80         RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */\r
81         100, /* task priority */\r
82         "/dev/console", /* device name */\r
83         true, /* run forever */\r
84         false, /* wait for shell to terminate */\r
85         NULL /* login check function, use NULL to disable a login check */\r
86     );  \r
87 #endif    \r
88     \r
89     status = rtems_task_delete( RTEMS_SELF );
90     
91     exit( 0 );
92 }