source: rtems/c/src/lib/libbsp/powerpc/beatnik/network/support/bsp_bsdnet_attach.h @ 183af89

4.115
Last change on this file since 183af89 was b7a6d23a, checked in by Till Straumann <strauman@…>, on 12/03/09 at 16:56:50
  • importing 'beatnik' BSP from SLAC repository.
  • Property mode set to 100644
File size: 2.6 KB
Line 
1/* $Id$ */
2#ifndef BSP_BSDNET_ATTACH_INFO_H
3#define BSP_BSDNET_ATTACH_INFO_H
4
5/* Author: Till Straumann, 2005; see ../../LICENSE */
6
7/* Rationale: traditionally, BSPs only supported a single networking interface
8 *            the BSP defined RTEMS_NETWORK_DRIVER_NAME & friends macros
9 *            for applications to use.
10 *            If more than one interface is present, this simple approach is
11 *            not enough.
12 *            Hence, this BSP exports a routine declaring all available interfaces
13 *            so the application can make a choice.
14 */
15
16#ifdef __cplusplus
17  extern "C" {
18#endif
19
20/* Fwd. decl just in case */
21struct rtems_bsdnet_ifconfig;
22
23typedef struct {
24                                                        /* name of the interface */
25                const char *name;               
26                                                        /* optional description (to be used by chooser 'help' function etc.) */
27                const char *description;
28                                                        /* driver 'attach' function */
29                int                     (*attach_fn)(struct rtems_bsdnet_ifconfig*, int);
30} BSP_NetIFDescRec, *BSP_NetIFDesc;
31
32/* Return a pointer to the (static) list of network interface descriptions
33 * of this board.
34 *
35 * NOTES: A NULL value is returned if e.g., the board type cannot be determined
36 *        or for other reasons.
37 *        The 'description' field is optional, i.e., may be NULL.
38 *        The list is terminated by an element with a NULL name field.
39 *        The interfaces are listed in the order they are labelled.
40 */
41
42BSP_NetIFDesc
43BSP_availableNetIFs();
44
45/* Define this macro so applications can conditionally compile this API */
46#define BSP_HAS_MULTIPLE_NETIFS(x)      BSP_availableNetIFs()   
47
48/* Legacy macro; applications should use BSP_Available_NetIfs() to choose
49 * an interface and attach function.
50 */
51extern char BSP_auto_network_driver_name[20];
52#define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_auto_network_driver_name
53
54#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_auto_enet_attach
55
56/* This routine checks the name field passed in the 'ifconfig'.
57 * If the name is NULL or points to the BSP_auto_network_driver_name
58 * array, the routine checks all interfaces for an active link and
59 * attaches the first alive one.
60 * It also updates 'ifconfig' to reflect the chosen interface's name
61 * and attach function.
62 *
63 * If another name is passed in, the routine scans
64 * the available interfaces for that name and uses it, if found.
65 * Eventually, a default interface is chosen (provided that
66 * the board type is successfully detected).
67 *
68 * Note that only ONE interface chained into rtems_bsdnet_config
69 * may use the "auto" name.
70 *
71 */
72
73int
74BSP_auto_enet_attach(struct rtems_bsdnet_ifconfig *ifconfig, int attaching);
75
76#ifdef __cplusplus
77  }
78#endif
79
80#endif
Note: See TracBrowser for help on using the repository browser.