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

General SPI Programming Guidelines
SPI Programming Manual427506-006
5-8
Writing High-Level Procedures
Writing High-Level Procedures
The SPI procedures provide basic functionality for building and decoding SPI buffers. If
your application performs some commands frequently, you might want to simplify your
programming task by writing high-level procedures that themselves call on the SPI
procedures.
High-level procedures you write can provide some of the parameters needed by the
SPI procedures, do error checking and recovery, format SPI buffers for commonly
needed commands in one procedure call, or even both format and send commonly
needed commands in a single call.
In deciding whether to write your own high-level procedures, and in determining what
functions they perform if you decide to write them, consider the tradeoff between ease
of programming and flexibility. High-level procedures are most likely to be useful if your
application performs the same, or very similar, complex SPI buffer operations
repeatedly.
As part of EMS, HP provides two sets of high-level procedures for use in formatting
and decoding event-message buffers. For more information about these procedures,
see the
EMS Manual
.
Guidelines for SPI Requesters
This overview shows what your application must do to send commands to a NonStop
Kernel subsystem and process the responses:
1. Start the appropriate management process for the subsystem, if this process is not
already running.
2. Open the subsystem manager process and do whatever else is needed to
establish communication with it, such as sending the startup message if you are
programming in TAL.
3. Initialize and build the command buffer using the SPI procedures.
4. Send the command to the subsystem.
5. Receive the response from the subsystem.
6. Extract response information from the response buffer using the SPI procedures.
7. Take any appropriate action. If necessary, go back to step 3 to build another
command buffer and repeat the cycle.
8. Close the management process.
9. Stop the management process, if necessary.