Rev 15 | Blame | Compare with Previous | Last modification | View Log | Download
/******************************************************************************** Copyright 1995 DeltaLink bv. All Rights Reserved.******************************************************************************** DeltaLink Configuration Table Header file** File: val_ct.h** Contains definitions for the ct's for the DeltaLink Valmet driver*/#ifndef _VAL_CT_DEFS_INCLUDED /* { */#define _VAL_CT_DEFS_INCLUDED 1#ifndef HPUX#pragma pack(1)#else#pragma HP_ALIGN HPUX_WORD PUSH#endif/* all panels for the Valmet driver */#define VAL_MBX 0 /* Table 0 contains the Profibus Mailbox Tag */#define DEC_MBX 1 /* Table 1 contains DECODERS mailbox tags */#define SETS 2 /* Table 2 contains set definitions */#define DEVICES 3 /* Table 3 contains device definitions */// definition of device nametypedef char DEVNAME[18];/** physical device*/typedef struct{TAG rcvmbx;int max_msg; /* max no. of messages for the rcvmbx */COMPORT * port;char name[18]; /* name of the communication port */int error;int type;int critical;int initialised; /* marker: 1 when port was initialised */} VAL_PHYS_DEV;/** dataset defaults*/typedef struct{int start; /* start = 0 */int len; /* length of dataset in words */int direction;int bit_direct;int bound_offset;int boundary;// index in entries array for first entry belonging to this setunsigned int first_set_entry;// index in entries array for last entry belonging to this setunsigned int last_set_entry;// flag indicating whether definition is loaded in Valmet deviceint is_in_device;// name of the device to which this dataset belongs. This is a laisy solution */DEVNAME devname;// the number of words that we must request/expect to get back// this number should equal the number of sw entries in the setu16 actual_nr_words;} VAL_DATASET_DEF;/** definition of a MCI mailbox info structure*/typedef struct{TAG mbx; /* MCI mailbox */ushort nr_msg; /* maximum number of messages in mailbox */ushort lan; /* mailbox via lan */} MCI_MBX;/** information of a Tag in the DataSet overlay*/typedef struct{ushort address; /* address in the received data */ushort num; /* bit number or string length */ushort conv; /* conversion to perform on data */char *m_ptr; /* pointer to buffer if type is message */char m_len; /* length of message buffer */} TAGINFO;/** CT structure to read in the Valmet defintions*/typedef struct{TAG enabledrv; /* disable/enable (0/1) driver, no tag means enabled */TAG rcvmbx; /* mailbox of the Valmet driver */} CT_VALMET;/** CT structure to read in the device defintions*/typedef struct{DEVNAME devname; /* logical device name */u16 comport; /* communication port used */u16 retries; /* no. of retries in case of an error */u16 timeout; /* # secs before timeout */TAG status; /* status tag */TAG redefine; /* tag to command the driver to redefine tables in Valmet */TAG rdisable; /* read disable tag for this device */TAG wdisable; /* write disable tag for this device */TAG tcpconn; /* TCP disconnect/connect = 0/1; no tag means always connected */u16 tcpport; /* TCP port number */char tcpaddr[48]; /* TCP address *///uchar * buf[2]; /* READ / WRITE buffers */} CT_DEVICE;/** CT structure to read in the datasets*/typedef char SETNAME[18];typedef struct{TAG sndmbx; /* decoder mailbox tag */TAG control; /* dataset control tag */char name[50]; /* name of the dataset */SETNAME setname; /* name of the set */char devname[18];char dsname[50];} CT_DATASET;// definition of the data types in C. Must match the CT-def !!!typedef enum {T_UNKNOWN = 0,T_DIGITAL = 1,T_ANALOG = 2,T_COUNTER = 3,T_LAST} CT_DATATYPE;// the maximum number of words that a set can use to be defined in the// Valmet device. Note that for an analog or digital required// 2 words to be defined and a counter 4 words.// As a result the maximum numer in a set varies between 0x20// and 0x10#define MAX_WORDS_FOR_SET (0x40)// the maximum number of single width entries that a set can use// to be defined in the Valmet device. A single width entry uses// 2 words. Note that for an analog or digital 1 entry is required// (see above) and for a counter 2.#define MAX_SW_ENTRIES_IN_SET (MAX_WORDS_FOR_SET / 2)// definition of the single width for all data typesextern int SwWidth[T_LAST];/** CT structure to read in the set definition*/typedef struct{// fields from the panel// comment (unused by code, for user only)char comment[20];u16 datatype; /* analog, counter, digital */u16 bustype;u16 busnum;u16 statnum;u16 blockmes;u16 signalg;u16 signalp;u16 signalb; /* valmet specific data */u16 datadir; /* direction of data */} CT_SET;/* definition of the set entry together with it's name */typedef struct {// name of the set to which this entry belongs. This is a laisy solution */SETNAME setname;// the entry itselfCT_SET entry;} CT_SET_ENTRY;/** additional info for dataset*/typedef struct{u16 nr_msg;FLMSG mci[2];VAL_DATASET_DEF dataset;/* bit-direction etc. */TAG dsctrl;char dsname[50];} VAL_DATASET;/** additional info for device*/// the maximum number of 'tags' that can be held in the union of all data sets//#define MAX_ENTRIES_IN_SETS 200typedef struct{char device[20]; //device namechar TCPIP[20]; //TCP-IP addressshort TCPport; //TCP port numbershort TCPconnection; //device TCP connection, 0 = disconnected; 1 = connectedshort COMport; //Comport numbershort status; //device statusshort driverenable; //enable status drivershort tcpenable; //enable tcp connection statusshort disable[2]; //disable status read, write for deviceunsigned long Count[2]; //Total nr of reads, writes and receives} VALMET_STATUS;// the maximum number of datasets in a device ://worst case a data set for every entry in the valmet table//#define MAX_DATA_SETS 200typedef struct{DEVNAME devname; /* name of the device */u16 comport; /* the particular communications port for this device */TAG dis_fnc[2]; /* the read-disable tag and the write disable tag for this device */TAG status; /* status tag for this device */TAG redefine; /* should we redefine the tag */TAG tcpconn; /* TCP disconnect/connect = 0/1; no tag means always connected */int error; /* is there an error for this device ? */int count; /* error count */int disable[2]; /* flags indicating device is read / write diabled */VAL_PHYS_DEV phys_dev; /* structure for physical device */uchar * buf[2]; /* the read/write communication buffers (COM_READ/COM_WRITE) */u16 retries; /* no. of retries when communication error */u16 timeout; /* timeout in seconds */VALMET_STATUS statX; /* valmet device status */} VAL_DEVICE;/** internal decoder structure*/typedef struct{TAG mbx;int max_msg;} VAL_DECODER;/* define the array with pointers to all data set definitions that we have* The array pointed to by AllDataSets holds as many entries as defined by NrDataSets*/extern int TotalNrDataSets;typedef VAL_DATASET * PVAL_DATASET;extern PVAL_DATASET * pAllDataSets;/* define the types for the variable(s) that will hold all defined sets with their contents* The array pointed to by pAllSetEntries holds as many entries as defined by NrDefinedEntries*/extern int TotalNrSetEntries;extern CT_SET_ENTRY * pAllSetEntries;/** function prototypes* file: ct*/void ctload( void);void load_decoders( CT *ct_buf);void load_devices( CT *ct_buf);void load_sets( CT *ct_buf);void register_mci_events(void);void register_events( VAL_DEVICE * d);int find_related_entries(char * setname, unsigned int * first_set_entry, unsigned int * last_set_entry);u16 get_set_length( unsigned int first_entry, unsigned int last_entry);/** global variables*/extern TASK_ID Task;#ifndef HPUX#pragma pack()#else#pragma HP_ALIGN POP#endif#endif /* _VAL_PD_DEFS_INCLUDED */