cardInit

cardInit — initializes SST DeviceNet cards.

Synopsis

(cardInit)
(cardInit card_id)
(cardInit [card_id [port [hardware_address [intr [module]]]])
(cardInit PCI)
  

Parameters

card_id
The ID associated with the card initialized by this command. Up to 4 cards can be simultaneously accessed by the same driver, numbered 0 to 3. If not specified, then the next available ID (sequentially from 0) is assigned (see Description below).
port
For ISA cards, the port address as set by the SW1 card switches. See Section 1.2, “Hardware Installation” for details. If not specified, or specified as 0, then the driver will scan for PCI cards (see Description below).
hardware_address
For ISA cards, the hardware location of an unused 16K memory window to be used as the card's dual-port mapped memory block. If not specified, or specified as 0, then the driver will scan for PCI cards (see Description below).
intr
For ISA cards, if intr > 0, then intr specifies the interrupt associated with the card, otherwise the card will use polling mode only. For PCI cards, if intr >= 0, then the interrupt line assigned by the BIOS to the card is used, otherwise the card will use polling mode only. If intr is not specified, then this is equivalent to intr = 0, which as described above, defaults to polling for ISA cards and the assigned interrupt for PCI cards. The assignment intr = -1 should be specified to always force polling mode if desired.
[Note]

Shared interrupts are not supported, so if the same interrupt is associated with more than one card, only the first will use interrupt mode, and the remainder will use polling mode.

module
The name of the firmware file (an SST application module) to be downloaded to the card. If not specified, the default module file loaded is DNSCAN.SS1.

Returns

OK if successful, otherwise

(error "cardInit DR_ERR_CARD_INVALID (time) invalid card: card_id")
(error "cardInit DVN_ERR_NO_CARD (time) No additional 5136-DNP-PCI cards detected")
(error "cardInit DVN_ERR_NO_CARD (time) No 5136-DNP-PCI cards detected")
(error "cardInit DVN_ERR_NO_CARD (time) Card not available")
(error "cardInit DVN_ERR_BAD_IRQ_LEVEL (time) Invalid IRQ level")
(error "cardInit DVN_ERR_BAD_PORT_PASSIVE (time) Card passive port signature invalid")
(error "cardInit DVN_ERR_BAD_PORT_ACTIVE (time) Card active port signature invalid")
(error "cardInit DVN_ERR_MEMMAP (time) Failed to map memory")
(error "cardInit DVN_ERR_FIRMWARE_FILENAME (time) Specified Firmware file not found")
(error "cardInit DVN_ERR_FIRMWARE_WRITE (time) Error writing firmware to card")
(error "cardInit DVN_ERR_CARD_FAILURE (time) tart-up self-test error detected")
(error "cardInit DVN_ERR_FIRMWARE_NOT_RUNNING (time) Firmware failed to execute")

Description

This command initializes one or more SST DeviceNet cards. A card must be initialized before it can be used. At least one card must be initialized from the configuration file to prevent the driver from terminating. The driver can interface with up to 4 cards. Each card is uniquely identified by its card ID, between 0 and 3.

ISA cards must be initilized one at a time, fully specifying the card_id, port and hardware_address parameters.

If either port or hardware_address parameters are 0 or not specified, then the command will scan the system for new PCI card(s) that have not yet been initialized by the driver. If card_id is also not specified, then sequential available IDs are assigned to the cards. If multiple PCI cards are detected and a card_id is specified that is not the first available ID, then the driver skips over those cards that would have corresponded to the intervening IDs.

The (cardInit PCI) form of the command provides a list of PCI cards installed that match any of the known PCI ID signatures for SST DeviceNet cards. No cards are actually initialized. The debug level must be set to at least 5, for example (debug 5). The driver will reply with OK, but will output to stdout a list with the number of cards found for each type and the port, address and irq of each card. (see example)

Example

In the following example, the system will initialize an ISA card as ID 1 at port 0x250 and address 0xD0000. The card will default to polled mode.

(cardInit 1 0x250 0xD000 )

In the next example, the driver will scan for PCI cards in the system, identifying up to 4 cards, and assigning consecutive device IDs. The card(s) will default to interrupt mode, and following on from the previous example, would be assigned IDs of 0, then 2, and then 3.

(cardInit)

In the next example, the driver will scan for PCI cards. Assuming no other cards have been initialized, and 2 cards are detected, the first card is skipped, and the second is assigned an ID of 1 and forced to polling mode. The subsequent cardInit command again detects all the available cards, assigning the first an ID of 0 with interrupt mode, and skipping the second that has already been initialized.

(cardInit 1 0 0 -1)
(cardInit)

In the final example, the driver generates the requested information on the console where the driver was started. This input:

(debug 5)
(cardInit PCI)

would yield results like this:

Probing for PCI cards with signature (0x10B5,0x9050,0x133D,0x10): 1 found
  5136-DNP-CPCI or 5136-DNP-PCI at port=0xFFE0, addr=0xFFB40000, irq=9
Probing for PCI cards with signature (0x10B5,0x9030,0x133D,0x3A): 1 found
  SST-DN3-PCI-1 at port=0xFFF0, addr=0xFFB80000, irq=11
Probing for PCI cards with signature (0x10B5,0x9030,0x133D,0x39): 0 found