|
|
Communication channels between regions are initialized with an array of udi_ops_init_t structures, one array element per channel. The udi_ops_init_t structure contains information the environment needs to create channel endpoints for a particular type of operations vector and control block usage. Each channel is initialized according to the specifications in the array element.
Once this array is initialized in the driver code, it's used in an init_info_t structure, which the UDI environment uses to initialize a driver instance (see ``Driver initialization structure'').
The udi_ops_init_t structure has these fields:
typedef void udi_op_t (void);typedef udi_op_t const udi_ops_vector_t ;
typedef struct { udi_index_t ops_idx ; udi_index_t meta_idx ; udi_index_t meta_ops_num ; udi_size_t chan_context_size ; udi_ops_vector_t *ops_vector ; } udi_ops_init_t ;
ops_idx
meta_idx
meta_ops_num
meta_idx
, that
uniquely identifies an operations vector type defined by that
metalanguage.
chan_context_size
ops_idx
is used to bind a
child or parent instance to a driver instance or to bind a secondary
region to the primary region for this driver.
If non-zero, the value must be at least sizeof(udi_chan_context_t)
(see
udi_chan_context_t(3udi))
and must not exceed UDI_MIN_ALLOC_LIMIT (see the discussion
of the init_context structure under
``Region data definitions'').
ops_vector
ops_vector
.
The udi_cmos and pseudod drivers define these channel operation initialization arrays:
cmos_udi.c sample code (cont.) |
---|
/* * -------------------------------------------------------------------- * Meta operations init section: * -------------------------------------------------------------------- */ static udi_ops_init_t udi_cmos_ops_init_list[] = { { GIO_OPS_IDX, CMOS_GIO_META, /* meta index * [from udiprops.txt] */ UDI_GIO_PROVIDER_OPS_NUM, 0, /* no channel context */ (udi_ops_vector_t *)&cmos_gio_provider_ops, cmos_default_op_flags /* op_flags */ }, { BUS_DEVICE_OPS_IDX, CMOS_BRIDGE_META, /* meta index * [from udiprops.txt] */ UDI_BUS_DEVICE_OPS_NUM, 0, /* no channel context */ (udi_ops_vector_t *)&cmos_bus_device_ops, cmos_default_op_flags /* op_flags */ }, #if DO_INTERRUPTS { INTR_HANDLER_OPS_IDX, CMOS_BRIDGE_META, /* meta index * [from udiprops.txt] */ UDI_INTR_HANDLER_OPS_NUM, 0, /* no channel context */ (udi_ops_vector_t *)&cmos_intr_handler_ops, cmos_default_op_flags /* op_flags */ }, #endif /* DO_INTERRUPTS */ { 0 /* Terminator */ } }; |
pseudod.c sample code (cont.) |
static udi_ops_init_t pseudo_ops_init_list[] = { { PSEUDO_GIO_INTERFACE, PSEUDO_GIO_META, /* meta index */ UDI_GIO_PROVIDER_OPS_NUM, /* meta ops num */ 0, /* chan context size */ (udi_ops_vector_t *) & pseudo_gio_provider_ops, /* ops vector */ pseudo_default_op_flags }, { PSEUDO_BUS_INTERFACE, PSEUDO_BUS_META, /* Bus meta index [from udiprops.txt] */ UDI_BUS_DEVICE_OPS_NUM, 0, /* channel context size */ (udi_ops_vector_t *) & pseudo_bus_device_ops, pseudo_default_op_flags }, { 0} }; |
The two sample drivers define similar operation vectors for the GIO provider operations defined in ``GIO metalanguage entry points'' and for the bus device role operations defined in ``Bus bridge metalanguage entry points''. The udi_cmos code also provide an optional set of interrupt handling operations. See the element descriptions above.
The chan_context_size
is ``0'' for each vector,
as required by the UDI Core Specification.
A lone ops_idx
of ``0'' terminates each list.
For more on how these structures are used during driver initialization, see ``Driver initialization structure''.