source: network-demos/networkconfig-qemu.h @ 3713ec7

4.11
Last change on this file since 3713ec7 was 3713ec7, checked in by Joel Sherrill <joel.sherrill@…>, on 03/03/11 at 20:04:48

2011-03-03 Joel Sherrill <joel.sherrill@…>

  • networkconfig-qemu.h: VirtualBox? uses 10.0.x.x for its eth0 so we need to switch to 10.1.x.x for things to work smoothly.
  • networkconfig-loopback.h: New file.
  • Property mode set to 100644
File size: 9.1 KB
Line 
1/*
2 * Network configuration -- QEMU NOT using DHCP
3 *
4 ************************************************************
5 * EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION     *
6 * BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
7 ************************************************************
8 *
9 *  The dynamic probing is based upon the EPICS network
10 *  configuration file written by:
11 *      W. Eric Norum
12 *      eric.norum@usask.ca
13 *      (306) 966-5394
14 *
15 *  $Id$
16 */
17
18#ifndef _RTEMS_NETWORKCONFIG_H_
19#define _RTEMS_NETWORKCONFIG_H_
20
21/* #define USE_LIBBSDPORT */
22
23#if defined(USE_LIBBSDPORT)
24  #include <bsp/libbsdport_api.h>
25  #define CONFIGURE_MAXIMUM_TIMERS 10
26#endif
27/*
28 * For TFTP test application
29 */
30#if (defined (RTEMS_USE_BOOTP))
31#define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST"
32#define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE"
33#else
34#define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ"
35#define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
36#endif
37
38/*
39 * For NFS test application
40 *
41 * NFS mount and a directory to ls once mounted
42 */
43#define RTEMS_NFS_SERVER      "192.168.1.210"
44#define RTEMS_NFS_SERVER_PATH "/home"
45#define RTEMS_NFS_LS_PATH     "/mnt/nfstest"
46
47
48
49/*
50 * This file can be copied to an application source dirctory
51 * and modified to override the values shown below.
52 *
53 * The following CPP symbols may be passed from the Makefile:
54 *
55 *   symbol                   default       description
56 *
57 *   NETWORK_TASK_PRIORITY    150           can be read by app from public
58 *                                          var 'gesysNetworkTaskPriority'
59 *   FIXED_IP_ADDR            <undefined>   hardcoded IP address (e.g.,
60 *                                          "192.168.0.10"); disables BOOTP;
61 *                                          must also define FIXED_NETMASK
62 *   FIXED_NETMASK            <undefined>   IP netmask string
63 *                                          (e.g. "255.255.255.0")
64 *   MULTI_NETDRIVER          <undefined>   ugly hack; if defined try to probe
65 *                                          a variety of PCI and ISA drivers
66 *                                          (i386 ONLY) use is discouraged!
67 *   NIC_NAME                 <undefined>   Ethernet driver name (e.g. "pcn1");
68 *                                          must also define NIC_ATTACH
69 *   NIC_ATTACH               <undefined>   Ethernet driver attach function
70 *                                          (e.g., rtems_fxp_attach).
71 *                                          If these are undefined then
72 *                                            a) MULTI_NETDRIVER is used
73 *                                               (if defined)
74 *                                            b) RTEMS_BSP_NETWORK_DRIVER_NAME/
75 *                                               RTEMS_BSP_NETWORK_DRIVER_ATTACH
76 *                                               are tried
77 *   MEMORY_CUSTOM            <undefined>   Allocate the defined amount of
78 *                                          memory for mbufs and mbuf clusters,
79 *                                          respectively. Define to a comma ','
80 *                                          separated pair of two numerical
81 *                                          values, e.g: 100*1024,200*1024
82 *   MEMORY_SCARCE            <undefined>   Allocate few memory for mbufs
83 *                                          (hint for how much memory the
84 *                                          board has)
85 *   MEMORY_HUGE              <undefined>   Allocate a lot of memory for mbufs
86 *                                          (hint for how much memory the
87 *                                          board has)
88 *                                          If none of MEMORY_CUSTOM/
89 *                                          MEMORY_SCARCE/MEMORY_HUGE are
90 *                                          defined then a medium amount of
91 *                                          memory is allocated for mbufs.
92 */
93
94#include <rtems/bspIo.h>
95#include <bsp.h>
96#include <rtems/rtems_bsdnet.h>
97
98#if 0
99#ifdef HAVE_CONFIG_H
100#include <config.h>
101#else
102#include "verscheck.h"
103#endif
104#endif
105
106#define MULTI_NETDRIVER
107
108/* Assume we are on qemu unless forced to lab hardware */
109#if !defined(ON_RTEMS_LAB_WINSYSTEMS)
110#undef ON_QEMU
111#define ON_QEMU
112#endif
113
114#if defined(ON_QEMU)
115#define FIXED_IP_ADDR "10.1.2.5"
116#endif
117
118#if defined(ON_RTEMS_LAB_WINSYSTEMS)
119#define FIXED_IP_ADDR "192.168.1.249"
120#endif
121
122#define FIXED_NETMASK "255.255.255.0"
123
124#ifndef NETWORK_TASK_PRIORITY
125#define NETWORK_TASK_PRIORITY   150  /* within EPICS' range */
126#endif
127
128/* make publicily available for startup scripts... */
129const int gesysNetworkTaskPriority = NETWORK_TASK_PRIORITY;
130
131#ifdef  FIXED_IP_ADDR
132#define RTEMS_DO_BOOTP 0
133#else
134#define RTEMS_DO_BOOTP rtems_bsdnet_do_bootp
135#define FIXED_IP_ADDR  0
136#undef  FIXED_NETMASK
137#define FIXED_NETMASK  0
138#endif
139
140#if !defined(NIC_NAME)
141
142#ifdef MULTI_NETDRIVER
143
144#if 0
145  #if RTEMS_VERSION_ATLEAST(4,6,99)
146  #define pcib_init pci_initialize
147  #endif
148#endif
149
150extern int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *, int);
151extern int rtems_fxp_attach (struct rtems_bsdnet_ifconfig *, int);
152extern int rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *, int);
153extern int rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *, int);
154
155/* these don't probe and will be used even if there's no device :-( */
156extern int rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *, int);
157extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *, int);
158
159static struct rtems_bsdnet_ifconfig isa_netdriver_config[] = {
160  {
161        "ep0", rtems_3c509_driver_attach, isa_netdriver_config + 1,
162  },
163  {
164        "ne1", rtems_ne_driver_attach, 0, irno: 9 /* qemu cannot configure irq-no :-(; has it hardwired to 9 */
165  },
166};
167
168static struct rtems_bsdnet_ifconfig pci_netdriver_config[]={
169  {
170  "dc1", rtems_dec21140_driver_attach, pci_netdriver_config+1,
171  },
172  #if !defined(USE_LIBBSDPORT)
173    {
174    "fxp1", rtems_fxp_attach, pci_netdriver_config+2,
175    },
176  #else
177    {
178      "", libbsdport_netdriver_attach, pci_netdriver_config+2,
179    },
180  #endif
181  {
182  "elnk1", rtems_elnk_driver_attach, isa_netdriver_config,
183  },
184};
185
186static int pci_check(struct rtems_bsdnet_ifconfig *ocfg, int attaching)
187{
188struct rtems_bsdnet_ifconfig *cfg;
189int if_index_pre;
190extern int if_index;
191  if ( attaching ) {
192        cfg = pci_initialize() ?
193                      isa_netdriver_config : pci_netdriver_config;
194  }
195  while ( cfg ) {
196        printk("Probing '%s'", cfg->name);
197        /* unfortunately, the return value is unreliable - some drivers report
198         * success even if they fail.
199         * Check if they chained an interface (ifnet) structure instead
200         */
201        if_index_pre = if_index;
202        cfg->attach(cfg, attaching);
203        if ( if_index > if_index_pre ) {
204                /* assume success */
205                printk(" .. seemed to work\n");
206                ocfg->name   = cfg->name;
207                ocfg->attach = cfg->attach;
208                return 0;
209        }
210        printk(" .. failed\n");
211        cfg = cfg->next;
212  }
213  return -1;
214}
215
216#define NIC_NAME   "dummy"
217#define NIC_ATTACH pci_check
218
219#else
220
221#if defined(RTEMS_BSP_NETWORK_DRIVER_NAME)  /* Use NIC provided by BSP */
222# define NIC_NAME   RTEMS_BSP_NETWORK_DRIVER_NAME
223# define NIC_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH
224#endif
225
226#endif /* ifdef MULTI_NETDRIVER */
227#endif
228
229#ifdef NIC_NAME
230
231extern int NIC_ATTACH();
232
233
234static struct rtems_bsdnet_ifconfig netdriver_config[1] = {{
235  NIC_NAME,  /* name */
236  (int (*)(struct rtems_bsdnet_ifconfig*,int))NIC_ATTACH,  /* attach function */
237  0,            /* link to next interface */
238  FIXED_IP_ADDR,
239  FIXED_NETMASK
240}};
241#else
242#warning "NO KNOWN NETWORK DRIVER FOR THIS BSP -- YOU MAY HAVE TO EDIT networkconfig.h"
243#endif
244
245struct rtems_bsdnet_config rtems_bsdnet_config = {
246#ifdef NIC_NAME
247    netdriver_config,         /* link to next interface */
248    RTEMS_DO_BOOTP,           /* Use BOOTP to get network configuration */
249#else
250    0,
251    0,
252#endif
253    NETWORK_TASK_PRIORITY,    /* Network task priority */
254#if   defined(MEMORY_CUSTOM)
255    MEMORY_CUSTOM,
256#elif defined(MEMORY_SCARCE)
257    100*1024,                 /* MBUF space */
258    200*1024,                 /* MBUF cluster space */
259#elif defined(MEMORY_HUGE)
260    2*1024*1024,              /* MBUF space */
261    5*1024*1024,              /* MBUF cluster space */
262#else
263    180*1024,                 /* MBUF space */
264    350*1024,                 /* MBUF cluster space */
265#endif
266#if (!defined (RTEMS_USE_BOOTP)) && defined(ON_RTEMS_LAB_WINSYSTEMS)
267    "rtems",                /* Host name */
268    "nodomain.com",         /* Domain name */
269    "192.168.1.14",         /* Gateway */
270    "192.168.1.1",          /* Log host */
271    {"192.168.1.1"  },      /* Name server(s) */
272    {"192.168.1.1"  },      /* NTP server(s) */
273#else
274    NULL,                   /* Host name */
275    NULL,                   /* Domain name */
276    NULL,                   /* Gateway */
277    NULL,                   /* Log host */
278    { NULL },               /* Name server(s) */
279    { NULL },               /* NTP server(s) */
280#endif /* !RTEMS_USE_BOOTP */
281    0,                      /* efficiency */
282    0,                      /* udp TX buffer */
283    0,                      /* udp RX buffer */
284    0,                      /* tcp TX buffer */
285    0,                      /* tcp RX buffer */
286};
287#endif /* _RTEMS_NETWORKCONFIG_H_ */
Note: See TracBrowser for help on using the repository browser.