The following code shows the declaration of the variables and the initialization of the cfg_subsys_attr_t data structure for the if_el device driver:

static unsigned char el_pcmcia_optiondata[400] = ""; static unsigned char el_isa_optiondata[300] = ""; 2 static unsigned char el_unused[300] = "";

static int el_polling = 0; 3 static int el_pollint = 16; 4 static int el_configured = 0; 5

static struct lan_config_data el_data = { 6

LAN_CONFIG_VERSION_ID, 0,

&eldriver,

&el_configured

};

1

cfg_subsys_attr_t el_attributes[] = { 7

{"PCMCIA_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE CFG_OP_QUERY, (caddr_t)el_pcmcia_optiondata, 0, 400, 0}, 8

{"ISA_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE CFG_OP_QUERY, (caddr_t)el_isa_optiondata, 0, 300, 0}, 9

{"Polling", CFG_ATTR_INTTYPE, CFG_OP_QUERY CFG_OP_CONFIGURE, (caddr_t)&el_polling, 0, 1, sizeof(int)}, 10

{"Polls_Per_Second", CFG_ATTR_INTTYPE, CFG_OP_QUERY CFG_OP_CONFIGURE, (caddr_t)&el_pollint, 10, 100, sizeof(int)}, 11

{"", 0, 0, 0, 0, 0, 0} 12

};

1

Declares a character array called pcmcia_optiondata and initializes it to the null string. The pcmcia_optiondata character array is where the cfgmgr framework stores the value for the PCMCIA_Option attribute. The cfgmgr framework obtains this value from the /etc/sysconfigtab database.

2Declares a character array called isa_optiondata and initializes it to the null string. The isa_optiondata character array is where the cfgmgr framework stores the value for the ISA_Option attribute. The cfgmgr framework obtains this value from the /etc/sysconfigtab database.

3Declares an integer variable called el_polling and initializes it to the value 0 (zero). The el_polling variable is where the cfgmgr framework stores the style of interrupt processing for the Polling attribute. The cfgmgr framework obtains this value from the

/etc/sysconfigtab database.

4Declares an integer variable called el_pollint and initializes it to the value 16. The el_pollint variable is where the cfgmgr framework stores the polls per second for the Polls_Per_Second attribute. The cfgmgr framework obtains this value from the /etc/sysconfigtab database.

5

Declares an integer variable called el_configured and initializes it to the value 0 (zero). The driver must increment this variable for each successfully configured el device.

4–2Implementing the Configure Section

Page 56
Image 56
Compaq AA-RNG2A-TE manual Etc/sysconfigtab database