CifX Device Driver - IntervalZero RTX DRV 06 en

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Driver Manual

cifX Device Driver


IntervalZero RTX®
V8.1 / 2009 / 2011 / 2012 / RTX64

Hilscher Gesellschaft für Systemautomation mbH


www.hilscher.com
DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public
Introduction 2/35

Table of Contents
1 Introduction.............................................................................................................................................3
1.1 About this Document......................................................................................................................3
1.2 List of Revisions .............................................................................................................................3
1.3 Overview ........................................................................................................................................4
1.4 Requirement...................................................................................................................................5
1.5 Supported Hardware ......................................................................................................................5
1.6 Features .........................................................................................................................................5
1.7 Limitations ......................................................................................................................................5
1.8 CD Contents...................................................................................................................................6
1.9 Terms and Abbreviations ...............................................................................................................7
1.10 References to Documents..............................................................................................................7
1.11 Legal Notes ....................................................................................................................................8
1.11.1 Copyright ........................................................................................................................................... 8
1.11.2 Important Notes................................................................................................................................. 8
1.11.3 Exclusion of Liability .......................................................................................................................... 9
1.11.4 Export ................................................................................................................................................ 9
1.11.5 Registered Trademarks ..................................................................................................................... 9
2 Installation.............................................................................................................................................10
2.1 Annotations to Interrupt Support ..................................................................................................13
2.2 Device Configuration....................................................................................................................14
2.2.1 Firmware and Configuration File Storage ........................................................................................ 14
2.2.2 Guideline to Create a Device Configuration .................................................................................... 16
2.2.3 Providing the Configuration for RTX2009/2011/2012/RTX64 .......................................................... 17
2.2.4 Providing the Device Configuration for RTX 8.1 .............................................................................. 17
2.2.5 Description of the Device Configuration File.................................................................................... 18
3 Shared Memory Extension ..................................................................................................................20
3.1 Restrictions ..................................................................................................................................21
3.2 Installation ....................................................................................................................................22
3.3 Using the Shared Memory Service ..............................................................................................23
4 Driver Specific Information .................................................................................................................24
4.1 Additional Structures ....................................................................................................................24
4.1.1 Structure RTX_CIFXDRV_PARAMETERS_T ................................................................................. 24
4.1.2 Structure RTX_CIFXDRV_DEVICEENTRY_T ................................................................................ 25
4.1.3 Structure RTX_CIFXDRV_DEVICEBUSINFO_T............................................................................. 25
4.2 Additional functions ......................................................................................................................26
4.2.1 cifXInitDriver().................................................................................................................................. 26
4.2.2 cifXDeinitDriver() ............................................................................................................................. 27
4.2.3 cifXFindDevice() .............................................................................................................................. 28
4.2.4 cifXGetDriverVersion()..................................................................................................................... 29
4.3 Driver Startup Procedure .............................................................................................................30
4.4 Driver Log File..............................................................................................................................31
5 Programming with the Driver ..............................................................................................................32
6 Frequently Asked Questions...............................................................................................................33
7 Appendix ...............................................................................................................................................34
7.1 List of Tables................................................................................................................................34
7.2 List of Figures...............................................................................................................................34
7.3 Contact .........................................................................................................................................35

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 3/35

1 Introduction
1.1 About this Document
This manual describes the Hilscher cifX Device Driver for IntervalZero RTX® and its architecture.
The driver offers access to the Hilscher netX based hardware with the same functional API as the
cifX device driver for Windows® and offers transparent access to the different devices.
IntervalZero’s RTX® software is a Real Time eXtension for the Windows operating sytstem.
The Hilscher RTX® driver is represented as a dynamic loadable library, which supports different
netX based hardware designs. First design is a cifX PCI/PCIe bus based PC card. This card is not
using any FLASH memory and the driver is responsible to download the necessary firmware and
configuration files during the startup phase of the hardware, to get the boards in operational mode.
The second type of hardware, which is supported by the driver, is the NXSB-PCA and NX-PCA-
PCI boards. These boards enable the connection of a NXSB 100 / NXHX board to the PCI bus. In
addition, to the PCI based hardware, the driver also supports devices, connected via the ISA bus.

1.2 List of Revisions


Rev Date Name Chapter Revisions
1 2009-07-23 SS created
2 2009-09-08 SS 6 Chapter 'Frequently Asked Questions' added
3 2010-06-09 SS 2.2 Support for DMA mode
2.2, 2.2.1 Support for loadable modules
2.2, 5 Note about use of registry file added
4.2 Return types of additional functions adapted to stdint data types
2.2, 2.2.1, 6 Slot number support
2.2 NXPCA-PCI Timings parameter support
4 2011-10-21 SS/RM 1.5 Support for netJACK 100
2 Guideline for device configuration revised
2.2, 2.1.x Support for RTX 2011
- Device configuration is obtained directly from windows registry
5 2013-01-28 SS/RM 1.10 Added information about CIFX API manual
1.4, 1.8, 4.1 Information about cifX driver for RTX 2012 included
2.2 cifX driver for RTX2009 now supports direct registry access
2 Add description for new setup application
6 2013-12-13 SS 1, 2 Support for RTX64
3 New chapter: Shared Memory Extension introduced (Windows access)
4.4 Log file support added
Table 1: List of Revisions

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 4/35

1.3 Overview
The cifX Device Driver for IntervalZero RTX® is available as a dynamic library built around the cifX
Toolkit. Any application which needs to access a cifX device can use the device specific functions
provided by this driver library. The dynamic library is implemented as a RTDLL, which is the analog
of an explicitly loaded windows DLL. User processes on RTX till version 2012 gain access to the
cifX driver functions by using the LoadLibrary() and GetProcAddress() calls (explicit library load).
As RTX64 provides its own image loader, the driver library can also be loaded implicitly here. The
concept of the cifX device driver is illustrated in the following figure.

Figure 1: cifX Device Driver Architecture

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 5/35

1.4 Requirement
 IntervalZero RTX® version 8.1, 2009(SP2 Update 1 or higher), 2011, 2012 or RTX64
 cifX Device Driver for Windows® 8/7/Vista/XP/2000
 Microsoft Visual 2005 or higher for driver test /cifX TCP Server application
 Microsoft Visual 2010 for driver test /cifX TCP Server application on RTX64

1.5 Supported Hardware


 cifX board (PCI / PCIe)
 netPLC
 NXSB-PCA / NXSB100 / NXHX board
 NX-PCA-PCI / NXHX
 CIFX 104 (ISA)
 netJACK 100

1.6 Features
 Based on the cifX Toolkit source (V1.1.4.0)
 Interrupt support for cifX boards
 DMA data transfer for I/O data
 Support for loadable modules
 Interrupt notification for applications
 64 bit support on RTX64 only

1.7 Limitations
 Only one RTX® process can use the driver at the same time
 Only little-endian hosts supported
 No DMA support for NXSB-PCA, NX-PCA-PCI and CIFX104

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 6/35

1.8 CD Contents
Folder Content

API cifX Driver API

Documentation Driver documentation

Driver Driver runtimes

RTX 8.1 Driver runtimes for RTX 8.1

RTX 2009 Driver runtimes for RTX 2009

RTX 2011 Driver runtimes for RTX 2011

RTX 2012 Driver runtimes for RTX 2012

RTX64 Driver runtimes and setup information file for RTX64

Examples Examples

Example Configuration File Example card configuration registry file

Test Application Source code for driver test application

cifXTCPServer Source code for cifX TCP Server application

Installation Driver setup

SharedMemory Extension Shared Memory Extension for accesses from windows environment
Table 2: CD Contents

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 7/35

1.9 Terms and Abbreviations


Term Description
cifX Communication Interface based on netX
comX Communication Module based on netX
PCI Peripheral Component Interconnect
API Application Programming Interface
DPM Dual-Port-Memory
Physical interface to all communication board (DPM is also used for PROFIBUS-DP Master).
Table 3: Terms and Abbreviations

1.10 References to Documents


This manual is based on the following documents and specifications:
[1] Hilscher Gesellschaft für Systemautomation mbH: Programming Reference Guide,
CIFX API, revision 2, english, 2013.
[2] Hilscher Gesellschaft für Systemautomation mbH:
Operating Instruction Manual, CIFX Device Driver - Installation and Operation V1.0.x.x.
Revision 8, English, 2013.
[3] Hilscher Gesellschaft für Systemautomation mbH:
Dual-Port Memory Interface Manual - netX based products. Revision 12, english, 2011.
[4] IntervalZero Inc.: Working with Hardware Resource Limitations. Document Number:
RTX-810-004.
[5] IntervalZero Inc.: RTX Product Help - Real-time Subsystem / Managing PCI and ISA
Devices / Converting a Windows Device to an RTX Device.
[6] IntervalZero Inc.: RTX64 Product Help - Real-time Subsystem / Managing PCI/PCIe
Devices / Converting a Windows Device to an RTX64 Device.
Table 4: References to Documents

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 8/35

1.11 Legal Notes


1.11.1 Copyright
©
2009-2014 Hilscher Gesellschaft für Systemautomation mbH
All rights reserved.
The images, photographs and texts in the accompanying material (manual, accompanying texts,
documentation, etc.) are protected by German and international copyright law as well as
international trade and protection provisions. You are not authorized to duplicate these in whole or
in part using technical or mechanical methods (printing, photocopying or other methods), to
manipulate or transfer using electronic systems without prior written consent. You are not permitted
to make changes to copyright notices, markings, trademarks or ownership declarations. The
included diagrams do not take the patent situation into account. The company names and product
descriptions included in this document may be trademarks or brands of the respective owners and
may be trademarked or patented. Any form of further use requires the explicit consent of the
respective rights owner.

1.11.2 Important Notes


The manual, accompanying texts and the documentation were created for the use of the products
by qualified experts, however, errors cannot be ruled out. For this reason, no guarantee can be
made and neither juristic responsibility for erroneous information nor any liability can be assumed.
Descriptions, accompanying texts and documentation included in the manual do not present a
guarantee nor any information about proper use as stipulated in the contract or a warranted
feature. It cannot be ruled out that the manual, the accompanying texts and the documentation do
not correspond exactly to the described features, standards or other data of the delivered product.
No warranty or guarantee regarding the correctness or accuracy of the information is assumed.
We reserve the right to change our products and their specification as well as related manuals,
accompanying texts and documentation at all times and without advance notice, without obligation
to report the change. Changes will be included in future manuals and do not constitute any
obligations. There is no entitlement to revisions of delivered documents. The manual delivered with
the product applies.
Hilscher Gesellschaft für Systemautomation mbH is not liable under any circumstances for direct,
indirect, incidental or follow-on damage or loss of earnings resulting from the use of the information
contained in this publication.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Introduction 9/35

1.11.3 Exclusion of Liability


The software was produced and tested with utmost care by Hilscher Gesellschaft für
Systemautomation mbH and is made available as is. No warranty can be assumed for the
performance and flawlessness of the software for all usage conditions and cases and for the
results produced when utilized by the user. Liability for any damages that may result from the use
of the hardware or software or related documents, is limited to cases of intent or grossly negligent
violation of significant contractual obligations. Indemnity claims for the violation of significant
contractual obligations are limited to damages that are foreseeable and typical for this type of
contract.
It is strictly prohibited to use the software in the following areas:
 for military purposes or in weapon systems;
 for the design, construction, maintenance or operation of nuclear facilities;
 in air traffic control systems, air traffic or air traffic communication systems;
 in life support systems;
 in systems in which failures in the software could lead to personal injury or injuries leading to
death.
We inform you that the software was not developed for use in dangerous environments requiring
fail-proof control mechanisms. Use of the software in such an environment occurs at your own risk.
No liability is assumed for damages or losses due to unauthorized use.

1.11.4 Export
The delivered product (including the technical data) is subject to export or import laws as well as
the associated regulations of different counters, in particular those of Germany and the USA. The
software may not be exported to countries where this is prohibited by the United States Export
Administration Act and its additional provisions. You are obligated to comply with the regulations at
your personal responsibility. We wish to inform you that you may require permission from state
authorities to export, re-export or import the product.

1.11.5 Registered Trademarks


Please notice: RTX® is a registered trademark of IntervalZero.
Windows® 8, Windows® 7, Windows® Vista, Windows® 2000, Windows® XP and Windows®
Server 2003 are registered trademarks of Microsoft Corporation.
All other mentioned trademarks are property of their respective legal owners.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 10/35

2 Installation
To use a cifX device in the RTX® environment, it must be explicitly removed from Windows®
Device Manager and prepared for RTX® support.
With release of version 1.0.3.0 of the cifX device driver, installation is performed via a dedicated
setup application (see step 5).

Several steps must be done to install the Hilscher RTX® driver:


Step 1: Install the cifX Device Driver for Windows® 2000 / XP / Vista / 7 / 8. Consult reference
[2] for further installation instructions.

Step 2: Configure your cifX device (see section Device Configuration on page 14) with the cifX
Setup Tool, included with the cifX device driver for Windows®.

Note: An online connection to a cifX device is not available if the cifX device is already
converted to a RTX® device. Thus, configuration of the cifX device should be done in
advance.

Note: The device conversion process has changed in RTX64 SP1. Please consult reference
[6] for further details. The required setup information file is installed automatically on
your system during installation of the driver. For manual installation, the setup
information file is also located on the installation CD.

Step 3: Add RTX® support for a cifX device (not required on RTX64).
 Start the RTX Properties dialogue from Windows® start menu
 Open the 'Hardware' tab and enter the Plug and Play configuration via the 'Settings' button.
 Select the cifX device which should be controlled with the RTX® software, choose
'Add RTX INF support' and select 'Apply'.

Figure 2: Add RTX® Support for a cifX Device

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 11/35
Step 4: Converting a Windows® Device to a RTX® Device (Windows® XP)
 Open the Windows® device manager
 Select the cifX device which should be converted and choose 'Update driver'
 Select 'Let me pick from a list of device drivers on my computer'
 To device drivers are listed: The standard cifX driver for Windows® and the cifX driver with
RTX support. Select the cifX driver with RTX support to convert the selected cifX device to a
RTX® device.

Figure 3: Convert the Windows® Device to a RTX® Device

Note: A detailed description of the conversion process for other Windows® systems is given
in reference [5] and [6].

Step 5: Installation of the cifX device driver for RTX via the setup application
 Execute the setup application cifX RTX Driver Setup.exe from the installation CD. The
setup will copy the adequate driver to the given destination directory and register the driver
library to the the RTX subsystem automatically.

 After the installation has completed the cifX device can be accessed via RTX subsystem!

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 12/35

Manual registration of the cifX device driver (Only required for cifX driver V1.0.2.0 an older):
Step 1: Copy the cifX RTX® driver
 Copy the Hilscher RTX® driver DLL cifXRTXDrv.rtdll for your RTX® version from the
installation CD to the local hard disk.

Step 2: Register the driver DLL (not required on RTX64)


 The driver DLL cifXRTXDrv.rtdll must be registered within the RTX® environment.
Therefore the RTX® program RTSSrun can be used. The RTX® environment will generate a
local copy of the driver DLL and makes the driver DLL available for RTSS applications.

Figure 4: RTSSrun Program Example

Note: The driver library for RTX64 does not need to be registered within the RTX
environment since RTX64 provides its own image loader now!

Note: You have to repeat this step if you getting an updated driver DLL

Note: As the cifX driver DLL cannot be loaded by more than one RTX® process
simultaneously, make sure that the option 'Share between processes' is unchecked.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 13/35

2.1 Annotations to Interrupt Support


The cifX device can be used in polling or interrupt mode.
If interrupt mode should be used, IRQ resource limitations must be considered.
As RTX® does not support sharing IRQ lines with Windows® devices, the interrupt line which
RTX® uses must be available for exclusive use.
Finding an exclusive IRQ often requires physically moving hardware around in the system or
disabling other Windows® devices.
If you have difficulty configuring your hardware for use with RTX® due to IRQ resource limitations,
please consult reference [4] for further information.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 14/35

2.2 Device Configuration


Each device has several parameters which can be configured, e.g. Alias Name or Interrupt
Support. Some of the parameters are also important to get the device working, e.g. Bootloader and
firmware and fieldbus configuration files.

Note: Perform the initial device configuration before assigning your cifX device to the RTX®
environment, as the cifX device is no longer accessible via a Windows® process.

The device configuration will be done with the cifX Driver Setup Utility, included with the cifX device
driver for Windows® and the complete device configuration information is stored in the Windows®
registry.
Also the cifX device driver for RTX® needs these configuration and depending on the RTX®
runtime version, access to the Windows® registry and therewith to the device configuration is
available or not.
For RTX® versions without registry access (RTX® version prior RTX® 2009) the registry data must
be exported into a file to be accessible by the cifX device driver for RTX®.

If the cifX device is already converted to a RTX® device, the online connection to the cifX device is
no longer available. Because of this the initial device configuration must be done in advance.

2.2.1 Firmware and Configuration File Storage


cifX PCI cards are not using any flash memory to store a firmware or configuration on the card.
Every time the card is powered-up the firmware and configuration must be downloaded to the
hardware.

Note: Firmware and configurations are not stored on the hardware and must be downloaded
each time the card is powered-up.

It is the task of the driver to initialize the card and therefore the driver has to know which files must
be loaded to the hardware.
To allow device specific configuration, every file that needs to be downloaded must reside in the
folder tree which is created by the cifX device driver for Windows® (or manually generates). The
location of this folder tree is passed to the cifX RTX® driver via a configuration file (see section
Device Configuration on page 14).

 Use the Slotnumber (hardware rotary switch)


The Slotnumber serves to distinguish cifX cards from each other clearly, especially if more
cifX cards are installed in one PC. The Slotnumber must be set at the cifX card using the
Rotary Switch Slotnumber. While Slotnumber 0 means, that the cifX card is identified via its
device and serial number, values from 1 to 9 corresponds to the Slotnumber 1 to 9. The
firmware and configuration file must reside in the subdirectory Slot_<1..9>.
 Use the device and serial number (default)
If the cifX device is not equipped with a rotary switch or the Slotnumber should not be used,
the device is identified by its device and serial number. The firmware and configuration file
must reside in the subdirectory /<Device Number>_<Serial Number>/.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 15/35
The following table describes the different subdirectory levels created by the cifX device driver for
Windows®:

Subdirectory Description
<InstallDir> Installation directory of the cifX device driver for Windows®.
Note: This directory must contain the second stage PCI bootloader (e.g.
NETX100-BSL.bin)
 <Device Nr.>_<Serial Nr.> Device and serial number of the device or slot number if the device
 Slot_<1..9> provides a rotary switch. If the slot number is 0 the device and serial
number is always used to identify the device.
Note: This directory must contain the rcX base firmware, if loadable
modules are used.
Channel<#> Channel specific files (loadable modules, monolithic firmware files,
fieldbus database files)
Note: Currently only channel 0 is supported
Table 5: Firmware and Configuration File Storage

Sample file structure for a cifX device with device number 1250100 and serial number 20217:
+ <InstallDir>
|
|-- NETX100-BSL.BIN (second stage PCI bootloader)
|
|--+ 1250100_20217
|
|--+ Channel0
| |
| |--cifXdps.nxf (monolithic firmware)
| |--config.nxd (fieldbus database)
|
|--+ Channel1
|--+ Channel2
|--+ Channel3
|--+ Channel4
|--+ Channel5
|

Sample file structure for a cifX device identified by Slot number 2 and loadable module support:
+ <InstallDir>
|
|-- NETX100-BSL.BIN (second stage PCI bootloader)
|
|--+ Slot_2
|
|--+ Channel0
| |
| |--nx100dpm.nxo (loadable module)
| |--config.nxd (fieldbus database)
|
|--+ Channel1
|--+ Channel2
|--+ Channel3
|--+ Channel4
|--+ Channel5
|
|-- cifXrcX.nxf (rcX base firmware)

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 16/35

2.2.2 Guideline to Create a Device Configuration


A cifX device needs a configuration defining the firmware and fieldbus configuration files for each
cifX device. This chapter describes how to create a card configuration and how to make it available
to the cifX device driver for RTX®.

Note: Creating a device configuration is done under the Windows® operating system.

 Configure your cifX device with the cifX Driver Setup Utility.
A configuration instruction can be found in the CIFX Device Driver Installation and Operation
manual (cifX Device Driver_usermanual_en.pdf).
Start the utility from the Windows® Control Panel and insert the necessary information.
Press the Apply button and confirm the request to restart the device.
This will store the device configuration in the Windows® registry and create the required
directory tree for the device configuration and firmware file storage (see section Firmware
and Configuration File Storage on page 14).

Figure 5: cifX Driver Setup Utility

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 17/35

2.2.3 Providing the Configuration for RTX2009/2011/2012/RTX64


RTX2009/2011/2012/RTX64 offers direct access to the Windows® registry via a real-time
application. This new feature is used by cifX RTX® driver to access the device configuration and
no further initialization steps are necessary.

2.2.4 Providing the Device Configuration for RTX 8.1


The Windows® registry is not accessible via the RTX application, thus the device configuration
must be exported to a '.reg' file. For this purpose the export function of the Windows® registry
editor must be used.
The location and the filename of this registry file must be supplied to the cifX RTX® driver via the
driver parameters (see section Structure RTX_CIFXDRV_PARAMETERS_T on page 24).

Exporting the device configuration from the Windows® registry:


 Open the Windows® Start menu and select 'Run'
 Execute the Windows® Registry Editor by entering the command 'regedit' and confirm via the
OK button.
 In the Windows® Registry Editor, navigate to the registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv
 In the file menu select Export….
Make sure that the file type is Registration Files (.reg) or Win9x/NT4 Registration files (.reg).
Enter an arbitrary filename and select Save. Remember the file name and the file location!
 In your RTX application you have to pass the path to the exported registry file to the driver
initialization routine cifXInitDriver() via the driver parameter szRegFile (see section Structure
RTX_CIFXDRV_PARAMETERS_T on page 24).

Figure 6: Export the Device Configuration with the Windows® Registry Editor

A sample configuration file is also located on the installation CD and can also be manually modify.
Relevant configuration keys are listed and described in the following chapter.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 18/35

2.2.5 Description of the Device Configuration File


A sample configuration file is located on the installation CD. To modify the configuration file
manually, the relevant configuration keys are listed below.

Key Value Description

[HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv]

InstallDir Path to installation directory, created by the cifX device driver for Windows®

 [HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\<Device Nr.>\<Serial Nr.>]


 [HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\Slot\<Slot Nr.>]
Alias Statically assigned alias name
InterruptEnable Device interrupt handling enable/disable
0 = disable (default)
1 = enabled
DMAEnable Direct memory access enable/disable
0 = disable (default)
1 = enable
OSFile To use loadable modules, a rcX base firmware is required. This entry specifies the
path to the rcX base firmware file relative to:
 <InstallationDir>\<Device Number>_<Serial Number>
 <InstallationDir>\Slot_<Slot Nr.>
 [HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\<Device Nr.>\<Serial
Nr.>\Channel<0..6>]
 [HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\Slot\<Slot Nr.>\Channel<0..6>]
Note: Currently the firmware only supports channel 0
ModuleCount Number of configured loadable modules / monolithic firmware files
Module<0..ModuleCount> Each loadable module or monolithic firmware file gets an own entry with an index
as suffix. This specifies the path to the module file relative to:
 <InstallationDir>\<Dev. Number>_<Serial Number>\Channel<0..6>
 <InstallationDir>\Slot_<Slot Nr>\Channel<0..6>
ConfigCount Number of configured fieldbus databases (configuration files)
Config<0..ModuleCount> Each database gets an own entry with an index as suffix. This specifies the path to
the database file relative to:
 <InstallationDir>\<Dev. Number>_<Serial Number>\Channel<0..6>
 <InstallationDir>\Slot_<Slot Nr>\Channel<0..6>
WarmstartFile Full file name to warmstart parameter file residing in directory:
 <InstallationDir>\<Dev. Number>_<Serial Number>\Channel<0..6>
 <InstallationDir>\Slot_<Slot Nr>\Channel<0..6>
Note: Warmstart file support depends on the used firmware and is maybe not
supported
[HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv\Parameters]
TraceLevel Driver log trace level (See section 4.4 for details)
[HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv\Parameters\NX-PCA-PCI]
DPM_8_Bit NXPCA-PCI Timings parameter for 8 bit mode.
DPM_16_Bit NXPCA-PCI Timings parameter for 16 bit mode.
DPM_32_Bit NXPCA-PCI Timings parameter for 32 bit mode.
Table 6: Device Configuration File Keys

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Installation 19/35
Sample configuration registry file:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv]
"InstallDir"="C:\\Programme\\CifX Device Driver"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217]
"Alias"=""
"InterruptEnable"=dword:00000001
"DMAEnable"=dword:00000001
"OSFile"="cifXrcX.nxf"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217\
Channel0]
"ModuleCount"=dword:00000001
"Module0"="cifXdps.nxf"
"ConfigCount"=dword:00000001
"Config0"="config.nxd"
"WarmstartFile"="warmstart.dat"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217\
Channel1]
"ModuleCount"=dword:00000000
"ConfigCount"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217\
Channel2]
"ModuleCount"=dword:00000000
"ConfigCount"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217\
Channel3]
"ModuleCount"=dword:00000000
"ConfigCount"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217\
Channel4]
"ModuleCount"=dword:00000000
"ConfigCount"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CIFxDrv\DeviceConfig\1250100\20217\
Channel5]
"ModuleCount"=dword:00000000
"ConfigCount"=dword:00000000

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Shared Memory Extension 20/35

3 Shared Memory Extension


Windows applications may access cifX devices which are under RTX control via a special shared
memory extension. This extension consists of a RTX process “cifXd” and two libraries for the RTX
(“cifX32Dll.rtdll”) and Windows environment (“cifX32Dll.dll”). The cifXd process has exclusive
control on the cifX devices and provides a shared memory interface to enable access from various
RTX and Windows applications. A RTX and a Windows version of the cifX32Dll library allow any
CIFX API compatible application to access the cifXd-controlled devices via the shared memory
interface.

Note: Due to the limited performance of the shared memory interface, the shared memory
interface should be used for diagnostic purposes only.

The concept of the shared memory interface is illustrated in the following figure.
Windows User Applications

cifX User Application


(RTSS/EXE Process)

cifX32Dll.Dll cifX32Dll.RTDLL
netXTransportToolkit netXTransportToolkit

RTX Shared Memory Connection


cifXD.RTSS
Marshaller
Shared Memory Extension

cifX Driver RTDLL


Windows Kernel and (cifXRTXDrv.rtdll) cifXToolkit
Device Drivers

RTX - RTSS (Real-time Subsystem)

Windows HAL RTX HAL Extension

cifX Device 0..n

x86 Hardware Platform CH0 CH1 ...

Figure 7: Shared Memory Extension

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Shared Memory Extension 21/35

3.1 Restrictions
Although cifX32Dll.rtdll and cifXRTXDrv.rtdll are interchangeable in terms of its API, some
extended functionalities are restricted or may not work at all via the shared memory interface.
Affected CIFX API functions:
 xSysdeviceBootstart()
 xSysdeviceExtendedMemory()
 xChannelDMAState()
 xChannelRegisterNotification(), xChannelUnregisterNotification()
 xChannelSyncState()
 xChannelPLCMemoryPtr(), xChannelPLCIsReadReady(), xChannelPLCIsWriteReady(),
xChannelPLCActivateWrite(), xChannelPLCActivateRead()
Although linking against those API functions succeeds, they will always return with the error code
CIFX_FUNCTION_NOT_AVAILABLE.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Shared Memory Extension 22/35

3.2 Installation
Installation of the shared memory extension is performed automatically during installation of the
cifX Device Driver.
This feature can also be selected/deselected in the custom setup dialog:

Figure 8: Install shared memory extension to enable access from windows application

Selecting the Shared Memory Service will exchange the cifX32dll.dll in your .\Windows\System32
directory (typically C:\Windows\System32) with the shared memory enabled cifX32Dll variant
enclosed with this setup application.
On 64 bit Windows systems the installer also exchanges the cifX32Dll.dll in the
.\Windows\SysWOW64 directory (RTX64 only).

ATTENTION: Re-installation of the original cifX Device Driver for Windows will override
any cifX32dll.dll exchanged by the RTX driver installation in the
.\Windows\System32 and .\Windows\SysWOW64 directory.

If you want to use the Shared Memory Service again, it is necessary to


manually copy the shared memory enabled cifX32Dll files again to
.\Windows\System32 and .\Windows\SysWOW64 directory!

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Shared Memory Extension 23/35

3.3 Using the Shared Memory Service


The shared memory extension demon process (“cifXd”) has to be running in background as long
as access to the cifX devices from a Windows application via the cifX32Dll is required.
To start the "cifXd" process, navigate to the Windows "Start" menu and execute the “Start Shared
Memory Service (cifXd)” shortcut (see figure below) or execute the "cifXd" process manually via a
command line.

Command line to start Shared Memory Service:


RTX8 / 2009 / 2011 / 2012: rtssrun cifXd.rtss start
RTX64: rtssrun cifXd64.rtss start

Figure 1: cifXd Process Shortcuts in the Windows Start Menu

The CIFX API compatible cifX32dll.dll (for Windows applications) and the cifX32dll.rtdll (for RTX
applications) should be used now to access cifX devices via the "cifXd" shared memory process.
To stop the "cifXd" process, use either the appropriate shortcut in the Windows "Start" menu or
stop the process manually by using a command line.

Command line to stop Shared Memory Service:


RTX 8 / 2009 / 2011 / 2012: rtssrun cifXd.rtss stop
RTX64: rtssrun cifXd64.rtss stop

Although concurrent access from RTX and Windows is possible, it is not recommended to run
several applications on one and the same cifX device at the same time.
Process based packet routing is not supported by the "cifXd" process, i. e. packet data transfers
may fail as it can not be guaranteed that a packet reply is only delivered to that application which
has dispatched the request packet before.

Note: As long as the cifXd process is running, RTX applications must not access cifX devices
via the origin driver library (cifXRTXDrv.rtdll).

The CIFX API compatible cifX32dll.rtdll can be used instead to access cifX devices via
shared memory from the RTX environment.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 24/35

4 Driver Specific Information


The cifX driver for RTX® needs some special initialization functions and structures.

4.1 Additional Structures


Some of the RTX® specific functions need parameters provided through structures. The structures
and the meaning of the internal data are described in the following chapter.

4.1.1 Structure RTX_CIFXDRV_PARAMETERS_T


This structure is used to initialize the cifX driver.

Element Data Type Description


fScanPCI int Driver Initialization options:
0 = FALSE
Driver does not scan for PCI cards. Cards can be added
manually by ulUserDevCount and ptUserDevList
parameters.
1 = TRUE
Driver scans for all available PCI cards and adds them to
the application.
ulTraceLevel unsigned long RTX 2009/2011/2012/RTX64:
not used (obtained via regsitry, see section 2.2.5)
RTX 8.1:
Set the trace level of the driver:
1 = TRACE_LEVEL_DEBUG
2 = TRACE_LEVEL_INFO
4 = TRACE_LEVEL_WARNING
8 = TRACE_LEVEL_ERROR
ulPollInterval unsigned long Polling interval in milliseconds [ms] for non-interrupt
driven cards (used for Change of State (COS) signaling,
see reference [3])
0 = 500ms default
szRegFile const char* RTX 2009/2011/2012/RTX64:
not used
RTX 8.1:
Set the path to the Windows® registry file. Can be NULL
to use the default of 'c:\CIFxDrv.reg'. Creation of this
registry file is explained in section Device Configuration
on page 14.
NULL = 'c:\CIFxDrv.reg’ default
ulUserDevCount unsigned long Number of user cards entries in the ptUserDevList to add
to the driver (e.g. if a card is connected via DPM).
0 = none
ptUserDevList RTX_CIFXDRV_DEVICEENTRY_T ** Array of user added cards.
Number of entries is defined by ulUserDevCount. See
section Structure RTX_CIFXDRV_DEVICEENTRY_T on
page 25.
Table 7: Structure RTX_CIFXDRV_PARAMETERS_T Definition

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 25/35

4.1.2 Structure RTX_CIFXDRV_DEVICEENTRY_T


This structure describes a cifX device which should be added to the driver. This structure can be
acquired through cifXFindDevice() or filled by the user if a custom card should be added.

Element Data Type Description


ulPhysicalAddress unsigned long Physical address of the DPM (this value is used to
detect the PCI card linked to the DPM)
bIrqNumber unsigned char Interrupt number
pvDPMAddress void* Virtual pointer to card DPM
ulDPMSize unsigned long Size of the DPM in bytes
fPCICard int 0 = FALSE
Device is connected via DPM.
1 = TRUE
Device is connected to PCI bus
tBusInfo RTX_CIFXDRV_DEVICEBUSINFO_T Bus information, see section Structure
RTX_CIFXDRV_DEVICEBUSINFO_T on page 25
Table 8: Structure RTX_CIFXDRV_DEVICEENTRY_T Definition

4.1.3 Structure RTX_CIFXDRV_DEVICEBUSINFO_T


Bus information structure used to store bus specific information for cifX devices connected via PCI
bus.

Element Data Type Description


ulBusNumber int Bus number
ulSlotNumber int Slot number
Table 9 : Structure RTX_CIFXDRV_DEVICEBUSINFO_T Definition

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 26/35

4.2 Additional functions


This chapter describes functions which are only available for the RTX® version of the driver. These
functions are used to initialize the cifX device driver.

4.2.1 cifXInitDriver()
This function must be called before accessing any driver function. The cifX driver initialization
includes discovering all available cifX PCI devices and downloading the firmware and configuration
files.

Note: cifXInitDriver() calls cifXFindDevice() internally to search for available cifX PCI cards
(fScanPCI = TRUE). If the cards should be defined manually, cifXFindDevice() can be
used to add cards manually (fScanPCI = FALSE).

Note: For none PCI cards, the application has to create a RTX_CIFXDRV_DEVICEENTRY_T
with the corresponding device information. Afterwards, the structure must be placed
into the RTX_CIFXDRV_PARAMETERS_T structure (see parameters
ulUserDevCount, ptUserDevList, fScanPCI = FALSE) before cifXInitDriver() is called.

Function call:
int32_t cifXInitDriver (RTX_CIFXDRV_PARAMETERS_T* ptDriverParams);

Arguments:

Argument Data Type Description


ptDevEntry RTX_CIFXDRV_PARAMETERS_T* Driver parameters, see section Structure
RTX_CIFXDRV_PARAMETERS_T on page 24

Return Values:

Return Values
CIFX_NO_ERROR Driver initialization successful
CIFX_DRV_INIT_ERROR Driver initialization failed (no cifX device available)

Example:
RTX_CIFXDRV_VTABLE tVTable = {0};
RTX_CIFXDRV_PARAMETERS_T tDriverParams = {0};
HANDLE hDll = NULL;
char* szRegFile = "C:\\CIFxDrv.reg";

/* Set driver parameters */


tDriverParams.fScanPCI = TRUE;
tDriverParams.ulUserDevCount = 0;
tDriverParams.szRegFile = szRegFile;

/* Load cifXRTXDrv.rtdll */
hDll = LoadLibrary("cifxRTXDrv.dll");

/* Assign function pointer */


tVTable.cifXInitDriver = (RTXDRV_INIT) GetProcAddress( hDll, "cifXInitDriver");

/* Scan for all available cifX PCI devices and initialize the cifX device driver */
tVTable.cifXInitDriver (&tDriverParams);

FreeLibrary(hDll);

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 27/35

4.2.2 cifXDeinitDriver()
Un-initialize the driver and remove all devices from the control of the cifX driver library. After calling
this function the application must not access any cifX driver API function any more.

Function call:
int32_t cifXDeinitDriver ( void );

Arguments:

Argument Data Type Description


none

Return Values:

Return Values
CIFX_NO_ERROR Driver deinitialization successful
CIFX_DEV_HW_PORT_IS_USED Device is in use, so driver deinitialization is denied
CIFX_DRV_NOT_INITIALIZED Driver was not initialized

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 28/35

4.2.3 cifXFindDevice()
This function scans for a cifX PCI device in the system and builds a
RTX_CIFXDRV_DEVICEENTRY_T structure for each discovered device.
The function is used internally by cifXInitDriver() if PCI cards should be detected automatically
(RTX_CIFXDRV_PARAMETERS_T, fScanPCI parameter = TRUE).
cifXFindDevice() can also be used by an application to manually define a cifX card. Therefore the
function can be called with a fixed device number (iNum). If the given device is available, the
function returns the RTX_CIFXDRV_DEVICEENTRY_T structure for the device.
Afterwards the application has to insert this structure into the RTX_CIFXDRV_PARAMETERS_T
structure (see section Structure RTX_CIFXDRV_PARAMETERS_T on page 24), setting the
fScanPCI flag to FALSE and calling cifXInitDriver().

Function call:
BOOL cifXFindDevice ( RTX_CIFXDRV_DEVICEENTRY_T* ptDevEntry,
int iNum);

Arguments:

Argument Data Type Description


ptDevEntry RTX_CIFXDRV_DEVICEENTRY_T* Pointer to a RTX_CIFXDRV_DEVICEENTRY_T structure, to
place returned values in
iNum int Number of the device in the system
0 = first device

Return Values:

Return Values
TRUE A device with number iNum was found
FALSE A device with number iNum could not be found

Example:
RTX_CIFXDRV_VTABLE tVTable = {0};
RTX_CIFXDRV_PARAMETERS_T tDriverParams = {0};
RTX_CIFXDRV_DEVICEENTRY_T tDevEntry = {0};
HANDLE hDll = NULL;

/* Load cifXRTXDrv.rtdll */
hDll = LoadLibrary("cifxRTXDrv.dll");

/* Assign function pointer */


tVTable.cifXInitDriver = (RTXDRV_INIT) GetProcAddress( hDll, "cifXInitDriver");
tVTable.cifXFindDevice = (RTXDRV_FIND_DEVICE)
GetProcAddress( hDll, "cifXFindDevice");

/* Find the first cifX PCI device */


if (tVTable.cifXFindDevice (&tDevEntry, 0))
{
tDriverParams.fScanPCI = FALSE;
tDriverParams.ulUserDevCount = 1;
tDriverParams.ptUserDevList = &tDevEntry;

/* initialize the cifX device driver */


tVTable.cifXInitDriver (&tDriverParams);
}

FreeLibrary(hDll);

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 29/35

4.2.4 cifXGetDriverVersion()
This function requests the version of the cifX driver for RTX®.

Function call:
int32_t cifXGetDriverVersion ( char* szVersion, uint32_t ulSize )

Arguments:

Argument Data Type Description


szVersion char* String buffer to return the version of the cifX driver
ulSize uint32_t Maximum buffer size for the version string

Return Values:

Return Values
CIFX_NO_ERROR Driver version successfully copied to string buffer
CIFX_INVALID_BUFFERSIZE Supplied buffer to small to hold the driver version string

Example:
RTX_CIFXDRV_VTABLE tVTable = {0};
char szDrvVersion[20] = "";
HANDLE hDll = NULL;

/* Load cifXRTXDrv.rtdll */
hDll = LoadLibrary("cifxRTXDrv.dll");

/* Assign function pointer */


tVTable.cifXGetDriverVersion = (RTXDRV_GET_VERSION)
GetProcAddress( hDll, "cifXGetDriverVersion");

/* Get driver version */


tVTable.cifXGetDriverVersion( szDrvVersion,
sizeof(szDrvVersion)/sizeof(*szDrvVersion) );

/* Print driver version to screen */


RtPrintf("%s", szDrvVersion);

FreeLibrary(hDll);

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 30/35

4.3 Driver Startup Procedure


The driver startup procedure can be controlled by the user. The following two use cases are
available:
 Automatically add all found cifX PCI devices and optionally add user specific devices
 Skip cifX PCI device scan and add user specific device manually

Figure 9: Initialization of the cifX Driver with fScanPCI = TRUE

Figure 10: Initialization of the cifX Driver with fScanPCI = FALSE

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Driver Specific Information 31/35

4.4 Driver Log File


The cifX driver for RTX is able to create log files on the startup which can be used for debug and
support purposes.

Note: This feature was added in Version 1.0.4.0!


Older versions reporting log traces on the RtxServer console only.

For each cifX device in the system, a separate log file is created using the nameing convention
“cifX<0..n>.log“.
Log files are stored in the installation directory of the cifX Device Driver for Windows(!) (typically
“C:\Program Files\cifX Device Driver“).
The driver installation directory is also stored in the Windows registry (see section 2.2.5 for further
details).
Trace granularity can be adjusted by setting the trace level accordingly:
 TRACE_LEVEL_ERROR
 TRACE_LEVEL_WARNING
 TRACE_LEVEL_INFO
 TRACE_LEVEL_DEBUG
TRACE_LEVEL is also stored in the Windows registry and can be adjusted via the cifXSetup utility
or manually via the Windows registry editor (regedit).

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Programming with the Driver 32/35

5 Programming with the Driver


The Application Programming Interface (API) of the Hilscher RTX® driver is based on the already
known CIFX API (reference [1]). The CIFX API is documented in the 'CIFX API - Application
Programming Interface' manual, describing the API functions, error codes and shows some
program examples using the API.
The installation CD also includes a ‘Test Application’ directory with a RTX® specific example.
The following C application demonstrates the minimum functions which must be called to enable
an application to work with a cifX device
#include <windows.h>
#include <rtapi.h>
#include "cifXUser.h"
#include "cifXErrors.h"
#include "cifxRTXDrv.h"

/*****************************************************************************/
/*! The main function
* \return 0 on success */
/*****************************************************************************/
int main(int argc, char* argv[])
{
HANDLE hDll = NULL;
CIFXHANDLE hDriver = NULL;
RTX_CIFXDRV_VTABLE tVTable = {0};
RTX_CIFXDRV_PARAMETERS_T tDriverParams = {0};
long lRet = CIFX_NO_ERROR;
char* szRegFile = "C:\\CIFxDrv.reg";

/* Set driver parameters */


tDriverParams.fScanPCI = TRUE;
tDriverParams.ulUserDevCount = 0;
tDriverParams.szRegFile = szRegFile;
tDriverParams.ulTraceLevel = TRACE_LEVEL_ERROR | TRACE_LEVEL_WARNING |
TRACE_LEVEL_INFO | TRACE_LEVEL_DEBUG;
/* Load cifXRTXDrv.rtdll */
hDll = LoadLibrary("cifxRTXDrv.dll");

/* Assign function pointer */


tVTable.cifXInitDriver =(RTXDRV_INIT) GetProcAddress(hDll, "cifXInitDriver");
tVTable.cifXDeinitDriver=(RTXDRV_DEINIT) GetProcAddress(hDll, "cifXDeinitDriver");
tVTable.xDriverOpen =(X_DRIVER_OPEN) GetProcAddress(hDll, "xDriverOpen");
tVTable.xDriverClose =(X_DRIVER_CLOSE)GetProcAddress(hDll, "xDriverClose");
/* TODO: assign further api function */

/* Initialize and open the cifX device driver */


if( (CIFX_NO_ERROR == (lRet = tVTable.cifXInitDriver (&tDriverParams))) &&
(CIFX_NO_ERROR == (lRet = tVTable.xDriverOpen(&hDriver))) )
{
/* Work with the cifX API */

/* Close the cifX driver */


tVTable.xDriverClose(hDriver);
} else
{
RtPrintf("Error opening driver. lRet=0x%08X\r\n", lRet);
}

/* Deinit the cifX device driver */


tVTable.cifXDeinitDriver ();

FreeLibrary(hDll);

return 0;
}

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Frequently Asked Questions 33/35

6 Frequently Asked Questions


Q: The driver presents the following warning at startup: 'OS_Memalloc: Not enough free
memory in RTSS memory pool! Request from windows memory pool'. What does that
mean?
A: To fulfill RTSS applications memory requests, RTX deterministically allocates memory from a
special memory pool (Local memory pool). RTSS applications that allocate memory from that
pool don't have to initiate a Service Request Interrupt to request memory from Windows (This
request would be non-deterministic). If the memory needs of the RTSS application exceeds
the initial size of the local memory pool, RTX initiate a non-deterministic Service Request
Interrupt to request memory from Windows. This action is signaled to the user via the drivers
warning message. This scenario can be avoided, by increasing the initial local memory pool
size to the memory needs of the driver and the RTSS application (see memory settings in the
RTX properties application). If the creation of the local memory pool is not done at startup,
but with the first call to a local memory pool allocation function the drivers warning message
is also signaled. The creation of the local memory pool at startup is initiated, a) by executing
the RTSS application with the parameter /local or b) by modifying the memory settings in the
RTX properties application (see RTX Manual).

Q: Is it possible to develop a cifX application with Visual Studio 6.0?


A: If RTX 8.1 is used, application development with Visual Studio 6.0 is supported. But with
release of RTX 2009 the development of RTSS application with Visual Studio 6.0 is no
longer supported (see http://intervalzero.com/assets/OSCompatMatrixRTX.pdf and
http://intervalzero.com/assets/RTX642013/RTX64OSCompatibilityMatrix.pdf). With release of
RTX 2011 the development of RTSS application with Visual Studio 2003 is also no longer
supported

Q: Is it possible to configure a cifX card, independently of its serial and device number?
A: The cifX Device Driver for RTX from version 1.0.1.0 on identifies cifX cards alternatively via
its slot number. Please note that your cifX device must provide a rotary switch to use slot
number support.

Q: The compiled test application crashes the system. What's wrong?


A: If you don't use Visual Studio 2005 to compile the test application, you probably forgot to
adjust the linker path of the Visual Studio specific RTX libraries.

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Appendix 34/35

7 Appendix
7.1 List of Tables
Table 1: List of Revisions .................................................................................................................................. 3
Table 2: CD Contents ........................................................................................................................................ 6
Table 3: Terms and Abbreviations..................................................................................................................... 7
Table 4: References to Documents ................................................................................................................... 7
Table 5: Firmware and Configuration File Storage.......................................................................................... 15
Table 6: Device Configuration File Keys ......................................................................................................... 18
Table 7: Structure RTX_CIFXDRV_PARAMETERS_T Definition................................................................... 24
Table 8: Structure RTX_CIFXDRV_DEVICEENTRY_T Definition .................................................................. 25
Table 9 : Structure RTX_CIFXDRV_DEVICEBUSINFO_T Definition ............................................................. 25

7.2 List of Figures


Figure 1: cifX Device Driver Architecture........................................................................................................... 4
Figure 2: Add RTX® Support for a cifX Device ............................................................................................... 10
Figure 3: Convert the Windows® Device to a RTX® Device .......................................................................... 11
Figure 4: RTSSrun Program Example............................................................................................................. 12
Figure 5: cifX Driver Setup Utility..................................................................................................................... 16
Figure 6: Export the Device Configuration with the Windows® Registry Editor.............................................. 17
Figure 7: Shared Memory Extension ............................................................................................................... 20
Figure 8: Install shared memory extension to enable access from windows application................................ 22
Figure 9: Initialization of the cifX Driver with fScanPCI = TRUE ..................................................................... 30
Figure 10: Initialization of the cifX Driver with fScanPCI = FALSE.................................................................. 30

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014
Appendix 35/35

7.3 Contact

Headquarters

Germany
Hilscher Gesellschaft für
Systemautomation mbH
Rheinstrasse 15
65795 Hattersheim
Phone: +49 (0) 6190 9907-0
Fax: +49 (0) 6190 9907-50
E-Mail: [email protected]
Support
Phone: +49 (0) 6190 9907-99
E-Mail: [email protected]

Subsidiaries

China Japan
Hilscher Systemautomation (Shanghai) Co. Ltd. Hilscher Japan KK
200010 Shanghai Tokyo, 160-0022
Phone: +86 (0) 21-6355-5161 Phone: +81 (0) 3-5362-0521
E-Mail: [email protected] E-Mail: [email protected]
Support Support
Phone: +86 (0) 21-6355-5161 Phone: +81 (0) 3-5362-0521
E-Mail: [email protected] E-Mail: [email protected]

France Korea
Hilscher France S.a.r.l. Hilscher Korea Inc.
69500 Bron Seongnam, Gyeonggi, 463-400
Phone: +33 (0) 4 72 37 98 40 Phone: +82 (0) 31-789-3715
E-Mail: [email protected] E-Mail: [email protected]
Support
Phone: +33 (0) 4 72 37 98 40 Switzerland
E-Mail: [email protected] Hilscher Swiss GmbH
4500 Solothurn
India Phone: +41 (0) 32 623 6633
Hilscher India Pvt. Ltd. E-Mail: [email protected]
New Delhi - 110 065 Support
Phone: +91 11 26915430 Phone: +49 (0) 6190 9907-99
E-Mail: [email protected] E-Mail: [email protected]

Italy USA
Hilscher Italia S.r.l. Hilscher North America, Inc.
20090 Vimodrone (MI) Lisle, IL 60532
Phone: +39 02 25007068 Phone: +1 630-505-5301
E-Mail: [email protected] E-Mail: [email protected]
Support Support
Phone: +39 02 25007068 Phone: +1 630-505-5301
E-Mail: [email protected] E-Mail: [email protected]

cifX Device Driver | IntervalZero RTX®


DOC090702DRV06EN | Revision 6 | English | 2014-03 | Released | Public © Hilscher 2009-2014

You might also like