From ea74ab6e7adc5d6d56bc7c932d6cf093db1d5122 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Mon, 30 Apr 2001 21:03:12 +0000 Subject: [PATCH] Allow network interface card to be selected using site-specific configuration file. Provide example selection for RTEMS pc386 target. --- configure/os/CONFIG_SITE.Common.RTEMS-pc386 | 4 +++ src/libCom/osi/os/RTEMS/rtems_netconfig.c | 36 ++++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 configure/os/CONFIG_SITE.Common.RTEMS-pc386 diff --git a/configure/os/CONFIG_SITE.Common.RTEMS-pc386 b/configure/os/CONFIG_SITE.Common.RTEMS-pc386 new file mode 100644 index 000000000..4b680d3b5 --- /dev/null +++ b/configure/os/CONFIG_SITE.Common.RTEMS-pc386 @@ -0,0 +1,4 @@ +# +# Site-specific overrides for RTEMS-pc386 target +# +TARGET_CFLAGS += -DEPICS_RTEMS_NIC_3C509 diff --git a/src/libCom/osi/os/RTEMS/rtems_netconfig.c b/src/libCom/osi/os/RTEMS/rtems_netconfig.c index 1fc56993c..9c5a8fbaf 100644 --- a/src/libCom/osi/os/RTEMS/rtems_netconfig.c +++ b/src/libCom/osi/os/RTEMS/rtems_netconfig.c @@ -2,8 +2,11 @@ * RTEMS network configuration for EPICS * $Id$ * Author: W. Eric Norum - * eric@cls.usask.ca - * (306) 966-6055 + * eric.norum@usask.ca + * (306) 966-5394 + * + * This file can be copied to an application source dirctory + * and modified to override the values shown below. */ #include #include @@ -19,9 +22,33 @@ static struct rtems_bsdnet_ifconfig loopback_config = { "127.0.0.1", /* IP address */ "255.0.0.0", /* IP net mask */ }; + +/* + * The following conditionals select the network interface card. + * + * By default the network interface specified by the board-support + * package is used. + * To use a different NIC for a particular application, copy this file to the + * application directory and add the appropriate -Dxxxx to the compiler flag. + * To specify a different NIC on a site-wide basis, add the appropriate + * flags to the site configuration file for the target. For example, to + * specify a 3COM 3C509 for all RTEMS-pc386 targets at your site, add + * TARGET_CFLAGS += -DEPICS_RTEMS_NIC_3C509 + * to configure/os/CONFIG_SITE.Common.RTEMS-pc386. + */ +#if defined(EPICS_RTEMS_NIC_3C509) /* 3COM 3C509 */ + extern int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *, int); +# define NIC_NAME "en0" +# define NIC_ATTACH rtems_3c509_driver_attach + +#else /* Use NIC provided by BSP */ +# define NIC_NAME RTEMS_BSP_NETWORK_DRIVER_NAME +# define NIC_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH +#endif + static struct rtems_bsdnet_ifconfig netdriver_config = { - RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */ - RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */ + NIC_NAME, /* name */ + NIC_ATTACH, /* attach function */ &loopback_config, /* link to next interface */ }; struct rtems_bsdnet_config rtems_bsdnet_config = { @@ -31,4 +58,3 @@ struct rtems_bsdnet_config rtems_bsdnet_config = { 180*1024, /* MBUF space */ 350*1024, /* MBUF cluster space */ }; -