ncGetHardwareInfo

NI-CAN

ncGetHardwareInfo

Purpose

Get CAN or LIN hardware information.

Format

NCTYPE_STATUS _NCFUNC_ ncGetHardwareInfo(
NCTYPE_UINT32 CardNumber,
NCTYPE_UINT32 PortNumber,
NCTYPE_ATTRID AttrId,
NCTYPE_UINT32 AttrSize,
NCTYPE_ANY_P AttrPtr);

Input

CardNumber

Specifies the CAN or LIN card number from 1 to Number of Cards, where Number of Cards is the number of CAN and LIN cards in the system. You can obtain Number of Cards using this function with CardNumber = 1, PortNumber =1, and AttrID = Number of Cards.

PortNumber

Specifies the CAN or LIN port number from 1 to Number of Ports, where Number of Ports is the number of ports on the card. You can obtain Number of Ports using this function with PortNumber = 1, and AttrID = Number of Ports.

AttrID

Specifies the attribute to get:

NC_ATTR_VERSION_MAJOR (Version Major)

Returns the major version of the NI-CAN software. Use CardNumber 1 and PortNumber 1 as inputs.

The major version is the 'X' in X.Y.Z.

NC_ATTR_VERSION_MINOR (Version Minor)

Returns the minor version of the NI-CAN software. Use CardNumber 1 and PortNumber 1 as inputs.

The minor version is the 'Y' in X.Y.Z.

NC_ATTR_VERSION_UPDATE (Version Update)

Returns the update version of the NI-CAN software. Use CardNumber 1 and PortNumber 1 as inputs.

The update version is the 'Z' in X.Y.Z.

NC_ATTR_VERSION_PHASE (Version Phase)

Returns the phase of the NI-CAN software. Use CardNumber 1 and PortNumber 1 as inputs.

Phase 1 specifies Alpha, phase 2 specifies Beta, and phase 3 specifies Final release. Unless you are participating in an NI-CAN beta program, you will always see 3.

NC_ATTR_VERSION_BUILD (Version Build)

Returns the build of the NI-CAN software. Use CardNumber 1 and PortNumber 1 as inputs.

With each software development phase, subsequent NI-CAN builds are numbered sequentially. A given Final release version always uses the same build number, so unless you are participating in an NI-CAN beta program, this build number is not relevant.

NC_ATTR_VERSION_COMMENT (Version Comment)

Returns any special comment on the NI-CAN software. AttrPtr must point to a buffer for the string, and AttrSize specifies the number of characters in that buffer. Use CardNumber 1 and PortNumber 1 as inputs.

This string is normally empty for a Final release. In rare circumstances, an NI-CAN prototype or patch may be released to a specific customer. For these special releases, the version comment describes the special features of the release.

NC_ATTR_NUM_CARDS (Number of Cards)

Returns the number of NI-CAN cards in the system. Use CardNumber 1 and PortNumber 1 as inputs.

If you are displaying all hardware information, you get this attribute first, then iterate through all CAN cards with a For loop. Inside the For loop, get all card-wide attributes including Number Of Ports, then use another For loop to get port-wide attributes.

NC_ATTR_HW_SERIAL_NUM (Serial Number)

Card-wide attribute that returns the serial number of the card. Use the desired CardNumber, and PortNumber 1 as inputs.

NC_ATTR_HW_FORMFACTOR (Form Factor)

Card-wide attribute that returns the form factor of the card. Use the desired CardNumber, and PortNumber 1 as inputs.

The returned Form Factor is an enumeration.

NC_HW_FORMFACTOR_PCI PCI
NC_HW_FORMFACTOR_PXI PXI
NC_HW_FORMFACTOR_PCMCIA PCMCIA
NC_HW_FORMFACTOR_AT AT
NC_HW_FORMFACTOR_USB USB

NC_ATTR_HW_SERIES (Series)

Card-wide attribute that returns the series of the card. Use the desired CardNumber, and PortNumber 1 as inputs.

Series 1 hardware products use the Intel 82527 CAN controller.

Series 2 hardware products use the Philips SJA1000 CAN controller, plus improved RTSI synchronization features.

The returned Series is an enumeration.

NC_HW_SERIES_1 Series 1
NC_HW_SERIES_2 Series 2

NC_ATTR_NUM_PORTS (Number of Ports)

Card-wide attribute that returns the number of ports on the card. Use the desired CardNumber, and PortNumber 1 as inputs.

If you are displaying all hardware information, you get this attribute within the For loop for all cards, then iterate through all CAN ports to get port-wide attributes.

NC_ATTR_TRANSCEIVER_TYPE (Transceiver Type)

This port-wide attribute returns the type of transceiver. Use the desired CardNumber and PortNumber as inputs.

For hardware other than Series 2 XS cards, the transceiver type is fixed. For Series 2 XS cards, the transceiver type reflects the most recent value specified by MAX or ncSetAttribute.

This attribute is not supported on the PCMCIA form factor.

This attribute uses the following values:

0 (High-Speed)

Transceiver type is High-Speed (HS).

1 (Low-Speed/Fault-Tolerant)

Transceiver type is Low-Speed/Fault-Tolerant (LS).

2 (Single Wire)

Transceiver type is Single Wire (SW).

3 (External)

Transceiver type is External. This transceiver type is available on Series 2 XS cards only. For more information, refer to ncSetAttribute.

4 (Disconnect)

Transceiver type is Disconnect. This transceiver type is available on Series 2 XS cards only. For more information, refer to ncSetAttribute.

5 (LIN)

Transceiver type is LIN.

NC_ATTR_INTERFACE_NUM (Interface Number)

Port-wide attribute that returns the interface number of the port. Use the desired CardNumber and PortNumber as inputs.

The interface number is assigned to a physical port using the Measurement & Automation Explorer (MAX). The interface number is used as a string in the Frame API (for example, "CAN0"). The interface number is used for the Interface input in the Channel API.

AttrSize

Size of the attribute in bytes. Unless stated otherwise, AttrSize must be 4.

Output

AttrPtr

Pointer used to return attribute value. Unless stated otherwise, AttrPtr must point to NCTYPE_UINT32.

Return Value

Status of the function call, returned as a signed 32-bit integer. Zero means the function executed successfully. Negative specifies an error, meaning the function did not perform expected behavior. Positive specifies a warning, meaning the function performed as expected, but a condition arose that might require attention. For more information, refer to ncStatusToString.

Description

This function provides information about available CAN and LIN cards, but does not require you to open/start sessions. First get Number of Cards, then loop for each card. For each card, you can get card-wide attributes (such as Form Factor), and you also can get the Number of Ports. For each port, you can get port-wide attributes such as the Transceiver.