]> rtime.felk.cvut.cz Git - can-benchmark.git/blob - rtems/gw/cangw/init.c
Change the cron script (btw. we are now triggered by systemd timers)
[can-benchmark.git] / rtems / gw / cangw / init.c
1 #define CONFIGURE_INIT
2 #include <system_def.h>
3 #include "system.h"
4 #include "app_def.h"
5 #include <unistd.h>
6 #include <fcntl.h>
7 #include <stdio.h>
8 #include <errno.h>
9 #include <stdlib.h>
10 #include <rtems/error.h>
11 #include <rtems/monitor.h>
12 #include <rtems/shell.h>
13
14 #include <bsp/mscan.h>
15 #include <bsp/mscan-base.h>
16
17 #include "helpers.h"
18
19 #define BUILD_VERSION_STRING(major,minor,patch) \
20         __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
21
22 #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
23
24
25 #define CONFIGURE_SHELL_USER_COMMANDS &shell_command_print_can_totals
26 #define CONFIGURE_SHELL_COMMANDS_INIT
27 #define CONFIGURE_SHELL_COMMANDS_ALL
28
29 #include <rtems/shellconfig.h>
30 #include <rtems/shell.h>
31
32
33 rtems_task Init(rtems_task_argument ignored){
34     rtems_status_code status;
35     
36     printf( "\n\nRTEMS v "
37             BUILD_VERSION_STRING(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
38         "\n");
39     
40     rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL);
41     
42     printf( "Starting application " SW_VER_ID " v "
43             BUILD_VERSION_STRING(SW_VER_MAJOR,SW_VER_MINOR,SW_VER_PATCH)
44         "\n" );
45
46     /* Inits */
47 #ifdef BENCH_BUILD
48     start_can(0, NULL);
49     start_net(0, NULL);
50 #ifdef LOAD_BUILD
51     start_load(0, NULL);
52 #endif
53 #endif
54
55 #ifndef BENCH_BUILD        
56     rtems_shell_init(
57         "SHLL", /* task name */
58         RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */
59         100, /* task priority */
60         "/dev/console", /* device name */
61         true, /* run forever */
62         false, /* wait for shell to terminate */
63         NULL /* login check function, use NULL to disable a login check */
64     );  
65 #endif    
66     
67     status = rtems_task_delete( RTEMS_SELF );
68     
69     exit( 0 );
70 }