Campbell, Joe

C Programmer's Guide to Serial Communications (Second Edition) Sams Publishing, 1993 Indianapolis, Indiana ISBN 0-672-30286-1

Choiser, John P., Foster, John O. The XT-AT Handbook Annabooks, 1993 ISBN 0-929392-00-0

Erdelsky, Philip

"PC Interrupt-Driven Serial I/O"

From the book: MS-DOS System Programming

R&D Publications, 1990

ISBN 0-923667-20-2

Halsall, Fred

Data Communications, Computer Networks and Open Systems (Third Edition) Addison-Wesley, 1992 ISBN 0-201-56506-4

Pippenger, D.E. and Tobaben, E.J. Linear and Interface Circuits Applications Volume 2: Line Circuits and Display Drivers Texas Instruments, 1985 ISBN 0-89512-185-9

Tanenbaum, Andrew S. Computer Networks (Second Edition) PTR Prentice-Hall, Inc., 1989 ISBN 0-13-162959-X

Listing 11.1 COMM_PC.C


Embedded Systems Building Blocks Ccrnplete and Ready-to-Use Modules in C

Asynchronous Serial Corrnunications I EM-PC Serial I/O Low Level Driver

(c) Copyright 1999, Jean J. Labrosse, Weston, FL All Rights Reserved

* Prograrrmer : Jean J. Labrosse

* Notes : 1) The code in this file assumes that you are using a National Semiconductor NS16450 (most

* PCs do or, an Intel i82C50) serial conmunications controller.

* 2) The functions (actually macros) OS_ENTER_CRITICAL() and OS_EXIT__CRITICAL() are used to

* disable and enable interrupts, respectively. If using the Borland C++ carpiler V3.1,

* all you need to do is to define these rracros as follows:

* #define OS_EXIT_CRITICAL() enable{)

* 3) You will need to define the following constants:

* CCMM1_EASE is the base address of CCMl on your PC (typically 0x03f8)

* CCMM2_BASE is the base address of CCM2 on your PC (typically 0x02F8)

* CCMM_MAX_RX is the number of characters buffered by the UART

* 2 for the NS16450

* 16 for the NS16550


* are all defined in other modules (i.e. CCMML.H, CCMM2.H or CCMM3.H) *********************************************************************************************************


* INCLUDES *********************************************************************************************************

#include "includes.h"


* constants


«define BITO 0x01

«define BIT1 0x02

«define BIT2 0x04

«define BIT3 0x08

«define BIT4 0x10

«define BIT5 0x20

«define BIT6 0x40

«define BIT7 0x80

«define PIC_INT_R0G_PORT 0x0020

«define PIC_MSK_REG_PORT 0x0021

«define CCMM_UART__RBR 0

«define (XMM_UART_THR 0

«define CCMM_UART__DIV_LO 0


«define (XMM_UART_IER 1

«define CCMM_UftRT_J[IR 2

«define (XMM_UART_LCR 3

«define CCMM_UARTJKR 4

«define (XMM_UART_LSR 5

«define CCMM_UART_MSR 6

«define <XMK_UftRT_SCR 7




static INT16U CarmllSROldOffset; static rMT16U ConmllSROldSegment;

static rNT16U Ccmn2ISR01dOffset; static rNT16U Ccmn2ISR01dSegment;

Was this article helpful?

0 0

Post a comment