Embedded Systems Building Blocks, Second Edition

This section describes a driver that I wrote which makes much better use of the serial I/O ports provided on a PC. The code and the functionality of the driver easily can be ported to other environments. Your application actually interfaces with two modules, as shown in Figure 11.19. Note that the term PC is used generically to mean any PC having either an Intel 80286, 80386, 80486, or Pentium microprocessor.
The low-level driver is responsible for interfacing with the National Semiconductor NS16550 UART. Functions are provided to your application to configure the two ports (COM1 or COM2), enable/disable communication interrupts, and acquire/release the COM port interrupt vectors. The interface functions will be described later.
Your application also interfaces to either one of two buffered serial I/O modules: COMMBGND or COMMRTOS. You would use COMMBGND in a foreground/background application and COMMRTOS if you are running a real-time kernel such a C/OS-II.
This section specifically describes the low-level driver interface functions. The source code for the low-level code is found in the \SOFTWARE\BLOCKS\COMM\SOURCE directory, and specifically, in the following files:
COMM_PCA.ASM (Listing 11.1)
COMM_PC.C (Listing 11.2)
COMM_PC.H (Listing 11.3)
As a convention, all functions and variables related to the low-level serial I/O module start with Comm while all #define constants start with COMM_.
Comm1ISR() and Comm2ISR() ( COMM_PCA.ASM) are the...