SPI Programming Manual (G06.24+, H06.03+, J06.03+)

SPI Programming in C
SPI Programming Manual427506-006
6-2
Declarations Needed in C Programs
In these definition files, the structures are in lowercase (for example, zspi-ddl-ssid-def)
and the defines are in uppercase (for example, ZSPI-TKN-SSID).
The
#include directive for ZSPIDEF.ZSPIC must appear first. Any #include directives
for files that contain your own declarations must come after the
#include directives for
the standard files.
The DDL compiler combines the items of a DDL REDEFINES clause into a union. For
more information, see the
Data Definition Language (DDL) Reference Manual
.
Declarations Needed in C Programs
In addition to the declarations provided in the definition files, you must add these
declarations to your C programs.
SPI Buffer
The ZSPIDEF.subsysC definition file for each NonStop Kernel subsystem includes a
buffer declaration named
subsys_ddl_msg_buffer_def. Use this declaration to
allocate a buffer variable of the recommended size (
subsys_val_buflen):
zpwy_ddl_msg_buffer_def spibuf;
This declaration is for the Pathway subsystem. It lets you refer to the z_msgcode (-
28),
z_buflen, and z_occurs fields of this structure.
Some subsystems provide additional buffer declarations allocating different
recommended buffer-size values for different commands. For details, see the individual
subsystem management programming manual.
If you wish to define a buffer larger than the recommended size to handle a large
number of response records in a reply, you can write your own buffer declaration,
following the pattern of
subsys_ddl_msg_buffer_def.
Subsystem ID
You must initialize the subsystem ID before the first time you call SSINIT. For NonStop
Kernel subsystems, the name of the subsystem ID structure in the C definition file is
subsys_val_ssid_def. To initialize it, use these values:
ZSPI_VAL_TANDEM for the z_owner field
ZSPI_SSN_subsys for the z_number field
ZSPI_VAL_VERSION for the z_version field
C provides two ways to initialize this structure.
The first way (for the OSI/AS subsystem, for example):
zosi_val_ssid_def zosi_val_ssid ={ ZSPI_VAL_TANDEM,
ZSPI_SSN_ZOSI,
ZOSI_VAL_VERSION };