Compaq AA-RNG2A-TE manual Declaring softc and controller Data Structure Arrays

Models: AA-RNG2A-TE

1 159
Download 159 pages 42.56 Kb
Page 24
Image 24

4

Declares a pointer to the external task_t data structure called first_task. The task_t data structure is an opaque data structure; that is, all of its associated members are referenced and manipulated by the Tru64 UNIX operating system and not by the user of kernel threads. Every kernel thread must be part of a task.

The if_el driver’s el_probe interface uses this data structure when it creates a kernel thread.

1.2.2 Declaring softc and controller Data Structure Arrays

The following code shows the declarations for the el_softc and controller data structure arrays. The system uses these arrays to find out which softc and controller data structures are associated with a specific 3Com 3C5x9 device. The driver’s el_probe interface initializes these arrays if the probe operation is successful.

The arrays of el_softc and controller data structures need to be static for the if_el device driver. Be aware that static arrays fix the maximum number of devices that the user can configure on the system.

#define el_MAXDEV 7 1

static struct el_softc *el_softc[el_MAXDEV]={0}; static struct controller *el_info[el_MAXDEV]={0};

2

3

static int el_isa_tag = 0; 4 static int el_isa_reset = 0; 5

decl_simple_lock_info(static, el_lock_info);

6

1

2

3

4

5

6

Defines a constant called el_MAXDEV, which allocates data structures that the if_el device driver needs. A maximum of seven instances of the 3C5x9 controller can be on the system. This means that el_MAXDEV is the maximum number of controllers that the if_el driver can support. This is a small number of instances of the driver, and the data structures themselves are not large, so it is acceptable to allocate for the maximum configuration.

Declares an array of pointers to el_softc data structures and calls it el_softc. The el_MAXDEV constant specifies the size of this array.

Declares an array of pointers to controller data structures and calls it el_info. The el_MAXDEV constant specifies the size of this array.

Declares a variable called el_isa_tag and initializes it to the value 0 (zero). The if_el driver’s el_isa_activate interface uses this variable.

Declares a variable called el_isa_reset and initializes it to the value 0 (zero). The if_el driver’s el_probe interface uses this variable.

Uses the decl_simple_lock_info( ) routine to declare a simple lock data structure called el_lock_info.

1–6Network Device Driver Environment

Page 24
Image 24
Compaq AA-RNG2A-TE manual Declaring softc and controller Data Structure Arrays