External and forward declarations (Section 1.2.1)

Declaration of softc and controller data structure arrays (Section 1.2.2)

Declaration of the driver data structure (Section 1.2.3)

Definitions of driver-specific macros (Section 1.2.4)

The following sections discuss each of these categories of declarations, using the if_el device driver as an example.

The declarations section also contains the definition of the softc data structure and declarations for configure-related variables and data structures. Chapter 3 discusses the definition of a network driver’s softc data structure. Section 4.1 discusses the declarations that are related to configuration.

1.2.1 External and Forward Declarations

The following code shows the external and forward declarations for the if_el device driver:

int el_configure(cfg_op_t, cfg_attr_t *, size_t, cfg_attr_t *, size_t);

static int

el_probe (io_handle_t, struct controller *);

2

 

static int

el_attach(struct controller *);

static int

el_unattach(struct bus *, struct controller *);

static int

el_init_locked(struct el_softc *, struct ifnet *, int);

static int

el_init(int);

 

 

 

 

 

 

static void

el_start_locked(struct el_softc *, struct ifnet *);

static void

el_start(struct ifnet *);

static int

el_watch(int);

 

 

 

 

 

 

static void

el_reset_locked(struct el_softc *, struct ifnet *, int);

static void

el_reset(int);

 

 

 

 

 

 

static int

el_ioctl(struct ifnet *, u_int, caddr_t);

static int

el_intr(int);

 

 

 

 

 

 

static void

el_rint(struct el_softc *, struct ifnet *);

static void

el_tint(struct el_softc *, struct ifnet *);

static void

el_error(struct el_softc *, struct ifnet *);

static void

el_shutdown(struct el_softc *);

static void

el_card_remove(int, struct el_softc *);

static int

el_isa_reset_all(io_handle_t, int *, struct controller *);

static int

el_isa_activate(io_handle_t, int *, struct controller *);

static unsigned short el_isa_read_offset(io_handle_t, int);

static void

el_wait(struct el_softc *);

static void

el_autosense_thread(struct el_softc *);

static int

el_card_out(struct el_softc *);

extern struct timeval time;

 

3

 

 

 

 

 

 

 

 

 

 

extern task_t first_task;

 

4

 

 

 

 

 

1

1

2

3

Declares the function prototype definitions for all exported functions.

Declares the driver interfaces for the if_el device driver.

Declares the external timeval data structure called time. Various ioctl commands use this data structure.

Network Device Driver Environment 1–5

Page 23
Image 23
Compaq AA-RNG2A-TE manual External and Forward Declarations