Category : C Source Code
Archive   : XTCPRO.ZIP
Filename : SERIAL.H
/*
* Serial Port Definitions
*/
extern SERIALPORT;
extern char *nextserialin, *nextserialout;
/* ----------- serial prototypes ----------- */
void initserialport(void);
int readserial(void);
int writeserial(int);
void clear_serial_queue(void);
void restore_serialint(void);
/* ----------------- serial macros ------------------- */
#define serialstat() (inp(LINESTATUS))
#define input_char_ready() (nextserialin!=nextserialout)
#define XON 17
#define XOFF 19
/* ---------------- serial port addresses ----------------- */
/* - 8250 UART base port address: COM1 = 3f8, COM2 = 2f8 - */
#define BASE (0x3f8-((SERIALPORT-1)<<8))
#define TXDATA BASE /* transmit data */
#define RXDATA BASE /* receive data */
#define DIVLSB BASE /* baud rate divisor lsb */
#define DIVMSB (BASE+1) /* baud rate divisor msb */
#define INTENABLE (BASE+1) /* interrupt enable */
#define INTIDENT (BASE+2) /* interrupt ident'n */
#define LINECTL (BASE+3) /* line control */
#define MODEMCTL (BASE+4) /* modem control */
#define LINESTATUS (BASE+5) /* line status */
#define MODEMSTATUS (BASE+6) /* modem status */
/* --------------- serial interrupt values ------------------ */
#define IRQ (4-(SERIALPORT-1)) /* 0-7 = IRQ0-IRQ7 */
#define SERIALINT (12-(SERIALPORT-1)) /* interrupt vector */
#define SERIALIRQ (~(1 << IRQ))
#define PIC01 0x21 /*8259 Programmable Interrupt Controller*/
#define PIC00 0x20 /* " " " " */
#define EOI 0x20 /* End of Interrupt command */
#define TIMER 0x1c /* PC timer interrupt vector */
/* --------------- line status register values ------------- */
#define XMIT_DATA_READY 0x20
/* ------------ modem control register values -------------- */
#define DTR 1
#define RTS 2
#define OUT2 8
/* ----------- ASCII serial control characters ------------- */
#define SOH 1
#define EOT 4
#define ACK 6
#define NAK 0x15
#define CAN 0x18
/* ----------- interrupt enable register signals ----------- */
#define DATAREADY 1
/* ------------- serial input interrupt buffer ------------- */
#define SERIALBUFFERSIZE 1024
#define SAFETYLEVEL (SERIALBUFFERSIZE/4)
#define THRESHOLD (SAFETYLEVEL*3)
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/