X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-benchmark.git/blobdiff_plain/b83118bb4a39f5a8540c1f776e0af0420737afd0..55e9aedc2093997a10b00cd31842137c29b4793d:/rtems/gw/cangw/init.c diff --git a/rtems/gw/cangw/init.c b/rtems/gw/cangw/init.c index 2398a87..c8057b2 100644 --- a/rtems/gw/cangw/init.c +++ b/rtems/gw/cangw/init.c @@ -23,7 +23,7 @@ #define CONFIGURE_INIT #include #include "system.h" -#include "app_def.h" +#include "app_def.h" #include #include #include @@ -42,22 +42,14 @@ __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch) #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__) - -#if RTEMS_VER_CODE < VER_CODE(4,7,99) - #define rtems_shell_add_cmd shell_add_cmd - #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \ - shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,B19200 | CS8,m_forever) -#elif RTEMS_VER_CODE < VER_CODE(4,9,99) - #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \ - rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait) -#endif - -void bad_rtems_status(rtems_status_code status, int fail_level, const char *text){ - printf("ERROR: %s status %s", text, rtems_status_text(status)); - status = rtems_task_delete( RTEMS_SELF ); -} - - + + +#define CONFIGURE_SHELL_USER_COMMANDS &shell_command_print_can_totals +#define CONFIGURE_SHELL_COMMANDS_INIT +#define CONFIGURE_SHELL_COMMANDS_ALL + +#include +#include rtems_task Init(rtems_task_argument ignored){ @@ -68,48 +60,32 @@ rtems_task Init(rtems_task_argument ignored){ "\n"); rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL); - /*rtems_capture_cli_init (0);*/ printf( "Starting application " SW_VER_ID " v " BUILD_VERSION_STRING(SW_VER_MAJOR,SW_VER_MINOR,SW_VER_PATCH) "\n" ); + + /* Inits */ +#ifdef BENCH_BUILD + start_can(0, NULL); + start_net(0, NULL); +#ifdef LOAD_BUILD + start_load(0, NULL); +#endif +#endif + +#ifndef BENCH_BUILD + rtems_shell_init( + "SHLL", /* task name */ + RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */ + 100, /* task priority */ + "/dev/console", /* device name */ + true, /* run forever */ + false, /* wait for shell to terminate */ + NULL /* login check function, use NULL to disable a login check */ + ); +#endif - - rtems_shell_init("SHLL", RTEMS_MINIMUM_STACK_SIZE+0x1000, - SHELL_TASK_PRIORITY, "/dev/console", 1, 0, NULL); - - rtems_shell_add_cmd("startGW", "app", - "initialize can driver and startGW", - start_can); - - rtems_shell_add_cmd("stopGW", "app", - "stops GW", - end_can); - - rtems_shell_add_cmd("printvar", "app", - "prints info from vars", - print_regs); - - rtems_shell_add_cmd("printcan", "app", - "prints error rate from CANs", - print_can_totals); - - rtems_shell_add_cmd("startNET", "app", - "tries to start network adapter", - start_net); - - rtems_shell_add_cmd("showNET", "app", - "prints some diagnostic info from network adapter/driver", - show_net); - - rtems_shell_add_cmd("start_load", "app", - "starts loading threads", - start_load); - - rtems_shell_add_cmd("stop_load", "app", - "stops loading threads", - stop_load); - status = rtems_task_delete( RTEMS_SELF ); exit( 0 );