2.9. Running the Loader Program

The loader must be run for each SD card in the system after every power-up of the computer. The invocation of the loader can be added to the sys.init file of the operating system to do this. The loader can be used on cards that have been loaded already. This is typically used to change parameters such as station address or RAM location without rebooting.

The loader program, sdload, reads the code for the software module (*.ss1), loads it into the card and then starts the card. The loader then waits for the card diagnostics to complete and reports the status of the installation. If installation is successful, the loader shuts off the red LED; otherwise it is left on. This gives a quick visual indication of module installation status. A successfully completed load displays a page of status information. Errors encountered during the load are displayed with an explanatory message. Most errors while loading can be traced to the following: resource conflicts with other devices (usually interrupts or RAM), incorrect specifications for sdload or incorrect switch settings on the card.

If the card has already been initialized, the loader reads the old parameters back from the administrator. In this case, the card number and file name are the only required parameters, but other parameters can be specified to change existing values.

The loader syntax is:

sdload file_name [p=port_addr] [m=memory_addr] [w=window_size]
                 [i=interrupt] [c=card] [s=station] [t=timeout] [b=baud_rate]
                 [n=admin_name] [N=admin_node] [P=pci_card_number]
                 [T=term_name] [sl=slot] [-d] [+v]
[Note]

The P=pci_card_number parameter is required for PCI cards.

Where:

file_name

Downloadable program file name. This is one of the following:

Sddh for the Data Highway module
Sddhp for the Data Highway Plus module
Sdpdhp for Data Highway Plus PCI cards

Do not include the file extension .ss1.

port_addr

I/O address in hex (200, 208 ... 2f8) or (600, 608 ... 6f8)

memory_addr

Memory location in hex (a000, a800 ... f800)

window_size

Memory window size (16 or 32).

interrupt

Interrupt number used (2-7).

card

The number to assign to this card (0 to 7).

station

Local station number (in octal, default 7).

timeout

Timeout in 1/4 second increments (default 0 or off).

baud_rate

A value of 57, 115, or 230 that represents the baud rate for data transfer (57K, 113K, and 230K respectively).

admin_name

The name registered by administrator (default sdadmin).

admin_node

The node where administrator is running (default this one).

pci_card_number

The order in which this PCI card is found. Cards are numbered 0 through 3. This option is required for PCI cards.

term_name

The terminal name for the PLC node (default none).

slot

The motherboard slot number (1 to 8, 5136-SD-MCA only).

-d

Check duplicates is off (optional, default on).

+v

The verbose mode is on during load (optional, default off).

The slot number is required for Micro Channel cards. It is used to locate the card and to inform the administrator that it is running on a Micro Channel machine. If a slot number is specified, the port_addr, memory_addr, and interrupt may be omitted, to be determined from the card configuration.

Example 1: (5136-SD card)

The interrupt vector is 3, the card memory address is to be set to c000, the station number is set to 10, the port address is set to 250 and the Data Highway Plus module is to be installed.

sdload /usr/cogent/src/Sddhp i=3 m=c000 s=10 p=250

Example 2: (5136-SD card)

The interrupt vector is 5, the card memory address is to be set to d800, the station number is set to 7, the port address is set to 230 and the Data Highway module is to be installed.

sdload /usr/cogent/src/Sddh i=5 m=d800 s=7 p=230

Example 3: (5136-SD-MCA card)

In a Micro Channel computer, a 5136-SD-MCA card is installed in the first slot (slot 1). The interrupt vector is 5, the card memory address is to be set to d000, the station number is set to 7, the port address is set to 250 and the Data Highway module is to be installed.

sdload /usr/cogent/src/Sddh c=1 i=5 m=d000 s=7 p=250 sl=1

Example 4: (5136-SD-MCA card)

To use the parameters set in the Micro Channel configuration for a card installed in the third slot:

sdload /usr/cogent/src/Sddhp sl=3

Example 5: (5136-SD PCI card)

The card number is 0.

sdload /usr/cogent/src/Sdpdhp P=0

2.9.1. The QNX 4 Loader Disk

The QNX 4 disk is supplied as a DOS formatted disk but all executables are for QNX 4.1 and were compiled under WATCOM C Version 8.5e. QNX 4.2 users can execute these files but the programming examples may require modifications to support 32 bit integers. Installation and executable files were tested using both QNX 4.1 and QNX 4.2.

When you are installing the files, it helps to log in as root because you have to change file permissions. The DOS file system must be running.

If it isn't, type:

Dosfsys &

Create a directory on your hard drive to install the files, then change to that directory.

Copy the files from the floppy (in this case drive a) to the directory.

cp -r /dos/a/* .

Files are copied in without execute permission. To change the permission on a file, type:

chmod +x filename

or to change the execute permission on all files, type:

chmod +x *

Files on the distribution:

README.DOCNotes on the loader disk
SDLOADModule Loader for 5136-SD
SDDOPT.SS1Option Identifier for the 5136-SD rev 2
SDDHP.SS1Data Highway Plus module for the 5136-SD
SDDH.SS1Data Highway module for the 5136-SD
QNX41.TARtar containing all files on the distribution diskette

Programming examples:

ABDH.HHeader file for C code in this directory
DHPD.CData Highway/Data Highway Plus Sample Diagnostics program
DHPDExecutable for above
SB.CSample program which reads/writes integers to PLC-5
SBExecutable for above
SBB.CSample program which uses multiple packet read/writes
SBBExecutable for above
SDSI.CSample program which demonstrates use of interrupts
SDSIExecutable for above

The files have also been collected into a tar format file called qnx41.tar.

Extract the files using the command:

tar -xvf qnx41.tar

This creates a subdirectory, distn.41, of the current directory into which the files are stored. The files are restored with execute permissions intact.