bin_PROGRAMS = cangw
-\r
-#I am not entirely sure these two are needed, but according to documentation, they are.\r
-CFLAGS_LD += HeapSize=0x80000\r
-MANAGERS = io event semaphore\r
+
+#I am not entirely sure these two are needed, but according to documentation, they are.
+CFLAGS_LD += HeapSize=0x80000
+MANAGERS = io event semaphore
cangw_SOURCES += init.c gw.c helpers.c
-\r
-lib_LOADLIBES += load\r
-\r
-#lib_LIBRARIES\r
-#include_HEADERS\r
+
+lib_LOADLIBES += load
-#include <system_def.h>\r
-#include "app_def.h"\r
-#include "system.h"\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <rtems/untar.h>\r
-#include <rtems/error.h>\r
-#include <rtems/mw_uid.h>\r
-#include <unistd.h>\r
-#include <fcntl.h>\r
-#include <errno.h>\r
-\r
-#include <bsp/mscan.h>\r
-#include <bsp/mscan-base.h>\r
-#include <pthread.h>\r
-\r
-#include "gw.h"\r
-\r
-/* Local defines. */\r
-#define CAN_GW_A_TO_B_MODE 1\r
-#define CAN_GW_B_TO_A_MODE 2\r
-#define CAN_GW_BAUDRATE 1000000\r
-#define CAN_GW_TASK_HIGH_PRIO 250 /* POSIX API actually has priorities the "right way around" that is, higher is indeed more important */\r
-\r
-/* counters for informational purposes */\r
-unsigned long int total_1 = 0, total_2 = 0;\r
-unsigned long int succ_1 = 0, succ_2 = 0; \r
-unsigned long int err_1 = 0, err_2 = 0;\r
-\r
-/* Pthread handles for the GW */\r
-static pthread_t CAN_A_to_B_thread, CAN_B_to_A_thread;\r
-/* Dummy FDs for setting baudrate */\r
-static int fd1, fd2;\r
-\r
-/* Prototypes for local functions. */\r
-static void* CAN_GW_thread(void* arg);\r
-static void fd_closer(void* arg);\r
-static int start_tasks();\r
-static int end_tasks();\r
-static int set_baudrate(int baudrate, int* fd1, int* fd2);\r
-\r
-/*\r
-* Simple cleanup handler for GW threads. Closes opened FD.\r
-*/\r
-static void fd_closer(void* arg){\r
- close( (*(int*)arg) );\r
-}\r
-\r
-\r
-\r
-/*\r
-* This function implements the main thread loop and enough decision logic so that it knows which device to take messages from and which device to send the messages to.\r
-* \r
-*/\r
-static void* CAN_GW_thread(void* arg){\r
- int fd_in, fd_out;\r
- int res;\r
-#ifndef BENCH_BUILD\r
- unsigned long int *total = NULL, *succ = NULL, *err = NULL; /* Makes compiler shut up about warnings. */\r
-#endif\r
- \r
- struct can_message canmsg;\r
- struct mscan_rx_parms rxparms;\r
- struct mscan_tx_parms txparms;\r
- memset(&canmsg, 0, sizeof(canmsg));\r
- memset(&rxparms, 0, sizeof(rxparms));\r
- memset(&txparms, 0, sizeof(txparms));\r
-\r
- /* These remain constant during the loop. */\r
- rxparms.rx_mess = &canmsg;\r
- rxparms.rx_timeout = rtems_clock_get_ticks_per_second(); /* 1s timeout */\r
- txparms.tx_mess = &canmsg;\r
- \r
- \r
- /* Decide in which direction this task should work. */\r
- if (((int)arg) == CAN_GW_A_TO_B_MODE){\r
- fd_in = open(MSCAN_A_DEV_NAME, O_RDWR);\r
- fd_out = open(MSCAN_B_DEV_NAME, O_RDWR);\r
- } else if (((int)arg) == CAN_GW_B_TO_A_MODE){\r
- fd_in = open(MSCAN_B_DEV_NAME, O_RDWR);\r
- fd_out = open(MSCAN_A_DEV_NAME, O_RDWR);\r
- } else {\r
- /* Invalid argument, terminate self. */\r
- return NULL;\r
- }\r
-\r
-#ifndef BENCH_BUILD /* Overhead decrease for benching builds.*/\r
- if (((int)arg) == CAN_GW_A_TO_B_MODE){\r
- total = &total_1;\r
- succ = &succ_1;\r
- err = &err_1;\r
- } else {\r
- total = &total_2;\r
- succ = &succ_2;\r
- err = &err_2;\r
- }\r
-#endif\r
- \r
- /* CANs are set to proper baudrate outside of these task due to potential race condition. */\r
-\r
- \r
- /* Prepare cleanup for both opened FDs. */\r
- pthread_cleanup_push(fd_closer, (void*)&fd_in);\r
- pthread_cleanup_push(fd_closer, (void*)&fd_out);\r
-\r
- while (true){\r
- /* RTEMS doesn't implement cancellation point inside read(), violating the API's contract. Luckily, pthread_testcancel() works. */\r
- pthread_testcancel();\r
- res = read(fd_in, &rxparms, sizeof(rxparms));\r
- if (res < 0){\r
- /* Read error, doesn't really do anything. (Currently) */\r
- } else {\r
- /* Message was read, now we should resend it. */\r
- txparms.tx_idx = canmsg.mess_id;\r
- res = write(fd_out, &txparms, sizeof(txparms));\r
- if (res < 0) {\r
-#ifndef BENCH_BUILD /* This is the simplest way to remove all the counting */\r
- /* Retry? Decide later. */\r
- (*err)++;\r
- } else {\r
- (*succ)++;\r
- }\r
- (*total)++;\r
-#else\r
- } /* Turns it into empty loop. */\r
-#endif\r
-\r
- }\r
- }\r
- return NULL;\r
-}\r
-\r
-\r
-static int start_tasks(){\r
- int res;\r
-\r
- \r
- pthread_attr_t attributes;\r
- struct sched_param parm; \r
- parm.sched_priority = CAN_GW_TASK_HIGH_PRIO;\r
- pthread_attr_init(&attributes);\r
-#ifdef HIGH_PRIO /* Without setting PTHREAD_EXPLICIT_SCHED, thread is created with parameters inherited from this thread. */\r
- res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED);\r
-#endif\r
- pthread_attr_setschedparam(&attributes, &parm);\r
-\r
- res = pthread_create(&CAN_A_to_B_thread, &attributes, CAN_GW_thread, (void*)CAN_GW_A_TO_B_MODE);\r
- if (res != 0){\r
- /* No cleanup is needed here. */\r
- return 1;\r
- }\r
-\r
- res = pthread_create(&CAN_B_to_A_thread, &attributes, CAN_GW_thread, (void*)CAN_GW_B_TO_A_MODE);\r
- if (res != 0){\r
- /* First thread needs to be aborted before return. */\r
- pthread_cancel(CAN_A_to_B_thread);\r
- return 1;\r
- }\r
- \r
- pthread_attr_destroy(&attributes);\r
- \r
- /* detach is needed so that the threads call clean up handlers automatically. */\r
- pthread_detach(CAN_B_to_A_thread);\r
- pthread_detach(CAN_A_to_B_thread);\r
-\r
- /* Threads are started and running at this point. */\r
- return 0;\r
-}\r
-\r
-/*\r
-* This function starts the GW.\r
-*\r
-* It opens two dummy file descriptors to set CAN baudrate (avoiding need of synchronized thread start), starts the forwarding threads.\r
-*\r
-* Currently has only simple error handling. \r
-*/\r
-int start_GW(){\r
- /* Baudrate is set for dummy FD, it should be remembered by the device. */\r
- int res;\r
- res = set_baudrate(CAN_GW_BAUDRATE, &fd1, &fd2);\r
- printf("Baudrate set.\n");\r
- if (res == 0){\r
- res = start_tasks();\r
- printf("tasks started\n");\r
- }\r
- return res;\r
-}\r
-\r
-\r
-/*\r
-* This function stops threads implementing GW's forwarding. It tries to stop the threads "politely" via pthread_cancel.\r
-*\r
-* Error handling is not yet implemented, so it always returns 0 (success).\r
-*/\r
-static int end_tasks(){\r
- int res;\r
- printf("Attempting to stop thread 1\n");\r
- res = pthread_cancel(CAN_A_to_B_thread);\r
- if (res != 0){\r
- printf("Failed.\n");\r
- /* Not sure what to do with error here, will have to figure out later. */\r
- }\r
- printf("Attempting to stop thread 2\n");\r
- res = pthread_cancel(CAN_B_to_A_thread);\r
- if (res != 0){\r
- printf("Failed.\n");\r
- /* Not sure what to do with error here, will have to figure out later. */\r
- }\r
- sleep(1);\r
- printf("Both threads should now be stopped.\n");\r
- return 0;\r
-}\r
-\r
-\r
-/*\r
-* Sets baudrate to the devices via dummy fd.\r
-*/\r
-static int set_baudrate(int baudrate, int* fd1, int* fd2){\r
- int fd, res;\r
- struct mscan_ctrl_parms ctrl_parms;\r
- memset(&ctrl_parms, 0, sizeof(ctrl_parms));\r
- ctrl_parms.ctrl_can_bitrate = baudrate;\r
-\r
- printf("Attempting to set bitrate %"PRIu32" for fd.\n", ctrl_parms.ctrl_can_bitrate);\r
- \r
- fd = open(MSCAN_A_DEV_NAME, O_RDWR);\r
- if (fd < 0){\r
- return 1;\r
- }\r
- res = ioctl(fd, MSCAN_SET_BAUDRATE, &ctrl_parms);\r
- if (res < 0) {\r
- printf("fd - MSCAN_SET_BAUDRATE error (%x:%x) %s\n", res, errno, strerror(errno));\r
- return 1;\r
- }\r
- (*fd1) = fd;\r
-\r
- fd = open(MSCAN_B_DEV_NAME, O_RDWR);\r
- if (fd < 0){\r
- /* Needs to cleanup by closing first fd. */\r
- close( (*fd1) );\r
- return 1;\r
- }\r
- res = ioctl(fd, MSCAN_SET_BAUDRATE, &ctrl_parms);\r
- if (res < 0) {\r
- printf("fd - MSCAN_SET_BAUDRATE error (%x:%x) %s\n", res, errno, strerror(errno));\r
- return 1;\r
- }\r
- \r
- (*fd2) = fd;\r
- \r
- return 0;\r
-}\r
-\r
-/*\r
-* Wrapper function and entry point for stopping the GW.\r
-*/\r
-int end_GW(){\r
- return end_tasks();\r
- /* Clean up of dummy FDs. */\r
- close(fd1);\r
- close(fd2);\r
-\r
+#include <system_def.h>
+#include "app_def.h"
+#include "system.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rtems/untar.h>
+#include <rtems/error.h>
+#include <rtems/mw_uid.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <bsp/mscan.h>
+#include <bsp/mscan-base.h>
+#include <pthread.h>
+
+#include "gw.h"
+
+/* Local defines. */
+#define CAN_GW_A_TO_B_MODE 1
+#define CAN_GW_B_TO_A_MODE 2
+#define CAN_GW_BAUDRATE 1000000
+#define CAN_GW_TASK_HIGH_PRIO 250 /* POSIX API actually has priorities the "right way around" that is, higher is indeed more important */
+
+/* counters for informational purposes */
+unsigned long int total_1 = 0, total_2 = 0;
+unsigned long int succ_1 = 0, succ_2 = 0;
+unsigned long int err_1 = 0, err_2 = 0;
+
+/* Pthread handles for the GW */
+static pthread_t CAN_A_to_B_thread, CAN_B_to_A_thread;
+/* Dummy FDs for setting baudrate */
+static int fd1, fd2;
+
+/* Prototypes for local functions. */
+static void* CAN_GW_thread(void* arg);
+static void fd_closer(void* arg);
+static int start_tasks();
+static int end_tasks();
+static int set_baudrate(int baudrate, int* fd1, int* fd2);
+
+/*
+* Simple cleanup handler for GW threads. Closes opened FD.
+*/
+static void fd_closer(void* arg){
+ close( (*(int*)arg) );
+}
+
+
+
+/*
+* This function implements the main thread loop and enough decision logic so that it knows which device to take messages from and which device to send the messages to.
+*
+*/
+static void* CAN_GW_thread(void* arg){
+ int fd_in, fd_out;
+ int res;
+#ifndef BENCH_BUILD
+ unsigned long int *total = NULL, *succ = NULL, *err = NULL; /* Makes compiler shut up about warnings. */
+#endif
+
+ struct can_message canmsg;
+ struct mscan_rx_parms rxparms;
+ struct mscan_tx_parms txparms;
+ memset(&canmsg, 0, sizeof(canmsg));
+ memset(&rxparms, 0, sizeof(rxparms));
+ memset(&txparms, 0, sizeof(txparms));
+
+ /* These remain constant during the loop. */
+ rxparms.rx_mess = &canmsg;
+ rxparms.rx_timeout = rtems_clock_get_ticks_per_second(); /* 1s timeout */
+ txparms.tx_mess = &canmsg;
+
+
+ /* Decide in which direction this task should work. */
+ if (((int)arg) == CAN_GW_A_TO_B_MODE){
+ fd_in = open(MSCAN_A_DEV_NAME, O_RDWR);
+ fd_out = open(MSCAN_B_DEV_NAME, O_RDWR);
+ } else if (((int)arg) == CAN_GW_B_TO_A_MODE){
+ fd_in = open(MSCAN_B_DEV_NAME, O_RDWR);
+ fd_out = open(MSCAN_A_DEV_NAME, O_RDWR);
+ } else {
+ /* Invalid argument, terminate self. */
+ return NULL;
+ }
+
+#ifndef BENCH_BUILD /* Overhead decrease for benching builds.*/
+ if (((int)arg) == CAN_GW_A_TO_B_MODE){
+ total = &total_1;
+ succ = &succ_1;
+ err = &err_1;
+ } else {
+ total = &total_2;
+ succ = &succ_2;
+ err = &err_2;
+ }
+#endif
+
+ /* CANs are set to proper baudrate outside of these task due to potential race condition. */
+
+
+ /* Prepare cleanup for both opened FDs. */
+ pthread_cleanup_push(fd_closer, (void*)&fd_in);
+ pthread_cleanup_push(fd_closer, (void*)&fd_out);
+
+ while (true){
+ /* RTEMS doesn't implement cancellation point inside read(), violating the API's contract. Luckily, pthread_testcancel() works. */
+ pthread_testcancel();
+ res = read(fd_in, &rxparms, sizeof(rxparms));
+ if (res < 0){
+ /* Read error, doesn't really do anything. (Currently) */
+ } else {
+ /* Message was read, now we should resend it. */
+ txparms.tx_idx = canmsg.mess_id;
+ res = write(fd_out, &txparms, sizeof(txparms));
+ if (res < 0) {
+#ifndef BENCH_BUILD /* This is the simplest way to remove all the counting */
+ /* Retry? Decide later. */
+ (*err)++;
+ } else {
+ (*succ)++;
+ }
+ (*total)++;
+#else
+ } /* Turns it into empty loop. */
+#endif
+
+ }
+ }
+ return NULL;
+}
+
+
+static int start_tasks(){
+ int res;
+
+
+ pthread_attr_t attributes;
+ struct sched_param parm;
+ parm.sched_priority = CAN_GW_TASK_HIGH_PRIO;
+ pthread_attr_init(&attributes);
+#ifdef HIGH_PRIO /* Without setting PTHREAD_EXPLICIT_SCHED, thread is created with parameters inherited from this thread. */
+ res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED);
+#endif
+ pthread_attr_setschedparam(&attributes, &parm);
+
+ res = pthread_create(&CAN_A_to_B_thread, &attributes, CAN_GW_thread, (void*)CAN_GW_A_TO_B_MODE);
+ if (res != 0){
+ /* No cleanup is needed here. */
+ return 1;
+ }
+
+ res = pthread_create(&CAN_B_to_A_thread, &attributes, CAN_GW_thread, (void*)CAN_GW_B_TO_A_MODE);
+ if (res != 0){
+ /* First thread needs to be aborted before return. */
+ pthread_cancel(CAN_A_to_B_thread);
+ return 1;
+ }
+
+ pthread_attr_destroy(&attributes);
+
+ /* detach is needed so that the threads call clean up handlers automatically. */
+ pthread_detach(CAN_B_to_A_thread);
+ pthread_detach(CAN_A_to_B_thread);
+
+ /* Threads are started and running at this point. */
+ return 0;
+}
+
+/*
+* This function starts the GW.
+*
+* It opens two dummy file descriptors to set CAN baudrate (avoiding need of synchronized thread start), starts the forwarding threads.
+*
+* Currently has only simple error handling.
+*/
+int start_GW(){
+ /* Baudrate is set for dummy FD, it should be remembered by the device. */
+ int res;
+ res = set_baudrate(CAN_GW_BAUDRATE, &fd1, &fd2);
+ printf("Baudrate set.\n");
+ if (res == 0){
+ res = start_tasks();
+ printf("tasks started\n");
+ }
+ return res;
+}
+
+
+/*
+* This function stops threads implementing GW's forwarding. It tries to stop the threads "politely" via pthread_cancel.
+*
+* Error handling is not yet implemented, so it always returns 0 (success).
+*/
+static int end_tasks(){
+ int res;
+ printf("Attempting to stop thread 1\n");
+ res = pthread_cancel(CAN_A_to_B_thread);
+ if (res != 0){
+ printf("Failed.\n");
+ /* Not sure what to do with error here, will have to figure out later. */
+ }
+ printf("Attempting to stop thread 2\n");
+ res = pthread_cancel(CAN_B_to_A_thread);
+ if (res != 0){
+ printf("Failed.\n");
+ /* Not sure what to do with error here, will have to figure out later. */
+ }
+ sleep(1);
+ printf("Both threads should now be stopped.\n");
+ return 0;
+}
+
+
+/*
+* Sets baudrate to the devices via dummy fd.
+*/
+static int set_baudrate(int baudrate, int* fd1, int* fd2){
+ int fd, res;
+ struct mscan_ctrl_parms ctrl_parms;
+ memset(&ctrl_parms, 0, sizeof(ctrl_parms));
+ ctrl_parms.ctrl_can_bitrate = baudrate;
+
+ printf("Attempting to set bitrate %"PRIu32" for fd.\n", ctrl_parms.ctrl_can_bitrate);
+
+ fd = open(MSCAN_A_DEV_NAME, O_RDWR);
+ if (fd < 0){
+ return 1;
+ }
+ res = ioctl(fd, MSCAN_SET_BAUDRATE, &ctrl_parms);
+ if (res < 0) {
+ printf("fd - MSCAN_SET_BAUDRATE error (%x:%x) %s\n", res, errno, strerror(errno));
+ return 1;
+ }
+ (*fd1) = fd;
+
+ fd = open(MSCAN_B_DEV_NAME, O_RDWR);
+ if (fd < 0){
+ /* Needs to cleanup by closing first fd. */
+ close( (*fd1) );
+ return 1;
+ }
+ res = ioctl(fd, MSCAN_SET_BAUDRATE, &ctrl_parms);
+ if (res < 0) {
+ printf("fd - MSCAN_SET_BAUDRATE error (%x:%x) %s\n", res, errno, strerror(errno));
+ return 1;
+ }
+
+ (*fd2) = fd;
+
+ return 0;
+}
+
+/*
+* Wrapper function and entry point for stopping the GW.
+*/
+int end_GW(){
+ return end_tasks();
+ /* Clean up of dummy FDs. */
+ close(fd1);
+ close(fd2);
+
}
\ No newline at end of file
-#ifndef __GW_H_\r
-#define __GW_H_\r
-\r
-extern unsigned long int total_1, total_2, succ_1, succ_2, err_1, err_2;\r
-\r
-int start_GW();\r
-int end_GW();\r
-\r
+#ifndef __GW_H_
+#define __GW_H_
+
+extern unsigned long int total_1, total_2, succ_1, succ_2, err_1, err_2;
+
+int start_GW();
+int end_GW();
+
#endif
\ No newline at end of file
-#include <system_def.h>\r
-#include <unistd.h>\r
-#include <fcntl.h>\r
-#include <stdio.h>\r
-#include <errno.h>\r
-#include <stdlib.h>\r
-#include <rtems/error.h>\r
-#include <rtems/monitor.h>\r
-#include <rtems/shell.h>\r
-\r
-#include <bsp/mscan.h>\r
-#include <bsp/mscan-base.h>\r
-\r
-#include "helpers.h"\r
-#include "gw.h"\r
-#include "load.h"\r
-\r
-#include <rtems/rtems_bsdnet.h>\r
-#include "networkconfig.h" \r
-\r
-\r
-static rtems_device_major_number mscan_major;\r
-static rtems_driver_address_table mscan_driver_table=MSCAN_DRIVER_TABLE_ENTRY;\r
-\r
-/*\r
-* Prints can stats. (Used in debugging)\r
-*/\r
-int print_can_totals(int argc, char** argv){\r
- printf("Total 1: %"PRIu32", Total 2: %"PRIu32"\n", total_1, total_2);\r
- printf("Success 1: %"PRIu32", Success 2: %"PRIu32"\n", succ_1, succ_2);\r
- printf("Errors 1: %"PRIu32", Errors 2: %"PRIu32"\n", err_1, err_2);\r
- return 0;\r
-}\r
-\r
-/*\r
-* Prints clocks as given by the uboot. (Used in debugging)\r
-*/\r
-int print_clocks(int argc, char** argv){\r
- printf("IPB_CLOCK: %lu\n", bsp_uboot_board_info.bi_ipbfreq);\r
- printf("XLB_CLOCK: %lu\n", bsp_uboot_board_info.bi_busfreq);\r
- printf("G2_CLOCK: %lu\n", bsp_uboot_board_info.bi_intfreq);\r
- printf("BAUD: %lu\n", bsp_uboot_board_info.bi_baudrate);\r
- return 0;\r
-}\r
-\r
-/*\r
-* Single function to prepare CAN devices for read/write operation.\r
-*\r
-* Sets up baud rate at 1M, opens fda and fdb and checks for errors.\r
-*/\r
-static int init_CAN(){\r
- rtems_status_code status;\r
- \r
- printf("Initializing CAN bus.\n");\r
- \r
- printf("Changing gpiopcr setting...\n"); \r
- //Clear PCR_CHIP_SELECT bits and sets them to ALT_CAN.\r
- mpc5200.gpiopcr = (mpc5200.gpiopcr & (~GPIO_PCR_CHIP_SELECT_1)) | GPIO_PCR_CHIP_ALTS_CAN;\r
-\r
- printf("Registering CAN drivers...\n");\r
- status = rtems_io_register_driver(0, &mscan_driver_table, &mscan_major);\r
- if (status != RTEMS_SUCCESSFUL){\r
- printf("caninit: rtems_io_register_driver %s\n",rtems_status_text(status));\r
- return 1;\r
- }\r
- \r
- return 0;\r
-}\r
-\r
-int start_can(int argc, char** argv){\r
- int res;\r
- static char inited = 0;\r
- if (!inited){\r
- res = init_CAN();\r
- inited = 1;\r
- if (res != 0){\r
- //TODO\r
- printf("Error while initializing CAN\n");\r
- return res;\r
- }\r
- printf("CAN inited\n");\r
- }\r
- res = start_GW();\r
- return 0;\r
-}\r
-\r
-int end_can(int argc, char** argv){\r
- return end_GW();\r
-}\r
-\r
-int show_net(int argc, char** argv){\r
- rtems_bsdnet_show_if_stats();\r
- rtems_bsdnet_show_ip_stats();\r
- rtems_bsdnet_show_icmp_stats();\r
- rtems_bsdnet_show_mbuf_stats();\r
- rtems_bsdnet_show_inet_routes();\r
- return 0;\r
-}\r
-\r
-int start_net(int argc, char** argv){\r
- int res;\r
- printf("Initializing Network\n");\r
- res = rtems_bsdnet_initialize_network ();\r
- if (res < 0){\r
- printf("Error while initializing network: %d %s\n", errno, strerror(errno));\r
- return 1;\r
- }\r
- printf("Success\n");\r
- printf("Found routes.\n");\r
- rtems_bsdnet_show_inet_routes (); \r
- return 0;\r
-}\r
-\r
-int start_load(int argc, char** argv){\r
- return start_thread_load();\r
-}\r
-\r
-int stop_load(int argc, char** argv){\r
- return end_thread_load();\r
-}\r
+#include <system_def.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <rtems/error.h>
+#include <rtems/monitor.h>
+#include <rtems/shell.h>
+
+#include <bsp/mscan.h>
+#include <bsp/mscan-base.h>
+
+#include "helpers.h"
+#include "gw.h"
+#include "load.h"
+
+#include <rtems/rtems_bsdnet.h>
+#include "networkconfig.h"
+
+
+static rtems_device_major_number mscan_major;
+static rtems_driver_address_table mscan_driver_table=MSCAN_DRIVER_TABLE_ENTRY;
+
+/*
+* Prints can stats. (Used in debugging)
+*/
+int print_can_totals(int argc, char** argv){
+ printf("Total 1: %"PRIu32", Total 2: %"PRIu32"\n", total_1, total_2);
+ printf("Success 1: %"PRIu32", Success 2: %"PRIu32"\n", succ_1, succ_2);
+ printf("Errors 1: %"PRIu32", Errors 2: %"PRIu32"\n", err_1, err_2);
+ return 0;
+}
+
+/*
+* Prints clocks as given by the uboot. (Used in debugging)
+*/
+int print_clocks(int argc, char** argv){
+ printf("IPB_CLOCK: %lu\n", bsp_uboot_board_info.bi_ipbfreq);
+ printf("XLB_CLOCK: %lu\n", bsp_uboot_board_info.bi_busfreq);
+ printf("G2_CLOCK: %lu\n", bsp_uboot_board_info.bi_intfreq);
+ printf("BAUD: %lu\n", bsp_uboot_board_info.bi_baudrate);
+ return 0;
+}
+
+/*
+* Single function to prepare CAN devices for read/write operation.
+*
+* Sets up baud rate at 1M, opens fda and fdb and checks for errors.
+*/
+static int init_CAN(){
+ rtems_status_code status;
+
+ printf("Initializing CAN bus.\n");
+
+ printf("Changing gpiopcr setting...\n");
+ //Clear PCR_CHIP_SELECT bits and sets them to ALT_CAN.
+ mpc5200.gpiopcr = (mpc5200.gpiopcr & (~GPIO_PCR_CHIP_SELECT_1)) | GPIO_PCR_CHIP_ALTS_CAN;
+
+ printf("Registering CAN drivers...\n");
+ status = rtems_io_register_driver(0, &mscan_driver_table, &mscan_major);
+ if (status != RTEMS_SUCCESSFUL){
+ printf("caninit: rtems_io_register_driver %s\n",rtems_status_text(status));
+ return 1;
+ }
+
+ return 0;
+}
+
+int start_can(int argc, char** argv){
+ int res;
+ static char inited = 0;
+ if (!inited){
+ res = init_CAN();
+ inited = 1;
+ if (res != 0){
+ //TODO
+ printf("Error while initializing CAN\n");
+ return res;
+ }
+ printf("CAN inited\n");
+ }
+ res = start_GW();
+ return 0;
+}
+
+int end_can(int argc, char** argv){
+ return end_GW();
+}
+
+int show_net(int argc, char** argv){
+ rtems_bsdnet_show_if_stats();
+ rtems_bsdnet_show_ip_stats();
+ rtems_bsdnet_show_icmp_stats();
+ rtems_bsdnet_show_mbuf_stats();
+ rtems_bsdnet_show_inet_routes();
+ return 0;
+}
+
+int start_net(int argc, char** argv){
+ int res;
+ printf("Initializing Network\n");
+ res = rtems_bsdnet_initialize_network ();
+ if (res < 0){
+ printf("Error while initializing network: %d %s\n", errno, strerror(errno));
+ return 1;
+ }
+ printf("Success\n");
+ printf("Found routes.\n");
+ rtems_bsdnet_show_inet_routes ();
+ return 0;
+}
+
+int start_load(int argc, char** argv){
+ return start_thread_load();
+}
+
+int stop_load(int argc, char** argv){
+ return end_thread_load();
+}
-#ifndef __HELPERS_H_\r
-#define __HELPERS_H_\r
-\r
-int start_can(int argc, char** argv);\r
-int end_can(int argc, char** argv);\r
-int print_clocks(int argc, char** argv);\r
-int print_can_totals(int argc, char** argv);\r
-int start_net(int argc, char** argv);\r
-int show_net(int argc, char** argv);\r
-int start_load(int argc, char** argv);\r
-int stop_load(int argc, char** argv);\r
-\r
-/* chain of shell command descriptors */\r
-static rtems_shell_cmd_t shell_command_stop_load = {\r
- "stop_load", /* name */\r
- "stops cpu loading threads", /* usage */\r
- "user", /* topic */\r
- stop_load, /* command */\r
- NULL, /* alias */\r
- NULL /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_start_load = {\r
- "start_load", /* name */\r
- "starts cpu loading threads", /* usage */\r
- "user", /* topic */\r
- start_load, /* command */\r
- NULL, /* alias */\r
- &shell_command_stop_load /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_start_net = {\r
- "startNET", /* name */\r
- "starts ethernet driver", /* usage */\r
- "user", /* topic */\r
- start_net, /* command */\r
- NULL, /* alias */\r
- &shell_command_start_load /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_stop_gw = {\r
- "stopGW", /* name */\r
- "stops CAN gateway", /* usage */\r
- "user", /* topic */\r
- end_can, /* command */\r
- NULL, /* alias */\r
- &shell_command_start_net /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_start_gw = {\r
- "startGW", /* name */\r
- "starts CAN gateway", /* usage */\r
- "user", /* topic */\r
- start_can, /* command */\r
- NULL, /* alias */\r
- &shell_command_stop_gw /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_print_net = {\r
- "show_net", /* name */\r
- "shows some debug information about bsdnet", /* usage */\r
- "user", /* topic */\r
- show_net, /* command */\r
- NULL, /* alias */\r
- &shell_command_start_gw /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_print_clocks = {\r
- "print_clocks", /* name */\r
- "prints clock as taken from uboot", /* usage */\r
- "user", /* topic */\r
- print_clocks, /* command */\r
- NULL, /* alias */\r
- &shell_command_print_net /* next */\r
-};\r
-static rtems_shell_cmd_t shell_command_print_can_totals = {\r
- "printcan", /* name */\r
- "prints can stats", /* usage */\r
- "user", /* topic */\r
- print_can_totals, /* command */\r
- NULL, /* alias */\r
- &shell_command_print_clocks /* next */\r
-};\r
-\r
-\r
+#ifndef __HELPERS_H_
+#define __HELPERS_H_
+
+int start_can(int argc, char** argv);
+int end_can(int argc, char** argv);
+int print_clocks(int argc, char** argv);
+int print_can_totals(int argc, char** argv);
+int start_net(int argc, char** argv);
+int show_net(int argc, char** argv);
+int start_load(int argc, char** argv);
+int stop_load(int argc, char** argv);
+
+/* chain of shell command descriptors */
+static rtems_shell_cmd_t shell_command_stop_load = {
+ "stop_load", /* name */
+ "stops cpu loading threads", /* usage */
+ "user", /* topic */
+ stop_load, /* command */
+ NULL, /* alias */
+ NULL /* next */
+};
+static rtems_shell_cmd_t shell_command_start_load = {
+ "start_load", /* name */
+ "starts cpu loading threads", /* usage */
+ "user", /* topic */
+ start_load, /* command */
+ NULL, /* alias */
+ &shell_command_stop_load /* next */
+};
+static rtems_shell_cmd_t shell_command_start_net = {
+ "startNET", /* name */
+ "starts ethernet driver", /* usage */
+ "user", /* topic */
+ start_net, /* command */
+ NULL, /* alias */
+ &shell_command_start_load /* next */
+};
+static rtems_shell_cmd_t shell_command_stop_gw = {
+ "stopGW", /* name */
+ "stops CAN gateway", /* usage */
+ "user", /* topic */
+ end_can, /* command */
+ NULL, /* alias */
+ &shell_command_start_net /* next */
+};
+static rtems_shell_cmd_t shell_command_start_gw = {
+ "startGW", /* name */
+ "starts CAN gateway", /* usage */
+ "user", /* topic */
+ start_can, /* command */
+ NULL, /* alias */
+ &shell_command_stop_gw /* next */
+};
+static rtems_shell_cmd_t shell_command_print_net = {
+ "show_net", /* name */
+ "shows some debug information about bsdnet", /* usage */
+ "user", /* topic */
+ show_net, /* command */
+ NULL, /* alias */
+ &shell_command_start_gw /* next */
+};
+static rtems_shell_cmd_t shell_command_print_clocks = {
+ "print_clocks", /* name */
+ "prints clock as taken from uboot", /* usage */
+ "user", /* topic */
+ print_clocks, /* command */
+ NULL, /* alias */
+ &shell_command_print_net /* next */
+};
+static rtems_shell_cmd_t shell_command_print_can_totals = {
+ "printcan", /* name */
+ "prints can stats", /* usage */
+ "user", /* topic */
+ print_can_totals, /* command */
+ NULL, /* alias */
+ &shell_command_print_clocks /* next */
+};
+
+
#endif
\ No newline at end of file
-/* Init
- *
- * This routine is the initialization task for this test program.
- * It is called from init_exec and has the responsibility for creating
- * and starting the tasks that make up the test. If the time of day
- * clock is required for the test, it should also be set to a known
- * value by this function.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id: init.c,v 1.12.4.1 2003/09/04 18:46:30 joel Exp $
- */
-
#define CONFIGURE_INIT
#include <system_def.h>
#include "system.h"
-#include "app_def.h"\r
+#include "app_def.h"
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
__XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
#define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
-\r
-\r
-#define CONFIGURE_SHELL_USER_COMMANDS &shell_command_print_can_totals\r
-#define CONFIGURE_SHELL_COMMANDS_INIT\r
-#define CONFIGURE_SHELL_COMMANDS_ALL\r
-\r
-#include <rtems/shellconfig.h>\r
-#include <rtems/shell.h>\r
-\r
+
+
+#define CONFIGURE_SHELL_USER_COMMANDS &shell_command_print_can_totals
+#define CONFIGURE_SHELL_COMMANDS_INIT
+#define CONFIGURE_SHELL_COMMANDS_ALL
+
+#include <rtems/shellconfig.h>
+#include <rtems/shell.h>
+
rtems_task Init(rtems_task_argument ignored){
rtems_status_code status;
printf( "Starting application " SW_VER_ID " v "
BUILD_VERSION_STRING(SW_VER_MAJOR,SW_VER_MINOR,SW_VER_PATCH)
"\n" );
-\r
- /* Inits */\r
-#ifdef BENCH_BUILD\r
- start_can(0, NULL);\r
- start_net(0, NULL);\r
-#ifdef LOAD_BUILD\r
- start_load(0, NULL);\r
-#endif\r
-#endif\r
-\r
-#ifndef BENCH_BUILD \r
- rtems_shell_init(\r
- "SHLL", /* task name */\r
- RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */\r
- 100, /* task priority */\r
- "/dev/console", /* device name */\r
- true, /* run forever */\r
- false, /* wait for shell to terminate */\r
- NULL /* login check function, use NULL to disable a login check */\r
- ); \r
-#endif \r
- \r
+
+ /* 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
+
status = rtems_task_delete( RTEMS_SELF );
exit( 0 );
/* configuration information */
-#include <bsp.h> /* for device driver prototypes */\r
+#include <bsp.h> /* for device driver prototypes */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 2
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
#define CONFIGURE_MAXIMUM_DRIVERS (CONFIGURE_NUMBER_OF_DRIVERS+10)
-\r
+
#ifdef RTEMS_POSIX_API
#define CONFIGURE_MAXIMUM_POSIX_THREADS 32
-#include <stdio.h>\r
-\r
-#include <pthread.h>\r
-#include <semaphore.h>\r
-\r
-#include "load.h"\r
-\r
-/* Load function for threads. */\r
-static void* produce(void* arg);\r
-static void* consume(void* arg);\r
-\r
-/* semaphores for consumer/producer pair */\r
-static sem_t produced, consumed;\r
-/* pthread handles for the loader */\r
-static pthread_t consumer, producer;\r
-static int n = 0;\r
-static char running = 0;\r
-\r
-static void* produce(void* arg){\r
- while (1) {\r
- sem_wait(&consumed);\r
- n++; \r
- sem_post(&produced);\r
- pthread_testcancel();\r
- }\r
- return NULL;\r
-} \r
-\r
-static void* consume(void* arg){\r
- while (1) {\r
- sem_wait(&produced);\r
- n--;\r
- sem_post(&consumed);\r
- pthread_testcancel();\r
- }\r
- return NULL;\r
-}\r
-\r
-/*\r
-* This function starts threads loading the CPU and creates associated semaphores. \r
-* \r
-* Has a guard to prevent starting again, before it was stopped.\r
-*\r
-* No error handling currently, only tries to report errors.\r
-*/\r
-int start_thread_load(){\r
- if (running == 0){\r
- printf("Attempting to start load.\n");\r
- int res;\r
- running = 1;\r
- res = sem_init(&consumed, 0, 0);\r
- if (res < 0){\r
- printf("Couldn't initialize consumed semaphore.\n");\r
- return 1;\r
- }\r
- res = sem_init(&produced, 0, 1);\r
- if (res < 0){\r
- printf("Couldn't initialize produced semaphore.\n");\r
- return 1;\r
- }\r
- \r
- res = pthread_create(&producer, NULL, produce, NULL);\r
- if (res < 0){\r
- printf("Couldn't create producer thread.\n");\r
- return 1;\r
- }\r
- \r
- res = pthread_create(&consumer, NULL, consume, NULL);\r
- if (res < 0){\r
- printf("Couldn't create consumer thread.\n");\r
- return 1;\r
- }\r
- \r
- pthread_detach(producer);\r
- pthread_detach(consumer);\r
- printf("Load started succesfully.\n");\r
- return 0;\r
- } else {\r
- printf("Load is already running.\n");\r
- return 0;\r
- }\r
-}\r
-\r
-/*\r
-* This function stops threads loading the CPU and destroys associated semaphores. \r
-*\r
-* Has a guard against attempting to stop the threads if they are not running.\r
-* \r
-* No error handling currently, only tries to report errors.\r
-*/\r
-int end_thread_load(){\r
- if (running == 1){\r
- int res;\r
- printf("Attempting to cancel producer thread.\n");\r
- res = pthread_cancel(producer);\r
- if (res != 0){\r
- /* This means that sending cancel signal has failed... Just returning an error should be enough. */\r
- /* If we killed the thread, destroying the semaphore would lead to UB. */\r
- printf("Failed.\n");\r
- return 1;\r
- }\r
-\r
- printf("Attempting to cancel consumer thread.\n");\r
- res = pthread_cancel(consumer);\r
- if (res != 0){\r
- /* Same here. */\r
- printf("Failed.\n");\r
- return 1;\r
- }\r
-\r
- printf("Preparing to destroy semaphores.\n");\r
- /* Wait a bit so that the threads can get to a cancellation point. */\r
- sleep(1);\r
- sem_destroy(&produced);\r
- sem_destroy(&consumed);\r
- running = 0;\r
- printf("Finished.\n");\r
- return 0;\r
- } else {\r
- printf("Load is not running.\n");\r
- return 0;\r
- }\r
+#include <stdio.h>
+
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "load.h"
+
+/* Load function for threads. */
+static void* produce(void* arg);
+static void* consume(void* arg);
+
+/* semaphores for consumer/producer pair */
+static sem_t produced, consumed;
+/* pthread handles for the loader */
+static pthread_t consumer, producer;
+static int n = 0;
+static char running = 0;
+
+static void* produce(void* arg){
+ while (1) {
+ sem_wait(&consumed);
+ n++;
+ sem_post(&produced);
+ pthread_testcancel();
+ }
+ return NULL;
+}
+
+static void* consume(void* arg){
+ while (1) {
+ sem_wait(&produced);
+ n--;
+ sem_post(&consumed);
+ pthread_testcancel();
+ }
+ return NULL;
+}
+
+/*
+* This function starts threads loading the CPU and creates associated semaphores.
+*
+* Has a guard to prevent starting again, before it was stopped.
+*
+* No error handling currently, only tries to report errors.
+*/
+int start_thread_load(){
+ if (running == 0){
+ printf("Attempting to start load.\n");
+ int res;
+ running = 1;
+ res = sem_init(&consumed, 0, 0);
+ if (res < 0){
+ printf("Couldn't initialize consumed semaphore.\n");
+ return 1;
+ }
+ res = sem_init(&produced, 0, 1);
+ if (res < 0){
+ printf("Couldn't initialize produced semaphore.\n");
+ return 1;
+ }
+
+ res = pthread_create(&producer, NULL, produce, NULL);
+ if (res < 0){
+ printf("Couldn't create producer thread.\n");
+ return 1;
+ }
+
+ res = pthread_create(&consumer, NULL, consume, NULL);
+ if (res < 0){
+ printf("Couldn't create consumer thread.\n");
+ return 1;
+ }
+
+ pthread_detach(producer);
+ pthread_detach(consumer);
+ printf("Load started succesfully.\n");
+ return 0;
+ } else {
+ printf("Load is already running.\n");
+ return 0;
+ }
+}
+
+/*
+* This function stops threads loading the CPU and destroys associated semaphores.
+*
+* Has a guard against attempting to stop the threads if they are not running.
+*
+* No error handling currently, only tries to report errors.
+*/
+int end_thread_load(){
+ if (running == 1){
+ int res;
+ printf("Attempting to cancel producer thread.\n");
+ res = pthread_cancel(producer);
+ if (res != 0){
+ /* This means that sending cancel signal has failed... Just returning an error should be enough. */
+ /* If we killed the thread, destroying the semaphore would lead to UB. */
+ printf("Failed.\n");
+ return 1;
+ }
+
+ printf("Attempting to cancel consumer thread.\n");
+ res = pthread_cancel(consumer);
+ if (res != 0){
+ /* Same here. */
+ printf("Failed.\n");
+ return 1;
+ }
+
+ printf("Preparing to destroy semaphores.\n");
+ /* Wait a bit so that the threads can get to a cancellation point. */
+ sleep(1);
+ sem_destroy(&produced);
+ sem_destroy(&consumed);
+ running = 0;
+ printf("Finished.\n");
+ return 0;
+ } else {
+ printf("Load is not running.\n");
+ return 0;
+ }
}
\ No newline at end of file
-/*\r
-* Implements simple producer/consumer thread pair to cause load on the CPU.\r
-* \r
-* Used in benchmarking the CAN gateway.\r
-*\r
-* Co-opted from http://support.dce.felk.cvut.cz/pos/cv3/src/semaphore.html. \r
-*/\r
-#ifndef __CPU_LOAD_H_\r
-#define __CPU_LOAD_H_\r
-\r
-\r
-/*\r
-* This function starts threads loading the CPU and creates associated semaphores. \r
-* \r
-* Has a guard to prevent starting again, before it was stopped.\r
-*\r
-* No error handling currently, only tries to report errors.\r
-*\r
-* 0 if successfull, 1 otherwise.\r
-*/\r
-int start_thread_load();\r
-\r
-/*\r
-* This function stops threads loading the CPU and destroys associated semaphores. \r
-*\r
-* Has a guard against attempting to stop the threads if they are not running.\r
-* \r
-* No error handling currently, only tries to report errors.\r
-*\r
-* 0 if successfull, 1 otherwise.\r
-*/\r
-int end_thread_load();\r
-\r
-#endif\r
-\r
+/*
+* Implements simple producer/consumer thread pair to cause load on the CPU.
+*
+* Used in benchmarking the CAN gateway.
+*
+* Co-opted from http://support.dce.felk.cvut.cz/pos/cv3/src/semaphore.html.
+*/
+#ifndef __CPU_LOAD_H_
+#define __CPU_LOAD_H_
+
+
+/*
+* This function starts threads loading the CPU and creates associated semaphores.
+*
+* Has a guard to prevent starting again, before it was stopped.
+*
+* No error handling currently, only tries to report errors.
+*
+* 0 if successfull, 1 otherwise.
+*/
+int start_thread_load();
+
+/*
+* This function stops threads loading the CPU and destroys associated semaphores.
+*
+* Has a guard against attempting to stop the threads if they are not running.
+*
+* No error handling currently, only tries to report errors.
+*
+* 0 if successfull, 1 otherwise.
+*/
+int end_thread_load();
+
+#endif
+
-#SUBDIRS =
-
include_HEADERS = system_def.h networkconfig.h app_def.h
#include <rtems/rtems_bsdnet.h>
#include <bsp.h>
-/* This was taken from existing example, driver failed to provide its own, so why not. */\r
-static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };\r
-\r
-extern void rtems_bsdnet_loopattach();\r
-\r
-/* config for loopback device */\r
-static struct rtems_bsdnet_ifconfig loopback_config = {\r
- "lo0",\r
- rtems_bsdnet_loopattach,\r
- NULL,\r
- "127.0.0.1",\r
- "255.0.0.0"\r
- /* Rest of the struct is set to 0 (is defaulted) */\r
-};\r
-\r
-/* config for ethernet */\r
-static struct rtems_bsdnet_ifconfig netdriver_config = {\r
- RTEMS_BSP_NETWORK_DRIVER_NAME,\r
- RTEMS_BSP_NETWORK_DRIVER_ATTACH,\r
- &loopback_config, /* link to next interface */\r
- "192.168.2.3", /* IP address */\r
- "255.255.255.0", /* IP address net mask */\r
- ethernet_address /* ethernet hardware address, 0 - supplied by driver according to documentation, but it caused error when tested */\r
- \r
- /* rest of the struct is set to 0 (is defaulted) */\r
-};\r
-\r
+/* This was taken from existing example, driver failed to provide its own, so why not. */
+static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };
+
+extern void rtems_bsdnet_loopattach();
+
+/* config for loopback device */
+static struct rtems_bsdnet_ifconfig loopback_config = {
+ "lo0",
+ rtems_bsdnet_loopattach,
+ NULL,
+ "127.0.0.1",
+ "255.0.0.0"
+ /* Rest of the struct is set to 0 (is defaulted) */
+};
+
+/* config for ethernet */
+static struct rtems_bsdnet_ifconfig netdriver_config = {
+ RTEMS_BSP_NETWORK_DRIVER_NAME,
+ RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+ &loopback_config, /* link to next interface */
+ "192.168.2.3", /* IP address */
+ "255.255.255.0", /* IP address net mask */
+ ethernet_address /* ethernet hardware address, 0 - supplied by driver according to documentation, but it caused error when tested */
+
+ /* rest of the struct is set to 0 (is defaulted) */
+};
+
/* Main config. */
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config, /* This entry points to the head of the ifconfig chain. */
NULL, /* rtems_bsdnet_do_bootp if it should use bootp, null otherwise */
- /* From here on, zero means default value. */\r
+ /* From here on, zero means default value. */
100, /* network task priority (default 100) */
- 65792, /* mbuf bytecount (default 64kbytes) */\r
+ 65792, /* mbuf bytecount (default 64kbytes) */
/* Using default sizes stops RTEMS from answering to pings. (Probably because it allocates too few buffer for an answer.). */
263168, //180584, /* mbuf cluster bytecount (default 128kbytes) */
"midam_deska", /* hostname (default BOOTP) */