Source code

The source code for the 8250 serial driver is in ddk_working_dir/ddk-char/src/hardware/devc/ser8250. This directory includes:

externs.c
Defines the global data.
externs.h
Includes the required headers and declares the global data.
init.c
Initialization code.
intr.c
Interrupt handler routines.
main.c
The main part of the driver.
options.c
Parses the driver's command-line arguments.
proto.h
Prototypes for the driver's interface routines.
query_defdev.c
Queries the default devices. Note that there's a special version of this routine for x86 desktop systems in x86/query_defdev.c. For other platforms, there aren't any default devices.
tedit.c
The tiny edit-mode routine.
tto.c
A routine to transmit up to the TX FIFO SIZE worth of data, called by io-char. It also provides support to control and read hardware-control lines status, and provides support for the stty utility. If there's no TX FIFO, tto() writes only a single character.
variant.h
A header file that defines the two macros to read/write the 8250. This file can be overwritten for different boards with their own read/write macros.

There are also platform-specific directories, each of which includes:

<sys_ttyinit.c>
Initialize the tty structure that the driver passes to io-char.
Note: Change as little of the given source code as possible, because it's easy to mess things up.

The most important parts of the code are those associated with output and interrupts.