146 lines
5.8 KiB
C
146 lines
5.8 KiB
C
|
/******************************************************************************
|
||
|
*
|
||
|
* Include file for PI/API driver pcdriver.c
|
||
|
*
|
||
|
* Module %M% Version %I% Date %H%
|
||
|
*
|
||
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
||
|
* This is unpublished proprietary source code of Ardent Software, Inc.
|
||
|
* The copyright notice above does not evidence any actual or intented
|
||
|
* publication of such source code.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
*
|
||
|
* Maintenence log - insert most recent change descriptions at top
|
||
|
*
|
||
|
* Date.... GTAR# WHO Description.........................................
|
||
|
* 10/14/98 23801 SAP Change copyrights.
|
||
|
* 04/08/96 18242 DTM Code Cleanup, Phase I
|
||
|
* 10/19/93 12306 JC Added RAW mode value for use with the ICI.
|
||
|
* 09/08/93 12220 DWT Port 7.3.2 to ptx
|
||
|
* 04/23/93 11336 JWT Integration of PI/API support for uniVerse
|
||
|
* 01 Mar 93 (GMCCLEAN) [PIGS 5220, SPAR none]
|
||
|
* Creation of Module. Based on the PI/open version.
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
/* START-DESCRIPTION :
|
||
|
*
|
||
|
* This file contains tables required for the character conversion and
|
||
|
* checksum calculation in PCDRIVER.C.
|
||
|
*
|
||
|
* The tables are indexed using the Prime ASCII values and their contents
|
||
|
* are based on ASCII.
|
||
|
*
|
||
|
* END-DESCRIPTION
|
||
|
*
|
||
|
* START-CODE:
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef h_pcdriver
|
||
|
#define h_pcdriver
|
||
|
|
||
|
/* key parameter values */
|
||
|
|
||
|
#define INITIALIZE 0
|
||
|
#define RECEIVE 1
|
||
|
#define TRANSMIT 2
|
||
|
#define RAWMODE 1000 /* Defines RAW mode in operation */
|
||
|
#define TERMINATE 1003
|
||
|
#define EXECUTE_START 1004
|
||
|
#define EXECUTE_STOP 1005
|
||
|
|
||
|
/* misellaneous */
|
||
|
|
||
|
#define TRUE 1
|
||
|
#define FALSE 0
|
||
|
#define MAX_RETRIES 5
|
||
|
#define MAX_VERSION_SIZE 32 /* maximum size of init string */
|
||
|
#define MAX_PACKETSIZE 2048 /* 2k packets */
|
||
|
#define OLD_MAX_PACKETSIZE 93 /* old maximum packet size */
|
||
|
#define MAX_BUFF_SIZE 32766 /* maximum buffer size */
|
||
|
|
||
|
#define SPACE ' '
|
||
|
#define LEFT_BRACE '{'
|
||
|
#define VERTICAL_BAR '|'
|
||
|
#define RIGHT_BRACE '}'
|
||
|
#define TILDE '~'
|
||
|
#define COMMA ','
|
||
|
#define ETX "\003"
|
||
|
|
||
|
/* externals */
|
||
|
|
||
|
/* static structures */
|
||
|
|
||
|
typedef struct {
|
||
|
int packetsize;
|
||
|
int datamax;
|
||
|
int txseq;
|
||
|
int rxseq;
|
||
|
int previous_tx_ack;
|
||
|
int previous_rx_ack;
|
||
|
uchar cr;
|
||
|
uchar version[MAX_VERSION_SIZE];
|
||
|
uchar goahead[3];
|
||
|
} PC_DRIVER_PRIVATE_DATA;
|
||
|
|
||
|
static PC_DRIVER_PRIVATE_DATA pcdata = {
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
FALSE,
|
||
|
FALSE,
|
||
|
'\r',
|
||
|
'\0',
|
||
|
'\0'
|
||
|
};
|
||
|
|
||
|
|
||
|
/*
|
||
|
lookup table used to encode non-printing characters on transmission
|
||
|
contains an array of character sequences (decimal value), indexed
|
||
|
by the ascii value (IBM/PC ASCII) or (PRIME ASCII).
|
||
|
*/
|
||
|
|
||
|
static unsigned char lookup[] = {
|
||
|
123, 32, 123, 33, 123, 34, 123, 35, 123, 36, 123, 37, 123, 38, 123, 39,
|
||
|
123, 40, 123, 41, 123, 42, 123, 43, 123, 44, 123, 45, 123, 46, 123, 47,
|
||
|
123, 48, 123, 49, 123, 50, 123, 51, 123, 52, 123, 53, 123, 54, 123, 55,
|
||
|
123, 56, 123, 57, 123, 58, 123, 59, 123, 60, 123, 61, 123, 62, 123, 63,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 124, 91, 124, 92, 124, 93, 124, 94, 124, 95,
|
||
|
125, 32, 125, 33, 125, 34, 125, 35, 125, 36, 125, 37, 125, 38, 125, 39,
|
||
|
125, 40, 125, 41, 125, 42, 125, 43, 125, 44, 125, 45, 125, 46, 125, 47,
|
||
|
125, 48, 125, 49, 125, 50, 125, 51, 125, 52, 125, 53, 125, 54, 125, 55,
|
||
|
125, 56, 125, 57, 125, 58, 125, 59, 125, 60, 125, 61, 125, 62, 125, 63,
|
||
|
125, 64, 125, 65, 125, 66, 125, 67, 125, 68, 125, 69, 125, 70, 125, 71,
|
||
|
125, 72, 125, 73, 125, 74, 125, 75, 125, 76, 125, 77, 125, 78, 125, 79,
|
||
|
125, 80, 125, 81, 125, 82, 125, 83, 125, 84, 125, 85, 125, 86, 125, 87,
|
||
|
125, 88, 125, 89, 125, 90, 125, 91, 125, 92, 125, 93, 125, 94, 125, 95,
|
||
|
125, 96, 125, 97, 125, 98, 125, 99, 125, 100, 125, 101, 125, 102, 125, 103,
|
||
|
125, 104, 125, 105, 125, 106, 125, 107, 125, 108, 125, 109, 125, 110, 125, 111,
|
||
|
125, 112, 125, 113, 125, 114, 125, 115, 125, 116, 125, 117, 125, 118, 125, 119,
|
||
|
125, 120, 125, 121, 125, 122, 125, 123, 125, 124, 125, 125, 125, 126, 126, 63,
|
||
|
126, 64, 126, 65, 126, 66, 126, 67, 126, 68, 126, 69, 126, 70, 126, 71,
|
||
|
126, 72, 126, 73, 126, 74, 126, 75, 126, 76, 126, 77, 126, 78, 126, 79,
|
||
|
126, 80, 126, 81, 126, 82, 126, 83, 126, 84, 126, 85, 126, 86, 126, 87,
|
||
|
126, 88, 126, 89, 126, 90, 126, 91, 126, 92, 126, 93, 126, 94, 126, 95
|
||
|
};
|
||
|
|
||
|
|
||
|
/* pcdriver.h */
|
||
|
|
||
|
#endif
|