Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:51

0001 #ifndef BSP_BSDNET_ATTACH_INFO_H
0002 #define BSP_BSDNET_ATTACH_INFO_H
0003 
0004 /* Author: Till Straumann, 2005; see ../../LICENSE */
0005 
0006 /* Rationale: traditionally, BSPs only supported a single networking interface
0007  *            the BSP defined RTEMS_NETWORK_DRIVER_NAME & friends macros
0008  *            for applications to use.
0009  *            If more than one interface is present, this simple approach is
0010  *            not enough.
0011  *            Hence, this BSP exports a routine declaring all available interfaces
0012  *            so the application can make a choice.
0013  */
0014 
0015 #ifdef __cplusplus
0016   extern "C" {
0017 #endif
0018 
0019 /* Fwd. decl just in case */
0020 struct rtems_bsdnet_ifconfig;
0021 
0022 typedef struct {
0023                             /* name of the interface */
0024         const char *name;       
0025                             /* optional description (to be used by chooser 'help' function etc.) */
0026         const char *description;
0027                             /* driver 'attach' function */
0028         int         (*attach_fn)(struct rtems_bsdnet_ifconfig*, int);
0029 } BSP_NetIFDescRec, *BSP_NetIFDesc;
0030 
0031 /* Return a pointer to the (static) list of network interface descriptions
0032  * of this board.
0033  *
0034  * NOTES: A NULL value is returned if e.g., the board type cannot be determined
0035  *        or for other reasons.
0036  *        The 'description' field is optional, i.e., may be NULL.
0037  *        The list is terminated by an element with a NULL name field.
0038  *        The interfaces are listed in the order they are labelled.
0039  */
0040 
0041 BSP_NetIFDesc
0042 BSP_availableNetIFs(void);
0043 
0044 /* Define this macro so applications can conditionally compile this API */
0045 #define BSP_HAS_MULTIPLE_NETIFS(x)  BSP_availableNetIFs()   
0046 
0047 /* Legacy macro; applications should use BSP_Available_NetIfs() to choose
0048  * an interface and attach function.
0049  */
0050 extern char BSP_auto_network_driver_name[20];
0051 #define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_auto_network_driver_name
0052 
0053 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_auto_enet_attach
0054 
0055 /* This routine checks the name field passed in the 'ifconfig'.
0056  * If the name is NULL or points to the BSP_auto_network_driver_name
0057  * array, the routine checks all interfaces for an active link and
0058  * attaches the first alive one.
0059  * It also updates 'ifconfig' to reflect the chosen interface's name
0060  * and attach function.
0061  *
0062  * If another name is passed in, the routine scans
0063  * the available interfaces for that name and uses it, if found.
0064  * Eventually, a default interface is chosen (provided that
0065  * the board type is successfully detected).
0066  *
0067  * Note that only ONE interface chained into rtems_bsdnet_config
0068  * may use the "auto" name.
0069  *
0070  */
0071 
0072 int
0073 BSP_auto_enet_attach(struct rtems_bsdnet_ifconfig *ifconfig, int attaching);
0074 
0075 #ifdef __cplusplus
0076   }
0077 #endif
0078 
0079 #endif