RTEMS Logo

RTEMS 4.9.5 On-Line Library


Network device configuration

PREV UP NEXT Bookshelf RTEMS Network Supplement

3.3.3: Network device configuration

Network devices are specified and configured by declaring and initializing a struct rtems_bsdnet_ifconfig structure for each network device.

The structure entries are described in the following table. An application which uses a single network interface, gets network configuration information from a BOOTP/DHCP server, and uses the default values for all driver parameters needs to initialize only the first two entries in the structure.

char *name
The full name of the network device. This name consists of the driver name and the unit number (e.g. "scc1"). The bsp.h include file usually defines RTEMS_BSP_NETWORK_DRIVER_NAME as the name of the primary (or only) network driver.
int (*attach)(struct rtems_bsdnet_ifconfig *conf)
The address of the driver attach function. The network initialization function calls this function to configure the driver and attach it to the network stack. The bsp.h include file usually defines RTEMS_BSP_NETWORK_DRIVER_ATTACH as the name of the attach function of the primary (or only) network driver.
struct rtems_bsdnet_ifconfig *next
A pointer to the network device configuration structure for the next network interface, or NULL if this is the configuration structure of the last network interface.
char *ip_address
The Internet address of the device, specified in `dotted decimal' (129.128.4.2) form, or NULL if the device configuration information is being obtained from a BOOTP/DHCP server.
char *ip_netmask
The Internet inetwork mask of the device, specified in `dotted decimal' (255.255.255.0) form, or NULL if the device configuration information is being obtained from a BOOTP/DHCP server.
void *hardware_address
The hardware address of the device, or NULL if the driver is to obtain the hardware address in some other way (usually by reading it from the device or from the bootstrap ROM).
int ignore_broadcast
Zero if the device is to accept broadcast packets, non-zero if the device is to ignore broadcast packets.
int mtu
The maximum transmission unit of the device, or zero if the driver is to choose a default value (typically 1500 for Ethernet devices).
int rbuf_count
The number of receive buffers to use, or zero if the driver is to choose a default value
int xbuf_count
The number of transmit buffers to use, or zero if the driver is to choose a default value Keep in mind that some network devices may use 4 or more transmit descriptors for a single transmit buffer.

A complete network configuration specification can be as simple as the one shown in the following example. This configuration uses a single network interface, gets network configuration information from a BOOTP/DHCP server, and uses the default values for all driver parameters.

static struct rtems_bsdnet_ifconfig netdriver_config = {
  RTEMS_BSP_NETWORK_DRIVER_NAME,
  RTEMS_BSP_NETWORK_DRIVER_ATTACH
};
struct rtems_bsdnet_config rtems_bsdnet_config = {
  &netdriver_config,
  rtems_bsdnet_do_bootp,
};


PREV UP NEXT Bookshelf RTEMS Network Supplement

Copyright © 1988-2008 OAR Corporation