From: Pavel Pisa Date: Sat, 14 Sep 2013 18:36:55 +0000 (+0200) Subject: RTEMS: use explicit loopback configuration for RTEMS <= 4.10.x. X-Git-Tag: v0.3.4~151 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/orte.git/commitdiff_plain/68bec0f6a82c96f1462e42d6855c083676bc0a82 RTEMS: use explicit loopback configuration for RTEMS <= 4.10.x. Signed-off-by: Pavel Pisa --- diff --git a/orte/examples/rtems-shell/init.c b/orte/examples/rtems-shell/init.c index a9fc3ed..e19c0e6 100644 --- a/orte/examples/rtems-shell/init.c +++ b/orte/examples/rtems-shell/init.c @@ -34,8 +34,6 @@ #include -#include "networkconfig-static.h" - #include #include #include @@ -60,6 +58,14 @@ #define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__) +#if RTEMS_VER_CODE < VER_CODE(4,10,99) + #ifndef RTEMS_USE_LOOPBACK + #define RTEMS_USE_LOOPBACK 1 + #endif +#endif + +#include "networkconfig-static.h" + #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) \ diff --git a/orte/examples/rtems-shell/networkconfig-static.h b/orte/examples/rtems-shell/networkconfig-static.h index 961690f..a5ba84e 100644 --- a/orte/examples/rtems-shell/networkconfig-static.h +++ b/orte/examples/rtems-shell/networkconfig-static.h @@ -6,10 +6,33 @@ static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 }; +#ifdef RTEMS_USE_LOOPBACK + +int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int); + +#ifdef RTEMS_USE_LOOPBACK_ONLY +static struct rtems_bsdnet_ifconfig netdriver_config = { +#else +static struct rtems_bsdnet_ifconfig loopback_config = { +#endif + .name = "lo0", + .attach = rtems_bsdnet_loopattach, + .next = NULL, + .ip_address = "127.0.0.1", + .ip_netmask = "255.0.0.0", +}; + +#endif /*RTEMS_USE_LOOPBACK*/ + +#ifndef RTEMS_USE_LOOPBACK_ONLY static struct rtems_bsdnet_ifconfig netdriver_config = { .name = RTEMS_BSP_NETWORK_DRIVER_NAME, .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH, +#ifdef RTEMS_USE_LOOPBACK + .next = &loopback_config, +#else /*RTEMS_USE_LOOPBACK*/ .next = NULL, +#endif /*RTEMS_USE_LOOPBACK*/ .ip_address = "192.168.2.3", .ip_netmask = "255.255.255.0", .hardware_address = ethernet_address, @@ -22,6 +45,7 @@ static struct rtems_bsdnet_ifconfig netdriver_config = { .bpar = 0, .drv_ctrl = NULL }; +#endif /*RTEMS_USE_LOOPBACK_ONLY*/ struct rtems_bsdnet_config rtems_bsdnet_config = { .ifconfig = &netdriver_config, diff --git a/orte/examples/rtems-shell/networkconfig.h b/orte/examples/rtems-shell/networkconfig.h index e5158eb..7c3dccf 100644 --- a/orte/examples/rtems-shell/networkconfig.h +++ b/orte/examples/rtems-shell/networkconfig.h @@ -7,10 +7,33 @@ static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 }; +#ifdef RTEMS_USE_LOOPBACK + +int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int); + +#ifdef RTEMS_USE_LOOPBACK_ONLY +static struct rtems_bsdnet_ifconfig netdriver_config = { +#else +static struct rtems_bsdnet_ifconfig loopback_config = { +#endif + .name = "lo0", + .attach = rtems_bsdnet_loopattach, + .next = NULL, + .ip_address = "127.0.0.1", + .ip_netmask = "255.0.0.0", +}; + +#endif /*RTEMS_USE_LOOPBACK*/ + +#ifndef RTEMS_USE_LOOPBACK_ONLY static struct rtems_bsdnet_ifconfig netdriver_config = { .name = RTEMS_BSP_NETWORK_DRIVER_NAME, .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH, +#ifdef RTEMS_USE_LOOPBACK + .next = &loopback_config, +#else /*RTEMS_USE_LOOPBACK*/ .next = NULL, +#endif /*RTEMS_USE_LOOPBACK*/ .ip_address = "192.168.3.66", .ip_netmask = "255.255.255.0", .hardware_address = ethernet_address, @@ -23,6 +46,7 @@ static struct rtems_bsdnet_ifconfig netdriver_config = { .bpar = 0, .drv_ctrl = NULL }; +#endif /*RTEMS_USE_LOOPBACK_ONLY*/ struct rtems_bsdnet_config rtems_bsdnet_config = { .ifconfig = &netdriver_config,