|
|
Control block arrays specify the structure of the control block for each channel operation. There is a one-to-one correspondence between elements in the control block array and the elements of the channel operations vector.
Control blocks passed into a region from another region contain ``per-request data'', whose scope is contained to the channel operation request. The ownership of these per-request data objects is transferred to the target region on the channel; the source region has no access to them once they are transferred. No assumptions about their content can be made on return from the operation.
Control blocks are referred to by an index, and are intialized as part of the uid_init_info per-driver intialization structure (see ``Driver initialization structure''). The indexes and structures for the sample drivers are shown below.
cmos_udi.c sample code (cont.) |
---|
/* * CB indexes for each of the types of control blocks used. */ #define GIO_BIND_CB_IDX 1 #define GIO_XFER_CB_IDX 2 #define GIO_EVENT_CB_IDX 3 #define BUS_BIND_CB_IDX 4 #if DO_INTERRUPTS #define INTR_ATTACH_CB_IDX 5 #define INTR_EVENT_CB_IDX 6 #endif |
pseudod.c sample code (cont.) |
#define PSEUDO_GIO_XFER_CB_IDX 1 /* Generic xfer blk for udi_gcb_init */ #define PSEUDO_BUS_BIND_CB_IDX 2 |
All control blocks are initialized using an array of udi_cb_init_t structures, using the control block indexes as indexes into the array.
typedef struct { udi_index_t cb_idx ; udi_index_t meta_idx ; udi_index_t meta_cb_num ; udi_size_t scratch_requirement ; udi_size_t inline_size ; const udi_layout_t *inline_layout ; } udi_cb_init_t ;
For the sample drivers, the cb_idx
definitions are shown above.
The meta_idx
members are populated using defined constants from the
build instructions section of udiprops.txt (see
``Build instructions'').
The type of the control block is specified by the meta_cb_num
element,
a ``control block group number'' from the UDI Specifications.
The meta_idx and meta_cb_num, taken together,
specify a control block structure type defined for a particular metalanguage.
For example, in the udi_cmos sample,
a meta_idx of CMOS_GIO_META points to the GIO
metalanguage defined in the Core Specification, and a meta_cb_num
of UDI_GIO_XFER_CB_NUM specifies the control block for GIO
transfer operations,
udi_gio_xfer_cb_t(3udi).
This is used later in the driver's child channel operations
(see
``udi_cmos child channel operations'').
Scratch space requirements for the udi_cmos driver are given using the constants defined earlier (see ``Scratch space, offsets, and requirements''). The pseudod driver uses no scratch space, so gives its requirements as zero.
The next two elements of the control block intialization structure, inline_size and inline_layout, may contain size and layout information for ``inline data'' in the control block. This is data particular to a channel operation that is local to the operation (called ``per-request data'' in ``Control block indexes and structures'').
For example, in the pseudod sample driver, the first control block
definition above specifies inline data size and layout information for the
udi_gio_xfer_cb_t control block type specified in the control block
initialization structure udi_cb_init_t.
The layout is specified using the udi_layout_t
type prior to the
control block intialization structure definition in the source,
The layout uses UDI fundamental types, and is specific to the channel operation.
See
``Channel operation data layouts''.