|
|
The udi_init_info, or driver initialization, structure is used by the UDI environment to link a newly loaded driver into the kernel, to launch new instantiations of a loaded driver, and to manage the regions, operations data, and other aspects of already instantiated drivers.
The udi_init_info structure contains pointers to constant information the environment needs to initialize a driver. Each driver module must include a constant initialized structure of type udi_init_t named udi_init_info.
Exactly one module in a multi-module driver must be the primary module, identified in the driver's udiprops.txt file as the module with a region declaration for region index zero, which identifies the primary region.
The udi_cmos and pseudod sample drivers provide very similar udi_init_info structures, though the underlying data is quite different.
The following figure shows the udi_init_info structure as defined in the Core Specification, along with the sample driver definitions.
udi_init_t from the Core Specification; |
---|
typedef struct { const udi_primary_init_t *primary_init_info ; const udi_secondary_init_t *secondary_init_list ; const udi_ops_init_t *ops_init_list ; const udi_cb_init_t *cb_init_list ; const udi_gcb_init_t *gcb_init_list ; const udi_cb_select_t *cb_select_list ; } udi_init_t ; T}cmos_udi.c sample code (cont.); T{ udi_init_t udi_init_info = { &udi_cmos_primary_init_info, NULL, /* secondary_init_list */ udi_cmos_ops_init_list, udi_cmos_cb_init_list, NULL, /* gcb_init_list */ NULL /* cb_select_list */ }; |
pseudod.c sample code (cont.); |
udi_init_t udi_init_info = { &pseudo_primary_init, NULL, /* Secondary init list */ pseudo_ops_init_list, pseudo_cb_init_list, NULL, /* gcb init list */ NULL /* cb select list */ }; |
The elements of the udi_init_info structure include by reference the region, operation, control block, and other data defined previously in the driver code, as shown in the descriptions below.
region_idx
,
and a NULL pointer is treated the same as a list with only
one entry containing a zero region_idx
.
Both the udi_cmos and pseudod drivers
define a single module with a single region, and so this element
is NULL for both drivers.
The subject of secondary regions is treated in the description of the
sample NIC driver; see
``Network Driver Coding Specifics''.
ops_idx
.
This list must include at least one entry for each metalanguage used
in this module.
ops_init_list is a pointer to a list of structures containing
information about channel operations usage for each operations vector
implemented in this module.
The list is terminated with an entry containing a zero ops_idx
.
The channel operations initialization lists for the
udi_cmos and pseudod drivers
were defined earlier in the driver code; see
``Channel operations initialization''
for a description.
cb_init_list
is a pointer to a list of structures containing
information about each control block type used by this module.
The list is terminated with an entry containing a zero cb_idx
,
and NULL pointer is treated the same as a list with only
one entry containing a zero cb_idx
.
The control block initialization lists for the
udi_cmos and pseudod drivers
were defined earlier in the driver code; see
``Control block indexes and structures''
for a description.
gcb_init_list
is a pointer to a list of structures containing
information about generic control block usage in this module, if any.
Generally, these are control blocks used only for asynchronous environment
service calls, such as
udi_mem_alloc(3udi).
The list is terminated with an entry containing a zero cb_idx
,
and a NULL pointer is treated the same as a list with only
one entry containing a zero cb_idx
.
The sample UDI drivers do not use gcb_init_list
; see
udi_init_info(3udi)
for more information.
cb_select_list
is a pointer to a list of structures containing
information about special overrides for scratch requirements when
using specific control blocks with specific operations vectors.
The list is terminated with an entry containing a zero cb_idx
,
and a NULL pointer is treated the same as a list with only
one entry containing a zero cb_idx
.
The sample UDI drivers do not use cb_select_list
; see
udi_cb_init_t(3udi)
and
udi_cb_select_t(3udi)
for more information.