#include <system_def.h>\r
-#include "system.h"\r
-#include "app_def.h"\r
#include <unistd.h>\r
#include <fcntl.h>\r
#include <stdio.h>\r
#include <bsp/mscan.h>\r
#include <bsp/mscan-base.h>\r
\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
-extern unsigned long int total_1, total_2, succ_1, succ_2, err_1, err_2;\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
+/*\r
+* Prints can stats. (Used in debugging)\r
+*/\r
int print_can_totals(int argc, char** argv){\r
- printf("Total 1: %lu, Total 2: %lu\n", total_1, total_2);\r
- printf("Success 1: %lu, Success 2: %lu\n", succ_1, succ_2);\r
- printf("Errors 1: %lu, Errors 2: %lu\n", err_1, err_2);\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
-int print_regs(int argc, char** argv){\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
- printf("BIT 27 set to 1: 0x%08lx\n", MPC5200_BIT32(27));\r
- printf("GPIO_PCR_CHIP_ALTS_CAN: 0x%08x\n", GPIO_PCR_CHIP_ALTS_CAN); \r
- printf("GPIO_PCR_CHIP_SELECT_1: 0x%08x\n", GPIO_PCR_CHIP_SELECT_1);\r
return 0;\r
}\r
\r
-\r
-\r
/*\r
* Single function to prepare CAN devices for read/write operation.\r
*\r
\r
int end_can(int argc, char** argv){\r
return end_GW();\r
-}
\ No newline at end of file
+}\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