1.6. Initial Startup

1.6.1. Licensing the CIF Driver

The CIF Driver license is a permanent, commercial license, which must be purchased. This license is automatically activated during driver installation.

[Note]

A time-limited-license version of this driver is available upon request.

For the CIF Driver to run you must supply some information to Cogent or one of Cogent's distributors. Here is the simplest procedure:

  1. If you have not already done so, install the CIF Driver on your computer.
  2. Switch to root (use the su command), and run the driver as:
    # drcif_ad
    If the driver auto-detects the card, it will print some information in this format:
    (cardProfile 0
       (Id "CIF") (Addr 0XC8000) (MemorySize 8 Kb) (Interrupt 10)
       (TypeModel "CIF 50-DNM") (Desc "CIF 50 for DeviceNet")
       (Protocol "DEVICENET")
       (Date 01021999) (GNR 9717020) (SNR 00000037)
       (OSName "SMSI") (OEMid "")
       (Firmware "DNM CIF50DNM" "V01.052 29.06.99")
       (DeviceAddress 0X00) (Mode 4 "HOST controlled, buffered")
       (Task 2 "PLC " 1006 0)
       (Task 3 "DNM " 1066 2)) 
  3. E-mail this information to , and we will use it to generate a license for the card (see below). When a permanent, commercial license has been purchased, you must specify the target OS for the driver in your email.

Alternatively, to use a configuration file and get a little more information, you can follow this procedure:

  1. Create a configuration file containing the following lines:
    (debug 10)
    (cardInit)
    (cardProfile) 
    or use the file provided in /usr/cogent/drivers/cif/detect.cfg.
  2. Switch to root (use the su command), and run the driver as:
    # drcif_ad -f your_cfg_file
    or
    # drcif_ad -f /usr/cogent/drivers/cif/detect.cfg
    If the driver auto-detects the card, it will print the same information as above, but in addition, will also specify that no valid licenses were available, and will provide a key, one per card, similar to:
    0123-4567-89ab-cdef-1234-abcd
  3. E-mail this information to , and we will use it to generate a license for the card. When a permanent, commercial license has been purchased, you must specify the target OS for the driver in your email.

After completing either of the above procedures, once you have supplied the card identification information to Cogent, a software key will be generated and sent to you. The code is string of characters in this format::

xxxx-xxxx-xxxx-xxxx

This number must be entered on a line in the driver configuration file as:

(license 0 xxxx-xxxx-xxxx-xxxx)

You may place any number of licenses in a single .cfg file, and so long as one of them matches an installed card, the driver will run.

To facilitate managing licenses for multiple cards, you can save all the licenses in a single file, and then add a single licenseFile command to the configuration file. Note that this file contains only licenses (and optional comments), not commands, without the association between license and card ID enforced by the license command.

1.6.2. Running the CIF Driver

The driver must be started before any applications attempt to connect to it, specifically before the DR_ApInitIPC function is called by a client. The driver requires the Cascade NameServer (nserve) and Cascade QueueServer (qserve) to be running, and will automatically start them if they are not. The driver may be started before or after the Cascade DataHub is started.

The CIF Driver makes privileged calls to map the shared memory of the CIF card, and thus must be run with root privileges. The installation makes the CIF Driver set the user ID (using setuid) to root by default. The CIF Driver can be started at a shell using the command drcif_ad and specifying any of its command options. For example:

# drcif_ad -f ./c2.cfg

or, with more options:

# drcif_ad -d dh3 -f ./c2.cfg -n CifDriver02
[Note]

The CIF Driver runs in the foreground to facilitate initial testing and configuration. When it is run with no parameters, it generates easy-to-read auto-detection output. Once you are satisfied with your configuration, you can use the & directive at the end of the command line to tell the operating system to run the program in the background, and so detach from the command console. For example:

# drcif_ad -d dh3 -f ./c2.cfg &

To test the CIF Driver, you can run it in auto-detection mode using the following command:

# /usr/cogent/bin/drcif_ad -f /usr/cogent/drivers/cif/detect.cfg

This command will attempt to start the CIF Driver, will auto-detect up to 4 installed CIF cards, and then fail with no license. In the process it will generate some error messages, and a profile for each detected card. The profile should look like this:

(cardProfile 0 
     (Id "CIF") (Addr 0XD0000) (MemorySize 2 Kb) (Polled 0) 
     (TypeModel "CIF 30-DPM") (Desc "CIF 30 for Profibus-DP Master") 
     (Protocol "PROFIBUS-DP") 
     (Date 01011997) (GNR 96030020) (SNR 00000235) 
     (OSName "SMSI") (OEMid "") 
     (Firmware "DPM CIF30DPM" "V01.014 22.11.96") 
     (DeviceAddress 0X00) (Mode 4 "HOST controlled, buffered") 
     (Task 2 "PLC " 1015 0) 
     (Task 3 "USR_INTF" 1053 2) 
     (Task 7 "FDL " 1024 0)) 

You can now create your own driver configuration file to reflect your particular setup (see Driver Configuration for details). The CIF driver ships with a number of sample files that are copied to /usr/cogent/drivers/cif by the installation script. For example, you can run the driver with:

# drcif_ad -f cif_sample.cfg

If there are errors in the configuration file, the driver will exit with messages indicating the nature of the errors.

1.6.3. Testing communication to I/O

Once the CIF Driver has started, it will begin a periodic poll of the I/O hardware. This information is stored within the driver, but is not actually transmitted anywhere until you have created a client application. If you prefer, you can download the Cascade DataHub development archive from the Cogent web site. This datahub acts as a universal client and server for process data. You can examine and modify the contents of the Cascade DataHub using one of the commands: readpt, writept, waiter and dhview.

In order to use the Cascade DataHub with the CIF Driver, the driver must be configured to use the point interface through the configuration commands: digital, analog and group in the .cfg file.

To use the Cascade DataHub see Using the Cascade DataHub in the Cascade DataHub manual. To examine and modify the contents of the Cascade DataHub, see Using the Cascade DataHub Viewer.