HostService Objects
Introduction
A HostService object allows users to synchronize their application to the "heartbeat" of the controller. It can be useful to monitor the health of the DSP, as a deterministic non-busy application delay, or even to modify SynqNet packets in real-time.
XMP and ZMP-SynqNet series motion controllers have the ability to interrupt the host at a specified frequency, where the frequency is a multiple of the controller’s sample rate. This board-to-host interrupt is referred to as the Sync Interrupt. This object spawns a thread, which waits for the Sync Interrupt and then executes a user defined Sync Interrupt Service Routine (or SISR) in the user space.
The primary use for the HostService object is for host systems that need to process incoming SynqNet data from the controller and then write data back to the controller before a SynqNet transmission occurs. This is a convenient way to calculate control loops or inject values into SynqNet data packets in real-time. This type of operation will usually require a real-time operating system (VxWorks and RTX/RTSS).
The controller also has an optional watchdog timer, named the HostProcessFlag, which verifies that data written by the SISR is valid before it's sent over the SynqNet network.
The hostService object is provided as an interface to the Sync Interrupt feature. It provides code for thread-creation/deletion, setting/clearing the HostProcessFlag, and other common operations required for proper Sync Interrupt processing.
For more information about Sync Interrupt, please see the Sync Interrupt page.
Note: The HostService object is not part of the standard MPI. In order to use the Service Object, the apputil.h file needs to be included by your code and the apputil library needs to be linked to your application. In addition, thread handling is something that is different on every operating system. Therefore, HostService objects may have different behaviors on different operating systems. Programmers that are experienced in multi-threaded application programming may want to program their own host service SISR threads. The source-code for this object is available in the (c:\MPI)\apputil project directory.
WARNING: Using the hostService object simultaneously with an interrupt-driven EventMgr service thread under Windows is not currently supported. However, using a polling EventMgr service thread at the same time as the hostService object is supported.
Methods
Create, Delete, Validate Methods | ||
hostServiceCreate | Create a HostService object, an SISR thread, and attach a serviceFunction for a given Control object. | |
hostServiceDelete | Stop SISR thread and delete the HostService object. |
Configuration and Information Methods | ||
hostServiceEnable | Enable or disable the HostService SIST thread from executing the serviceFunction. Disabled by default. | |
hostServiceStatus | Returns status structure for HostService object. |
Data Types
HostServiceFunction | ||
HostServiceStatus |