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