32-bit api reference guide windows nt/95card interface dll 32-bit api reference guide sst, a...

28
5136-DN/5136-DNP Card Interface DLL 32-Bit API Reference Guide Windows NT/95 Version 1.13 50 Northland Road, Waterloo, Ontario N2V 1N3 (519) 725-5136 fax (519) 725-1515 © 1999 SST, a division of Woodhead Canada Limited Printed in Canada

Upload: others

Post on 23-Jan-2021

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

5136-DN/5136-DNPCard Interface DLL

32-Bit API Reference Guide

Windows NT/95

Version 1.13

50 Northland Road, Waterloo, Ontario N2V 1N3(519) 725-5136 fax (519) 725-1515

© 1999 SST, a division of Woodhead Canada LimitedPrinted in Canada

Page 2: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

© 1999 SST, a division of Woodhead Canada Limited i

Publication Name : Publication Revision:

Date Printed:

dncdll32.doc1.132/11/99

© 1999 SST, a division of Woodhead Canada LimitedSST is a trademark of Woodhead Industries, Inc.

--This Document Applies To --

DNCARD32.DLL for the5136-DN, 5136-DN-PCM, 5136-DN-104, and

derivative Interface Cards.

Page 3: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

© 1999 SST, a division of Woodhead Canada Limited ii

Table of Contents1 Introduction 1

1.1 Purpose of this Document 1

1.2 The Card Interface DLL 1

1.3 5136-DN Derivative Cards 12 Shared Memory Interface 2

2.1 Introduction 2

2.2 Host Interface Memory Map 2

2.3 Application Module Header 22.3.2 Application Module Header 32.3.3 IRQ Control / Status 32.3.4 CAN Status Word 4

3 Application Organization 63.1 Introduction 6

3.2 Services 6

3.3 Application Stack 6

3.4 Application Operation 64 Card Interface DLL API 7

4.1 Introduction 74.1.1 DNC_CancelWaitIrq 74.1.2 DNC_CloseCard 84.1.3 DNC_ClrIrqMask 84.1.4 DNC_Driver 94.1.5 DNC_FreeCardPtr 94.1.6 DNC_FreeDriver 104.1.7 DNC_GetCardPtr 104.1.8 DNC_InterruptCard 114.1.9 DNC_LoadDriver 114.1.10 DNC_OpenCard 124.1.11 DNC_QueryLogicalIrq 144.1.12 DNC_ReadBit 144.1.13 DNC_ReadBlock 154.1.14 DNC_ReadByte 154.1.15 DNC_ReadHC 164.1.16 DNC_ReadWord 174.1.17 DNC_SetAccessTimeout 174.1.18 DNC_SetIrqMask 184.1.19 DNC_ToggleBit 184.1.20 DNC_Version 194.1.21 DNC_WaitIrq 194.1.22 DNC_WriteBit 204.1.23 DNC_WriteBlock 214.1.24 DNC_WriteByte 224.1.25 DNC_WriteHC 234.1.26 DNC_WriteWord 24

Appendix A Technical Support 25

Page 4: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 1

1 Introduction

1.1 Purpose of this Document

This document is a reference guide for the 32-bit Application Programming Interface (API) of the Card InterfaceDLL for the 5136-DN and derivative interface cards.

1.2 The Card Interface DLL

The Card Interface DLL (DNCARD32.DLL) abstracts the hardware details of the 5136-DN and derivative interfacecards to provide a uniform interface for applications and DLLs independent of the actual hardware.

Applications and DLLs that use the Card Interface DLL for all access to the card are hardware independent.

1.3 5136-DN Derivative Cards

5136-DN derivative cards are based on the SST 5136-DN interface card. They:

• conform to the host interface memory layout of the 5136-DN

• run the same (or 100% compatible) software modules

• may not be 100% hardware compatible. Differences in configuration and control signals (I/O mapped boardcontrol registers in the 5136-DN) are handled by the Card Interface DLL.

Page 5: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 2

2 Shared Memory Interface

2.1 Introduction

The interface between the card and the host application is implemented using shared memory and one interruptsignal in each direction.

2.2 Host Interface Memory Map

The 5136-DN card has 16K bytes of shared RAM accessible by the host application. The following table illustratesthe memory layout.

Address Description

Hex Decimal

0000H 0 Application Module Header007FH 127 (common to all app. Modules)

0080H 128 Defined by application module3FFFH 16K

2.3 Application Module Header

Applications for the 5136-DN card are based on an event-driven kernel. This kernel provides an abstract hardwareinterface, startup self-diagnostics and common services such as timers and event management.

The kernel reserves the first 128 bytes of the host interface block for loader interface and run-time status informationcommon to all 5136-DN applications. This area is called the Application Module Header.

Data Type Descriptions

Data Type Description

CHAR 8-bit ASCII character

UINT1 unsigned integer, 1 byte

SINT1 signed integer, 1 byte

UINT2 unsigned integer, 2 bytes

SINT2 signed integer, 2 bytes

UINT4 unsigned integer, 4 bytes

Byte Ordering

The 5136-DN interface card uses Intel style byte ordering for multi-byte entities LSB - low address and MSB - highaddress. If your host system uses Motorola byte ordering (MSB - low address and LSB - high address) you mustcompensate for the byte ordering in software.

The following macro will compensate for byte ordering in a 16 bit data entity.#define SWAP_WORD (WordData) ((WordData<<8) | (WordData>>8))

Page 6: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 3

2.3.2 Application Module Header

The following table defines the layout of the Application Module Header. The non-shaded sections of the table arecommon to all application modules for the 5136-DN. The shaded areas are optional or the function is determined bythe application module. See the application module reference guide for details.

Offset Name Data Type Description

0000h ModuleType CHAR[2] "DN" (0444eh) = card OK"ER" (04552h) = fatal error

0002h WinSize UINT2 Set by loader to indicate host interface window size.0 = 16K, 1 = 32K, 2 = 64K, 3=128K

0004h CardId UINT2 For host application use

0006h Kernel Id UINT2 Kernel identification0x01 = CAN 2.0A kernel0x02 = CAN 2.0B kernel

0008h Kernel Rev UINT2 Kernel Revision

000ah ModuleId UINT2 Module Id

000ch ModuleRev UINT2 Module revision

000eh NetSerial UINT2 DeviceNet serial number

0012h CardType CHAR[16] Card typei.e. "5136-DN"

0022h CardSerial CHAR[8] Card Serial number

002ah IrqControl1 UINT2 Card interrupt controlSee section 2.3.3

002ch IrqStatusA1 UINT1 Card interrupt status

002dh IrqStatusB1 UINT1 See section 2.3.3

002eh MainCode1 UINT2 Main Application Error Code

0030h CanStatus UINT2 CAN status word

0032h CanTx UINT2 CAN transmit counter. Incremented when messages aresubmitted to the CAN controller.

0034h CanAck UINT2 CAN ack error counter. Incremented when a transmit message isaborted due to lack of acknowledgment from other stations.When CanAck is incremented, CanTx is decremented tocompensate for message not actually transmitted.

0036h CanRx2 UINT2 CAN receive counter. Incremented when messages arereceived. Messages that fail the receive filter still incrementCanRx.

0038h CanError UINT2 CAN communication error counter. Incremented when a CANframe error is detected.

003ah CanLost2 UINT2 CAN lost messages counter. Incremented when a CAN messageis received before the previous one is queued.

003ch CanOverrun2 UINT2 CAN receive queue overrun counter. Incremented when a CANmessage is lost due to a full receive queue.

003eh AddCode1 UINT2 Additional Application Error Code

0040h Message CHAR[64] When ModuleType is "DN", contains the module identificationstring. When ModuleType is "ER”, contains the kernel errorstring.

0080h Application1 Undefined Application host interface. The format of this area is defined bythe application module.

1 Format / meaning defined by the app. module, see module documentation2 May not be supported by the app. module, see module documentation

2.3.3 IRQ Control / Status

The IRQ control and status areas implement up to 8 logical interrupts using only 1 physical interrupt signal.

IRQ Control Word (002Ah)

The IRQ Control Word contains 8 bits which enable the generation of a physical interrupt for each of up to 8 logicalinterrupt sources. This word is written by the host not by the scanner.

Page 7: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 4

Bit

Offset 7 6 5 4 3 2 1 0

002Ah Application Specific IRQ Control Bits

002Bh Reserved

IRQ Status Byte A/B (002Ch / 002Dh)

The IRQ Status Bytes each contain 8 bits which indicate up to 8 logical interrupts. The IRQ Status Bytes indicatelogical interrupts even if the physical interrupt has been disabled via the IRQ Control Word.

The scanner and the host application both write these bytes. You must follow the protocol described below to avoidmissed interrupts.

Bit

Offset 7 6 5 4 3 2 1 0

002Ch Application Specific IRQ Status Bits

002Dh Application Specific IRQ Status Bits

IRQ Status Access Protocol

The card writes IrqStatusB first, followed by IrqStatusA. The host application must:

1. Read IrqStatusA and store the result in a temporary variable ‘A’.

2. Clear relevant bits in IrqStatusA.

3. Read IrqStatusB and store the result in a temporary variable ‘B’.

4. Clear relevant bits in IrqStatusB.

5. Logically OR the results in the temporary variables ‘A’ and ‘B’ to determine IRQ status flags. If a bit is set, thecorresponding logical interrupt has occurred.

If the scanner updates IrqStatusA or IrqStatusB at the same time as the host attempts to clear the byte, the host clearoperation will fail. False logical interrupt indications can occur. The host application must be prepared to deal withfalse logical interrupt indications.

2.3.4 CAN Status Word

The CAN status word contains bit flags that indicate the current status of the CAN interface and low-level interrupthandlers.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

A4 A3 A2 A1 Res. BP ER ML RO TO TA A BO BW OL

A1,A2,A3,A4 - Application Status Bits

These status bits are application specific. Refer to the application module documentation for implementation details.

BP - Bus Power Detect

The BP bit indicates the presence or absence of network power. The BP bit is clear if the physical bus interface innot powered.

ER - CAN Bus Error

ER is set each time a CAN communication error is detected.

An excessive number of errors indicates a faulty physical medial component (cable, connector etc.) or excessivenoise from external sources (check cable routing and shield connection).

Page 8: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 5

ML - Message Lost

ML is set when a message is received from the bus while the previous message is still in the receive buffer.

ML indicates a lower layer application error (in the kernel interrupt handler). Report this condition to SST TechnicalSupport.

RO - Receive Buffer Overrun

RO is set when messages are received from the bus faster than the application can process them.

RO indicates an upper layer application error (in the application module). Report this condition to SST TechnicalSupport.

TO - Transmit Timeout

TO is set when a pending transmission is incomplete within 25-50ms.

TO indicates excessive message traffic at a higher priority than the aborted message.

TA - Transmit Ack Error

TA is set when a pending transmission is not acknowledged within 25-50ms.

TA indicates that no other nodes are present (or on-line) on the network

A - Network activity detected

A is set when any message is transmitted or received.

BO - Bus off

BO is set when an excessive number of communication errors is detected and the CAN chip automatically goes off-line. BO is cleared when the CAN interface is re-initialized.

BO indicates a serious communication fault such as incorrect baud rate or physical layer error (short, open etc).

BW - Bus warning

BW is set when an abnormal number of communication errors is detected and the CAN chip stops transmitting errorframes. BW is cleared when the error count returns to normal levels or the CAN interface is re-initialized.

BW indicates a potentially serious communication fault such as out-of-tolerance baud rate or physical layer error(electrical noise, signal attenuation, intermittent connections etc).

OL - Online

OL indicates that the CAN interface has been initialized and is ready to communicate.

Page 9: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 6

3 Application Organization

3.1 Introduction

The Card Interface DLL provides a common interface that abstracts the physical hardware to allow one applicationor DLL to support different hardware without changes.

3.2 Services

The Card Interface DLL provides the following services:

• DLL revision information

• Hardware driver management

• Card management (multiple cards, multiple clients)

• Card abstraction using handles eliminates the need for the application to be aware of memory or I/Oaddresses

• Interrupt support (notification messages)

• Read/Write services at the block, word, byte and bit level.

3.3 Application Stack

Application< Application API

Card Interface DLL< Driver API

Hardware Driver DLLDevice Driver(if required)

Hardware

3.4 Application Operation

The typical sequence of events for an application using the Card Interface DLL is:

1. Check the Card Interface DLL version if a specific version is required (DNC_Version)

2. Load the hardware driver (DNC_LoadDriver)

3. Check the Hardware Driver DLL version if a specific version is required (DNC_Driver)

4. Open a card connection (DNC_OpenCard)

5. Access the card as required until application termination or card connection is no longer needed

6. Close the card connection (DNC_CloseCard)

7. Unload the driver (DNC_FreeDriver)

Page 10: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 7

4 Card Interface DLL API

4.1 Introduction

The Card Interface DLL API is the set of functions available to application layer programs. These functions are theonly interface to the card that the application layer should use.

4.1.1 DNC_CancelWaitIrq

Description

Cancel any pending DNC_WaitIrq requests.

NOTE: A DNC_CancelWaitIrq call will suspend the current thread if no physical interrupts have occurred or arepending. Care must be taken to ensure the application does not call DNC_CancelWaitIrq if the following conditionsare true:

• Physical interrupts are no longer active and no physical interrupts have occurred since the lastDNC_CancelWaitIrq request and DNC_WaitIrq will no longer be called or is not already waiting onreceipt of an interrupt.

• DNC_WaitIrq will no longer be called or is not already waiting on receipt of an interrupt

PrototypeBOOL WINAPI DNC_CancelWaitIrq( DWORD CardHandle )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0105hex App Irq Access denied

2000 011ahex Card Access Timeout (default 1 second)

Page 11: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 8

4.1.2 DNC_CloseCard

Description

Close a card connection.

PrototypeBOOL WINAPI DNC_CloseCard( DWORD CardHandle )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 011ahex Card Access Timeout (default 1 second)

4.1.3 DNC_ClrIrqMask

Description

Clear one or more bits in the IRQ Control Word (disables generation of a physical interrupt for one or more logicalinterrupts).

PrototypeBOOL WINAPI DNC_ClrIrqMask( DWORD CardHandle, WORD IrqMask )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

IrqMask Interrupt mask word containing 1’s in the bit positionscorresponding to logical interrupts to be disabled

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 0105hex App Irq Access denied

2000 011ahex Card Access Timeout (default 1 second)

Page 12: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 9

4.1.4 DNC_Driver

Description

Retrieve hardware driver version information. The driver version is returned in both numeric and human-readablestring format.

PrototypeBOOL WINAPI DNC_Driver( TCHAR *Buffer, WORD *Version, DWORD Size )

ArgumentsArgument Description

Buffer Driver identification string buffer

Version Minor revision (LSB)Major revision (MSB)

Size Buffer sizeThe Identification string is truncated to fit

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

4.1.5 DNC_FreeCardPtr

Description

Free a pointer retrieved from a previous DNC_GetCardPtr call.

PrototypeBOOL WINAPI DNC_FreeCardPtr( DWORD CardHandle, volatile void *ThePointer)

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

ThePointer Pointer to be freed

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0100hex General failure

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 0114hex Invalid Pointer

2000 011ahex Card Access Timeout (default 1 second)

Page 13: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 10

4.1.6 DNC_FreeDriver

Unload the Hardware Driver DLL.

PrototypeBOOL WINAPI DNC_FreeDriver( void )

Arguments

This function has no arguments.

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

4.1.7 DNC_GetCardPtr

Description

Get a pointer to the start of a card’s host interface memory.

PrototypeBOOL WINAPI DNC_GetCardPtr( DWORD CardHandle, volatile void **ThePointer)

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

ThePointer Pointer to be modified

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0100hex General failure

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 011ahex Card Access Timeout (default 1 second)

IMPORTANT

When using overlapped cards, a call to DNC_GetCardPtr locks the appropriate 5136-DN interface card in memory.You must call DNC_FreeCardPtr to free the pointer before access to other overlapped cards is possible.

Page 14: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 11

4.1.8 DNC_InterruptCard

Generate a physical interrupt to 5136-DN card.

PrototypeBOOL WINAPI DNC_InterruptCard( DWORD CardHandle )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0104hex Card Irq access denied

2000 011ahex Card Access Timeout (default 1 second)

4.1.9 DNC_LoadDriver

Description

Load the hardware driver DLL (SSDN32.DLL).

PrototypeBOOL WINAPI DNC_LoadDriver( TCHAR *DriverName )

ArgumentsArgument Description

DriverName Name and optional path to the hardware driver DLLi.e. “c:\windows\system\ssdn32.dll”

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0000hex Driver loaded

2000 0001hex Driver not found

2000 0002hex Invalid Driver

2000 0007hex Null pointer

Page 15: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 12

4.1.10 DNC_OpenCard

Description

Open a card connection. The card handle returned by this function is used by the DLL client to identify the card toall other services.

PrototypeBOOL WINAPI DNC_OpenCard( DWORD *CardHandle, TCHAR *CardName, void *Module, DWORD ModuleId,

WORD ShareFlags, WORD LoadFlags)

ArgumentsArgument Description

CardHandle Upon successful completion of DNC_OpenCardCardHandle is used for subsequent API calls

CardName The name assigned to the interface card duringhardware installation (stored in registry)

Module Embedded module binary pointerSee SS_EMBEDDED loader flag

ModuleId The id of the required application module0 = Any module (loader is inhibited)

ShareFlags Connection share flags (see Share Flags table below)

LoadFlags Application module loader flags (see Load Flags tablebelow)

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0100hex General failure

2000 0101hex Card handle not available

2000 0103hex Write Access denied (sharing violation)

2000 0104hex Card Irq Access denied (sharing violation)

2000 0105hex App Irq Access denied (sharing violation)

2000 0106hex Hardware Control Access denied (sharing violation)

2000 0107hex Overlap conflict

2000 0108hex Configuration not found (invalid CardName)

2000 0109hex Card not found

2000 010ahex Memory conflict

2000 010bhex Invalid module / Requested module not loaded

2000 010chex Card not responding (application did not run)

2000 010dhex Card self-diagnostic failure

2000 0116hex Invalid I/O address

2000 0117hex Invalid I/O length

2000 0118hex Invalid memory address

2000 0119hex Invalid memory length

2000 011ahex Card Access Timeout (default 1 second)

2000 011chex Memory test failure

2000 011dhex Module load request denied

Page 16: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 13

ShareFlags

This argument controls multiple application arbitration for a single card.Bit Name Description

0 SS_WRITE Card opened for shared write access1

1 SS_XWRITE Card opened for exclusive write access1

2 SS_HCONTROL Card opened for exclusive hardware control access

3 SS_CARDIRQ Card opened for exclusive card interrupt access(interrupts from the application to the card)

4 SS_APPIRQ Card opened for exclusive application interrupt access(interrupts from the card to the application)

5-7 reserved Reserved, set to 0

8 SS_USER1** Exclusive user access 1

9 SS_USER2** Exclusive user access 2

10 SS_USER3** Exclusive user access 3

11 SS_USER4** Exclusive user access 4

12-13 reserved Reserved, set to 0

14 SS_OVERLAP Overlapped cards are supported

15 reserved Reserved, set to 0

** Exclusive user access flags are used to avoid conflicts between applicationssharing access to the same card. The meaning of these flags is card / modulespecific.

1 Write access is required for module loading

NOTE: Shareflags equal to zero requests a read-only connection.

LoadFlags

This argument controls the application module loader and also selects some connection modes of operation.Bit Name Description

0 SS_REPLACE Replace already loaded module if no otherconnections have write access

1 SS_RELOAD Reload the specified module if no otherapplications have write access

2 SS_EMBEDDED Module is embedded in application, Moduleargument points to start of module binary

3-15 Reserved Always 0

Page 17: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 14

4.1.11 DNC_QueryLogicalIrq

Description

Check for (and clear) a logical interrupt.

PrototypeBOOL WINAPI DNC_QueryLogicalIrq( DWORD CardHandle, WORD IrqMask, BOOL *IrqStatus )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

IrqMask Interrupt mask word containing 1’s in the bit positionscorresponding to logical interrupts to be checked

IrqStatus True / False , Interrupt present / not present

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 011ahex Card Access Timeout (default 1 second)

4.1.12 DNC_ReadBit

Description

Read a bit from the card host interface memory.

PrototypeBOOL WINAPI DNC_ReadBit( DWORD CardHandle, DWORD Offset, DWORD Bit, BYTE *Buffer)

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the byte containing the target bit

Bit The target bit number (0-7)

Buffer Contains status of bit, Set or Clear

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 010ehex Invalid offset

2000 010fhex Invalid bit number

2000 011ahex Card Access Timeout (default 1 second)

Page 18: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 15

4.1.13 DNC_ReadBlock

Description

Read a block from the card host interface memory.

PrototypeBOOL WINAPI DNC_ReadBlock( DWORD CardHandle, DWORD Offset, void *Block, DWORD Size )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the first byte of the block

Block Destination of data block read

Size Number of bytes to read

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 010ehex Invalid Offset

2000 0110hex Invalid Size

2000 011ahex Card Access Timeout (default 1 second)

4.1.14 DNC_ReadByte

Description

Read a byte from the card host interface memory.

PrototypeBOOL WINAPI DNC_ReadByte( DWORD CardHandle, DWORD Offset, BYTE *Buffer )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the target byte

Buffer Buffer for data read

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 010ehex Invalid Offset

2000 011ahex Card Access Timeout (default 1 second)

Page 19: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 16

4.1.15 DNC_ReadHC

Description

Read a hardware control signal.

PrototypeBOOL WINAPI DNC_ReadHC( DWORD CardHandle, WORD Signal, WORD *Buffer )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Signal Hardware control signal ID

Buffer Upon return contains signal information

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 0106hex Hardware Control access denied

2000 0111hex Invalid Signal Id

2000 011ahex Card Access Timeout (default 1 second)

Signal IDSignal ID Name Access Description

0 SS_LED R/W 1 = red2 = green

1 SS_WINSIZE

R Memory window size in bytes(16K = 16384)

2 SS_BANK R Bank select Represents thephysical memory bank on thecard

3-127 reserved

128+ card specific

Page 20: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 17

4.1.16 DNC_ReadWord

Description

Read a word from the card host interface memory.

PrototypeBOOL WINAPI DNC_ReadWord( DWORD CardHandle, DWORD Offset, WORD *Data )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the first byte of the word (LSB)

Data Destination of data word read

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 010e hex Invalid Offset

2000 011ahex Card Access Timeout (default 1 second)

4.1.17 DNC_SetAccessTimeout

Description

Set the card access timeout delay.

PrototypeBOOL WINAPI DNC_SetAccessTimeout( DWORD CardHandle, DWORD Timeout )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Timeout The access timeout delay in milliseconds (default 1sec)

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

Page 21: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 18

4.1.18 DNC_SetIrqMask

Description

Set one or more bits in the IRQ Control Word (enables generation of a physical interrupt for one or more logicalinterrupts).

PrototypeBOOL WINAPI DNC_SetIrqMask( DWORD CardHandle, WORD IrqMask )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

IrqMask Interrupt mask word containing 1’s in the bit positionscorresponding to logical interrupts to be enabled

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 0105hex App Irq Access denied

2000 011ahex Card Access Timeout (default 1 second)

4.1.19 DNC_ToggleBit

Description

Toggle the state of a bit in the card host interface memory.

PrototypeBOOL WINAPI DNC_ToggleBit( DWORD CardHandle, DWORD Offset, DWORD Bit )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the byte containing the target bit

Bit The target bit number (0-7)

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0103hex Write access denied

2000 010ehex Invalid Offset

2000 010fhex Invalid Bit number

2000 011ahex Card Access Timeout (default 1 second)

Page 22: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 19

4.1.20 DNC_Version

Description

Retrieve DLL version information. The DLL version is returned in both numeric and human-readable string format.

PrototypeBOOL WINAPI DNC_Version( TCHAR *Buffer, WORD *Version, DWORD Size )

ArgumentsArgument Description

Buffer DLL identification string buffer

Version Minor revision (LSB)Major revision (MSB)

Size Buffer sizeThe Identification string is truncated to fit

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0007hex Null pointer

4.1.21 DNC_WaitIrq

Description

Wait for a card interrupt. The calling task is suspended until an interrupt from the card is received. This functionreturns immediately if an interrupt is already pending. A call to DNC_CancelWaitIrq will cancel any DNC_WaitIrqcalls waiting on a physical interrupt.

PrototypeBOOL WINAPI DNC_WaitIrq( DWORD CardHandle)

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0105hex App Irq access denied

2000 011ahex Card Access Timeout (default 1 second)

Page 23: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 20

4.1.22 DNC_WriteBit

Description

Write a bit in the card host interface memory.

PrototypeBOOL WINAPI DNC_WriteBit( DWORD CardHandle, DWORD Offset, DWORD Bit, BYTE Data )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the byte containing the target bit

Bit The target bit number (0-7)

Data Value to be written to the target bit (any non-zero valuecauses a ‘1’ to be written to the bit)

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

Error CodesValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 010ehex Invalid Offset

2000 010fhex Invalid bit

2000 011ahex Card Access Timeout (default 1 second)

Page 24: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 21

4.1.23 DNC_WriteBlock

Description

Write a block to the card host interface memory.

PrototypeBOOL WINAPI DNC_WriteBlock( DWORD CardHandle, DWORD Offset, void *Block, DWORD Size )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the first byte of the block

Block The block to be written

Size Number of bytes to write

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0007hex Null pointer

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 010ehex Invalid Offset

2000 0110hex Invalid Size

2000 011ahex Card Access Timeout (default 1 second)

Page 25: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 22

4.1.24 DNC_WriteByte

Description

Write a byte to the card host interface memory.

PrototypeBOOL WINAPI DNC_WriteByte( DWORD CardHandle, DWORD Offset, BYTE Data )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the target byte

Data The byte value to be written

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 010ehex Invalid Offset

2000 011ahex Card Access Timeout (default 1 second)

Page 26: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 23

4.1.25 DNC_WriteHC

Description

Write a hardware control signal.

PrototypeBOOL WINAPI DNC_WriteHC( DWORD CardHandle, WORD Signal, WORD Data )

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Signal Hardware control signal ID

Data New signal data

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0106hex Hardware Control Access denied

2000 0111hex Invalid Signal Id

2000 0112hex Signal Read Only

2000 0113hex Invalid Data Value

2000 011ahex Card Access Timeout (default 1 second)

Signal IDSignal

IDName Access Description

0 SS_LED R/W 1 = red2 = green

1 SS_WINSIZE R Memory window size in bytes (16K= 16384)

2 SS_BANK R Bank selectRepresents the physical memorybank on the card

3-127 reserved

128+ card specific

Page 27: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 24

4.1.26 DNC_WriteWord

Description

Write a word to the card host interface memory.

PrototypeBOOL WINAPI DNC_WriteWord( DWORD CardHandle, DWORD Offset, WORD Data)

ArgumentsArgument Description

CardHandle The handle returned by DNC_OpenCard

Offset The offset from the start of the host interface memoryto the first byte of the word (LSB)

Data The word value to be written

ReturnsValue Description

TRUE Success

FALSE Error, use GetLastError to retrieve error code

ErrorsValue Description

2000 0003hex Driver not loaded

2000 0102hex Invalid CardHandle

2000 0103hex Write Access denied

2000 010ehex Invalid Offset

2000 011ahex Card Access Timeout (default 1 second)

Page 28: 32-Bit API Reference Guide Windows NT/95Card Interface DLL 32-Bit API Reference Guide SST, a division of Woodhead Canada Limited 1 1 Introduction 1.1 Purpose of this Document This

Card Interface DLL 32-Bit API Reference Guide

SST, a division of Woodhead Canada Limited 25

Appendix A Technical Support

Before you call for help ...

Please ensure that you have the following information readily available before calling for technical support.

• Card type and serial number

• Computer’s make, model and hardware configuration (other cards installed)

• Operating system type and version

• Details of the problem you are experiencing: application module type and version, target network, circumstancesthat caused the problem

Getting Help

Technical support is available during regular business hours (eastern standard time) or by fax, mail, or e-mail.

Technical SupportSST, a division of Woodhead Canada Limited50 Northland DriveWaterloo, Ontario, CanadaN2V 1N3

Phone (518) 725-5136Fax (519) 725-1515

e-mail: [email protected] site: http://www.sstech.on.ca