Information Technology Reference
In-Depth Information
outportb(IMR, ch);
enable();
}
Header file 28.1: serial.h
#define FALSE 0
/* RS232 set up parameters */
#define COM1 0
#define COM2 1
#define DATABITS7 0x02
#define DATABITS8 0x03
#define STOPBIT1 0x00
#define STOPBIT2 0x04
#define NOPARITY 0x00
#define ODDPARITY 0x08
#define EVENPARITY 0x18
#define BAUD110 0x00
#define BAUD150 0x20
#define BAUD300 0x40
#define BAUD600 0x60
#define BAUD1200 0x80
#define BAUD2400 0xA0
#define BAUD4800 0xC0
#define BAUD9600 0xE0
#define ESC 0x1B /* ASCII Escape character */
#define RSBUFSIZE 10000 /* RS232 buffer size */
#define COM1BASE 0x3F8 /* Base port address for COM1 */
#define TXDATA COM1BASE /* Transmit register */
#define RXR COM1BASE /* Receive register */
#define IER (COM1BASE+1) /* Interrupt Enable */
#define IIR (COM1BASE+2) /* Interrupt ID */
#define LCR (COM1BASE+3) /* Line control */
#define MCR (COM1BASE+4) /* Line control */
#define LSR (COM1BASE+5) /* Line Status */
#define RX_ID 0x04
#define RX_MASK 0x07
#define MC_INT 0x08
/*
Addresses of the 8259 Programmable Interrupt Controller (PIC).*/
#define IMR 0x21 /* Interrupt Mask Register port */
#define ICR 0x20 /* Interrupt Control Port */
/*
An end of interrupt needs to be sent to the Control Port of
*/
/* the 8259 when a hardware interrupt ends. */
#define EOI 0x20 /* End Of Interrupt */
#define IRQ4 0xEF /* COM1 */
28.2.1 Description of program
The initial part of the program sets up the required RS-232 parameters. It uses bioscom() to
Search WWH ::




Custom Search