Specifications
ECE391: Computer Systems Engineering Fall 2014
Machine Problem 2
Checkpoint: Wednesday, October 1
Midterm 1: Monday, October 6
Due: Monday, October 13
Device, Data, and Timing Abstractions
Read the whole document before you begin, or you may miss points on some requirements.
In this machine problem, you will extend a video game consisting of about 5,000 lines of code with additional graphical
features and a serial port device. The code for the game is reasonably well-documented, and you will need to read
and understand the code in order to succeed, thus building your ability to explore and comprehend existing software
systems. Most code that you will encounter is neither as small nor as well documented—take a look at some of the
Linux sources for comparison—but this assignment should help you start to build the skills necessary to extend more
realistic systems. As your effort must span the kernel/user boundary, this assignment will also expose you to some of
the mechanisms used to manage these interactions, many of which we will study in more detail later in the course.
Before discussing the tasks for the assignment, let’s discuss the skills and knowledge that we want you to gain:
• Learn to write code that interacts directly with devices.
• Learn to abstract devices with system software.
• Learn to manipulate bits and to transform data from one format into another.
• Learn the basic structure of an event loop.
• Learn how to use the pthread API.
Device protocols:
We want you to have some experience writing software that interacts directly with devices and must adhere to the
protocols specified by those devices. Similar problems arise when one must meet software interface specifications,
but you need experience with both in order to recognize the similarities and differences. Unfortunately, most of the
devices accessible from within QEMU have fully developed drivers within Linux. The video card, however, is usually
managed directly from user-level so as to improve performance, thus most of the code is in other software packages
(e.g., XFree86).
We were fortunate to have a second device designed by Kevin Bassett and Mark Murphy, two previous staff members.
The Tux Controller is that funny little game controller attached to each of the machines in the lab.
The Tux Controller connects to the USB port of the lab machine. An FTDI “Virtual Com Port” (VCP) driver makes the
USB port appear to software as a standard (old fashioned) RS232 serial port. We can then set up QEMU so that one of
the emulated serial ports on the virtual machine maps to the emulated serial port connected to the Tux Controller. In
this assignment, you will write code that interacts directly with both the (emulated) video card and the game controller
board.
Device abstraction:
Most devices implement only part of the functionality that a typical user might associate with them. For example, disk
drives provide only a simple interface through which bits can be stored and retrieved in fixed-size blocks of several
kB. All other functionality, including everything from logical partitions and directories to variable-length files and file-
sharing semantics, is supported by software, most of which resides in the operating system. In this machine problem,
you will abstract some of the functionality provided by the Tux controller board.