source: libbsdport/bsd_eth_drivers/libbsdport/libbsdport_api.h @ a8bf95d

B_20100615baselibbsdport-4-10-branch
Last change on this file since a8bf95d was a8bf95d, checked in by Till Straumann <strauman@…>, on Apr 22, 2009 at 10:06:58 PM
  • importing updated version from SLAC as of 20090422
  • Property mode set to 100644
File size: 2.4 KB
Line 
1#ifndef LIBBSDPORT_API_H
2#define LIBBSDPORT_API_H
3
4#include <rtems.h>
5#include <rtems/rtems_bsdnet.h>
6
7/* $Id$ */
8
9/* User API to libbsdport driver attach function, driver table etc. */
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15typedef struct driver driver_t;
16
17/* NULL terminated list of all drivers configured into the system.
18 * To be defined by the application.
19 */
20extern driver_t *libbsdport_netdriver_table[];
21
22/* Drivers ported so far: */
23/* Intel E1000 chips */
24extern driver_t libbsdport_em_driver;       
25/* AMD 79C971..976 pcnet PCI */
26extern driver_t libbsdport_pcn_driver;
27/* AMD/Lance older (and later) chips; this driver also supports what 'pcn'
28 * does but might not be as efficient.
29 * NOTE: The 'le_pci' driver works with the pcnet32 (79C970A) emulation
30 *       of qemu.
31 */
32extern driver_t libbsdport_le_pci_driver;
33
34
35/* Generic driver attach function (can be used in rtems_bsdnet_ifconfig).
36 * This routine selects a driver/device combination based on
37 *  - drivers available / listed in libbsdport_netdriver_table[];
38 *  - devices detected in PCI config space compatible with a listed
39 *    driver.
40 *  - name and unit specified in the rtems_bsdnet_ifconfig.name field
41 *    (empty name: "" is a wildcard).
42 *
43 * E.g. assume that
44 *  1) the 'em' and 'pcn' drivers are listed in the table.
45 *  2) a AMD Am79C973 chip is somewhere on the PCI bus
46 *  3) ifconfig name is ""
47 *  -> the 'pcn' driver is selected and the only AMD chip present
48 *     is used as 'pcn1'.
49 *  -> If the name was 'em' or 'pcn2' no device would be found
50 *     (no em device found; no 2nd pcn device found).
51 *
52 * Now assume that you have a 82544 and two AMD 79C973 devices:
53 *
54 *  name: ""     picks the first of the three chips found in PCI space
55 *  name: "pcn"  picks the first AMD chip found
56 *  name: "em"   picks the first (and only) 82544
57 *  name: "pcn2" picks the second AMD chip
58 *
59 * Also, it is possible to specify a PCI-triple: <busno>:<slotno>.<fnno>
60 * i.e., name: "2:3.0" tries to find a driver that supports the device
61 * at bus #2, slot #2.
62 *
63 * NOTE: detaching a driver is not supported (since rtems bsdnet cannot detach
64 * an interface).
65 */
66int
67libbsdport_netdriver_attach(struct rtems_bsdnet_ifconfig *cfg, int attaching);
68
69/* Print information about all attached drivers to FILE (stdout if NULL)
70 *
71 * RETURNS: number of devices attached so far.
72 *
73 * BUGS:    more info should be printed.
74 */
75int
76libbsdport_netdriver_dump(FILE *f);
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif
Note: See TracBrowser for help on using the repository browser.