1 #ifndef RTEMS_COMPAT1_BSD_NET_H 2 #define RTEMS_COMPAT1_BSD_NET_H 8 #include <netinet/in.h> 9 #include <netinet/if_ether.h> 16 struct NET_SOFTC d_softc;
24 struct rtems_bsdnet_ifconfig *d_ifconfig;
27 #define THEDEVS NET_EMBEMB(the_,NETDRIVER_PREFIX,_devs) 28 #define NETDEV_DECL netdev_t THEDEVS[NETDRIVER_SLOTS] 36 void (*n_intr)(
void *);
40 net_dev_get(
struct rtems_bsdnet_ifconfig *
config)
45 unitNo = rtems_bsdnet_parse_driver_name(
config, &unitName);
49 if ( unitNo <=0 || unitNo > NETDRIVER_SLOTS ) {
50 device_printf(dev,
"Bad "NETDRIVER
" unit number.\n");
54 if ( THEDEVS[unitNo-1].d_unit && THEDEVS[unitNo-1].d_unit != unitNo ) {
55 device_printf(dev,
"Unit # mismatch !!??\n");
59 THEDEVS[unitNo-1].d_unit = unitNo;
60 THEDEVS[unitNo-1].d_name = unitName;
61 THEDEVS[unitNo-1].d_ifconfig =
config;
63 return &THEDEVS[unitNo - 1];
68 softc_get_device(
struct NET_SOFTC *sc)
73 static inline struct NET_SOFTC *
75 {
return &dev->d_softc; }
79 {
return dev->d_unit; }
83 {
return dev->d_name; }
86 if_initname(
struct ifnet *ifp,
char *name,
int unit)
93 device_set_desc(
netdev_t *dev,
char *str)
99 device_set_desc_copy(
netdev_t *dev,
char *str)
101 dev->d_desc = strdup(str);
108 return dev->d_softc.arpcom.ac_if.if_addrlist && dev->d_softc.arpcom.ac_if.if_init;
112 #include NETDRIVER_PCI 115 static inline unsigned 116 pci_read_config(
device_t dev,
unsigned addr,
unsigned width)
121 struct NET_SOFTC *sc = device_get_softc(dev);
123 case 1: pci_read_config_byte(sc->b, sc->d, sc->f, addr, &b);
125 case 2: pci_read_config_word(sc->b, sc->d, sc->f, addr, &s);
127 case 4: pci_read_config_dword(sc->b, sc->d, sc->f, addr, &d);
136 pci_write_config(
device_t dev,
unsigned addr,
unsigned width,
unsigned val)
138 struct NET_SOFTC *sc = device_get_softc(dev);
140 case 1: pci_write_config_byte(sc->b, sc->d, sc->f, addr, val);
142 case 2: pci_write_config_word(sc->b, sc->d, sc->f, addr, val);
144 case 4: pci_write_config_dword(sc->b, sc->d, sc->f, addr, val);
152 static inline unsigned short 155 return pci_read_config(dev, PCIR_VENDOR, 2);
158 static inline unsigned short 161 return pci_read_config(dev, PCIR_DEVICE, 2);
164 static inline unsigned short 167 return pci_read_config(dev, PCIR_SUBVEND_0, 2);
170 static inline unsigned short 173 return pci_read_config(dev, PCIR_SUBDEV_0, 2);
184 pci_read_config(dev, PCIR_COMMAND, 2)
185 | PCIM_CMD_BUSMASTEREN);
188 #define mtx_init(a,b,c,d) do {} while(0) 189 #define mtx_initialized(ma) (1) 190 #define mtx_destroy(ma) do {} while(0) 191 #define mtx_lock(a) do {} while(0) 192 #define mtx_unlock(a) do {} while(0) 193 #define mtx_assert(a,b) do {} while(0) 195 #define callout_handle_init(x) do {} while (0) 196 #define untimeout(a...) do {} while (0) 198 #if !ISMINVERSION(4,6,99) 199 #define pci_bus_count BusCountPCI 210 __ether_ifdetach(
struct ifnet *ifp)
215 ifp->if_watchdog = 0;
Definition: deflate.c:115
Definition: rtemscompat1.h:15
Definition: rtemscompat1.h:32