home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
wkermit.tar.gz
/
wkermit.tar
/
asic.h
next >
Wrap
C/C++ Source or Header
|
1985-11-11
|
9KB
|
253 lines
/* include for things that use asi buffer structure
*/
#define N_ASPORTS 2 /* actual number of ports */
#define MAX_ASPORTS 8
#define max_asbuf_len 32000 /* max buffer size - user selectable */
struct AS_FLAGS {
unsigned alert : 1; /* alert when 1 */
unsigned rxempty: 1; /* Rx Buffer Empty */
unsigned rxfull: 1; /* Rx Buffer Full */
unsigned txempty: 1; /* Tx Buffer Empty */
unsigned txfull: 1; /* Tx Buffer Full */
unsigned linerr: 1; /* line error */
unsigned modchg: 1; /* modem status change */
unsigned chkerr: 1; /* checksum error */
unsigned xchrun: 1; /* transmit interrupts are running */
unsigned rchrun: 1; /* receive interrupts are running */
unsigned igalert: 1; /* ignore alert */
unsigned igcts: 1; /* ignore CTS */
unsigned igdsr: 1; /* ignore DTR */
unsigned igcd: 1; /* ignore carrier detect CD */
unsigned igmstat: 1; /* ignore modem status changes */
unsigned igrcver: 1; /* ignore receive errors */
};
/* L I N E S T A T U S B I T S
*
* These are set by the interrupts and status functions. asilrst()
* resets the static portion.
*
* Use the macros (below) to test individual bits.
*/
struct AS_LSTAT { /* First 8 are dynamic */
unsigned dready: 1; /* Rx data ready */
unsigned overrun: 1; /* Overrun Error */
unsigned parerr: 1; /* Parity Error */
unsigned framerr: 1; /* Framing Error */
unsigned breakdet:1; /* Break Signal Detect */
unsigned txhempty:1; /* Tx Holding Reg Empty */
unsigned txsempty:1; /* Tx Shift Reg Empty */
unsigned timeout: 1; /* Timeout (not used) */
unsigned sdready: 1; /* the next 8 are STATIC repeat */
unsigned soverrun:1; /* of the last 8 bits */
unsigned sparerr: 1;
unsigned sframerr: 1;
unsigned sbreakdet:1;
unsigned stxhempty:1;
unsigned stxsempty:1;
unsigned stimeout: 1;
};
/* M O D E M S T A T U S B I T S
*
* These are set by the interrupts and status functions. asimrst() resets
* the static portion.
*
* Use macros (below) to read individual bits.
*/
struct AS_MSTAT { /* first 8 are dynamic */
unsigned dcts: 1; /* delta CTS */
unsigned ddsr: 1; /* delta DSR */
unsigned teri: 1; /* trailing edge of RI */
unsigned drlsd: 1; /* delta CD */
unsigned cts: 1; /* CTS */
unsigned dsr: 1; /* DSR */
unsigned ri: 1; /* RI */
unsigned rlsd: 1; /* CD */
unsigned sdcts: 1; /* the next 8 are static */
unsigned sddsr: 1; /* repeats of last 8 */
unsigned steri: 1;
unsigned sdrlsd: 1;
unsigned scts: 1;
unsigned sdsr: 1;
unsigned sri: 1;
unsigned srlsd: 1;
};
struct CHK_FLAGS {
unsigned no_usef: 7;
unsigned chk2flg: 1; /* Check character 2 has been detected */
unsigned chk1flg: 1; /* Check character 1 has been detected */
unsigned chk0flg: 1; /* Check character 0 has been detected */
unsigned reserve: 6; /* Hands off these */
};
struct ASITABLE {
int port; /* port number 0... */
int intnum; /* interrupt no. 0C... */
unsigned ioaddr; /* base address of 8250 */
unsigned flags; /* major status flags */
unsigned lstat; /* line status */
unsigned mstat; /* modem status */
int mode;
unsigned rseg; /* Rx Buffer segment */
unsigned rbob; /* Beginning of Buf (Rx)*/
unsigned rpi; /* Pointer In (Rx)*/
unsigned rpo; /* Pointer Out (Rx)*/
int rsize; /* size of receive queue */
int rfree; /* free space in receive queue */
unsigned tseg; /* Tx Buffer segment */
unsigned tbob; /* Beginning of Buf (Tx)*/
unsigned tpi; /* Pointer In (Tx)*/
unsigned tpo; /* Pointer Out (Tx)*/
int tsize; /* size of transmit queue */
int tcnt; /* number of bytes in transmit queue */
int xmcount; /* count/is rx active */
unsigned chkflag; /* flags for check characters */
char chkchr0; /* Check character 0 */
char chkchr1; /* Check character 1 */
char chkchr2; /* Check character 2 */
unsigned irq8259; /* Interrupt # in 8259 (com0 = 4) */
unsigned port8259; /* I/O Address of 8259 */
char not_used[15]; /* Pad to 64 bytes */
};
/*
* Structure for Local Parameters for XMODEM functions.
*/
struct XMBUF {
int xblocknum;
char first;
int xstatus;
};
/*
* The next declarations must be exactly as stated.
*
*/
extern int n_asi_ports;
extern struct ASITABLE asi_parms[ N_ASPORTS ];
extern int as_intnums[];
extern int as_port[];
extern int _as_wcts;
extern int as_wtime[];
extern int as_rtime[];
extern int as_8259ports[];
extern int as_8259irq[];
/*
* End of mandatory declarations.
*/
/*
* Macros to define status and flag bits.
*/
/* T E S T IF RECEIVER DETECTED A PARTICULAR CHECK CHARACTER
*
* Use these in conjunction with asirchk().
*/
#define ischk2(x) (asi_parms[x].chkflag&256)?1:0
#define ischk1(x) (asi_parms[x].chkflag&128)?1:0
#define ischk0(x) (asi_parms[x].chkflag&64)?1:0
/* F L A G B I T T E S T S
*
* These just test flag bits. The first 8 are for general applications,
* the next 8 are provided for completeness and to test when the system
* has been told to ignore certain conditions. Never write into these.
*/
#define isalert(x) (asi_parms[x].flags&1)?1:0
#define isrxempty(x) (asi_parms[x].flags&2)?1:0
#define isrxfull(x) (asi_parms[x].flags&4)?1:0
#define istxempty(x) (asi_parms[x].flags&8)?1:0
#define istxfull(x) (asi_parms[x].flags&16)?1:0
#define islnerr(x) (asi_parms[x].flags&32)?1:0
#define ismderr(x) (asi_parms[x].flags&64)?1:0
#define isckerr(x) (asi_parms[x].flags&128)?1:0
#define isxchrun(x) (asi_parms[x].flags&256)?1:0
#define isrchrun(x) (asi_parms[x].flags&512)?1:0
#define isigalert(x) (asi_parms[x].flags&1024)?1:0
#define isigcts(x) (asi_parms[x].flags&2048)?1:0
#define isigdtr(x) (asi_parms[x].flags&4096)?1:0
#define isigcd(x) (asi_parms[x].flags&8192)?1:0
#define isigmstat(x) (asi_parms[x].flags&16384)?1:0
#define isigrcver(x) (asi_parms[x].flags&32768)?1:0
/* Return DYNAMIC Line Status */
#define isdatardy(x) (asi_parms[x].lstat&1)?1:0 /* DATA READY */
#define isoverrun(x) (asi_parms[x].lstat&2)?1:0 /* OVERRUN ERROR */
#define isparityerr(x) (asi_parms[x].lstat&4)?1:0 /* PARITY ERROR */
#define isframerr(x) (asi_parms[x].lstat&8)?1:0 /* FRAMING ERROR */
#define isbreak(x) (asi_parms[x].lstat&16)?1:0 /* BREAK DETECT */
#define ishrempty(x) (asi_parms[x].lstat&32)?1:0 /* TX HOLDING REG */
#define issrempty(x) (asi_parms[x].lstat&64)?1:0 /* TX SHIFT REG */
#define istimeout(x) (asi_parms[x].lstat&128)?1:0 /* NOT USED */
/* Return STATIC Line Status */
#define issdatardy(x) (asi_parms[x].lstat&256)?1:0
#define issoverrun(x) (asi_parms[x].lstat&512)?1:0
#define issparityerr(x) (asi_parms[x].lstat&1024)?1:0
#define issframerr(x) (asi_parms[x].lstat&2048)?1:0
#define issbreak(x) (asi_parms[x].lstat&4096)?1:0
#define isshrempty(x) (asi_parms[x].lstat&8192)?1:0
#define isssrempty(x) (asi_parms[x].lstat&0x4000)?1:0
#define isstimeout(x) (asi_parms[x].lstat&0x8000)?1:0
/* Return DYNAMIC Modem Status */
#define ischgcts(x) (asi_parms[x].mstat&1)?1:0
#define ischgdsr(x) (asi_parms[x].mstat&2)?1:0
#define ischgri(x) (asi_parms[x].mstat&4)?1:0
#define ischgcd(x) (asi_parms[x].mstat&8)?1:0
#define iscts(x) (asi_parms[x].mstat&16)?1:0
#define isdsr(x) (asi_parms[x].mstat&32)?1:0
#define isri(x) (asi_parms[x].mstat&64)?1:0
#define iscd(x) (asi_parms[x].mstat&128)?1:0
/* Return STATIC Modem Status */
#define isschgcts(x) (asi_parms[x].mstat&256)?1:0
#define isschgdsr(x) (asi_parms[x].mstat&512)?1:0
#define isschgri(x) (asi_parms[x].mstat&1024)?1:0
#define isschgcd(x) (asi_parms[x].mstat&2048)?1:0
#define isscts(x) (asi_parms[x].mstat&4096)?1:0
#define issdsr(x) (asi_parms[x].mstat&8192)?1:0
#define issri(x) (asi_parms[x].mstat&0x4000)?1:0
#define isscd(x) (asi_parms[x].mstat&0x8000)?1:0
/* Boolean: Has receiver gotten one or more characters ? */
#define isxmrxing(x) (asi_parms[x].xmcount>0)?1:0
/* Boolean: Has receiver gotten a specified number of characters ? */
#define isxmrxcnt(x,y) (asi_parms[x].xmcount>=y)?1:0
/* Misc. definitions
*/
#define ASIN 1 /* mode = input */
#define ASOUT 2 /* mode = out */
#define ASINOUT 3 /* mode = in,out*/
#define ASCIINONE 1 /* protocol = ASCII, no protocol */
#define ASCIIXM 5 /* protocol = ASCII, XMODEM */
#define BINARYNONE 2 /* protocol = Binary, no protocol */
#define BINARYXM 6 /* protocol = Binary XMODEM */
/* ASCII Protocol Characters
*/
#define NUL 0
#define SOH 1
#define STX 2
#define ETX 3
#define EOT 4
#define ACK 6
#define DLE 0x10
#define DC1 0x11
#define DC2 0x12
#define DC3 0x13
#define DC4 0x14
#define NAK 0x15
#define ETB 0x17
#define XON 0x11
#define XOFF 0x13