CifX Device Driver - IntervalZero RTX DRV 06 en
CifX Device Driver - IntervalZero RTX DRV 06 en
CifX Device Driver - IntervalZero RTX DRV 06 en
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
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.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.
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.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
1.8 CD Contents
Folder Content
Examples Examples
SharedMemory Extension Shared Memory Extension for accesses from windows environment
Table 2: CD Contents
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.
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).
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'.
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!
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.
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.
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.
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).
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)
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 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.
[HKLM\SYSTEM\CurrentControlSet\Services\CIFxDrv]
InstallDir Path to installation directory, created by the cifX device driver for Windows®
[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
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
cifX32Dll.Dll cifX32Dll.RTDLL
netXTransportToolkit netXTransportToolkit
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.
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.
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.
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.
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:
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";
/* Load cifXRTXDrv.rtdll */
hDll = LoadLibrary("cifxRTXDrv.dll");
/* Scan for all available cifX PCI devices and initialize the cifX device driver */
tVTable.cifXInitDriver (&tDriverParams);
FreeLibrary(hDll);
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:
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
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:
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");
FreeLibrary(hDll);
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:
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");
FreeLibrary(hDll);
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).
/*****************************************************************************/
/*! 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";
FreeLibrary(hDll);
return 0;
}
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.
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.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]