The main objective of the dual-port memory interface of the Hilscher data card is to be able to handle different devices with different protocols on a single hardware platform. Depending on the installed device and protocol there are two different data transfer possibilities between the Host (PC application) and device (communication interface or module) they are:
Message oriented: consists of two mailboxes for sending and receiving commands and telegrams of acyclic information.
Process image:consists of direct access to the input and output data coming from and going to the peripheral device.
The message oriented data transfer is available for all device types. This allows diagnostic programs and tools to communicate with the real time operating system to get status or firmware information.
The process image on the other hand is not available for all device implementations. If it’s available the dual port memory is enlarged to 2 or even 8 KByte. The process image memory area is placed below the message interface area’s bytes.
The control bits used for synchronization of data and message handling are contained in the last two bytes of the dual port memory.
Message orientated data Communication:
The unique data structure of a message consists of an 8 byte header, an optional 8 byte telegram header and a maximum of 247 bytes of user data. The message header structure is fixed and constant and is used by the devise operating system for transport and message addressing. The telegram header defines the actions that need to be taken by the protocol task if necessary. The user data contains the send and receive portion of data. This message structure gets defined within the RCS_USER.H file.
If the Host application wants to send a message it will load the message data into the sent mailbox portion of the dual-port memory and set one of the device flags. The device will then take the message and place it in an output message buffer queue for processing and set a host acknowledgment flag. The message will then get processed and sent out by the device on a first come first serve principle. If the device on the other hand will place a received message in the incoming message buffer queue for processing. If the message gets to the front of the queue the device paces it into the message mailbox portion of the dual-port memory and sets a host flag. The Host will then process the incoming message and set a device acknowledgment flag. This is the sequence of events for every sent and received message.
The process Image IO Communication:
For certain device implementations there are a process image available in the dual-port memory. The access of the process image is the same for master and slave devises. Several handshake modes can be selected by the host user application, the user also has the option to read and write without any synchronization or handshaking.
The available handshake modes:
- Direct data transfer, Device controlled: Typically for slave system where data transfer must be guaranteed for every master cycle.
- Buffered Data Transfer, Device controlled: Typically for slave system where the device gets an interrupt with every data exchange cycle.
- Uncontrolled direct data transfer: Typically for testing some IO devices with a simple application that requires no handshaking.
- Host controlled, Buffered data transfer: Typically for master and slave systems that need guaranteed consistence of the complete process image.
- Host controlled, direct data transfer: Typically for master system with a synchronous IO device.
- Extended Host controlled, Buffered data transfer