Structures that access the kt dual-port, File name: kt.h, Application: kt emulator for the ktcx card – Rockwell Automation D17846.2.4 CONTROLNET KT EMULA User Manual

Page 36: Description: header file for the kt emulator, Indef kt_h #define kt_h, Define kt_version 0x07 // this value goes up at d, Indef true #define true 1 #endif #ifndef false #d, Dual-port structures, These are structures that allow easy access to, For each of the different dual-port configurati

Advertising
background image

Publication 1784-6.2.4 - September 1997

B-2

Defined Statements for the KTCX Card

Structures that Access the
KT Dual-port

These structures are used to provide easier access to the KT dual-port
and are referenced by the example code sections in the previous
sections.

Important: The following example code is written in Borland C,
version 3.1.

--------------------------------------------------------

File Name: kt.h

Application: KT Emulator for the KTCX Card.

Description: Header file for the KT Emulator

--------------------------------------------------------

#indef KT_H
#define KT_H

#define

KT_VERSION 0x07

// This value goes up at dp+7F9

#define

KT_TxInt

(1<<0)

// Bit Mask for Tx Interrupts

#define

KT_RxInt

(1<<1)

// Bit Mask for Rx Interrupts

#indef TRUE

#define TRUE 1

#endif
#ifndef FALSE

#define FALSE 0

#endif

---------------------------------------------------------

/*Dual-port STRUCTURES

*/

/* These are structures that allow easy access to dual-port bytes */

/*

for each of the different dual-port configurations (loaders, diagnostics etc.) */.

-------------------------------------------------------------

/* For use during communications ( the first two are sub-structures*/

typedef struct
{

signed char shake1;

/* First handshake byte */

signed char shake2;

/* Second handshake byte */

int len;

/* Length of packet, starting with unused1 below */

char unused1[2];
char dst;

/* Destination node address of packet */

char unused2[2];

/* CNTL and TYPE, neither of which are used in KT */

char lsap;

/* LSAP */

char data[1024-6];

/* The rest of mailbox (880 less the above) */

}SENDBOX;

typedef struct
{

signed char shake1;

/* First handshake byte */

signed char shake2;

/* Second handshake byte */

int len;

/* Length of packet starting with src */

char src;

/* Destination of packet */

char lsap;

/* LSAP */

char data[880-6];

/* The rest of the mailbox (880 less the above) */

}RCVBOX;

Advertising