CS 635 PROJECT 2 Due: 7:30pm Tuesday, 10/23/2007 The purpose of this project is to acquire experience with the kinds of issues commonly encountered when crafting a Linux device-driver for a standard piece of peripheral hardware. PROJECT STATEMENT Write your own code for a character-mode device-driver that is able to support PC-to-PC serial communications via a null-modem cable joining the primary NS16550A UARTs (Universal Asynchronous Receiver/Transmitter) belonging to a pair of adjacent PCs. This equipment has been a standard feature of PC architecture for several decades. (Its programming manual is available on our course website under 'Resources'. Its registers are accessed via eight consecutive I/O-ports, from 0x03F8 through 0x03FF, as indicated below, and its interrupt requests are generated on line IRQ4.) #define UART_BASE 0x03F8 #define DIVISOR_LATCH (UART_BASE+0) #define TRANSMIT_DATA (UART_BASE+0) #define RECEIVE_DATA (UART_BASE+0) #define INTR_ENABLE (UART_BASE+1) #define INTR_IDENTIFY (UART_BASE+2) #define FIFO_CONTROL (UART_BASE+2) #define LINE_CONTROL (UART_BASE+3) #define MODEM_CONTROL (UART_BASE+4) #define LINE_STATUS (UART_BASE+5) #define MODEM_STATUS (UART_BASE+6) #define SCRATCH_REG (UART_BASE+7) In addition to the normal 'module_init()' and 'module_exit()' functions, your driver is required to provide 'read()' and 'write()' functions, and it may provide whatever other character-mode driver functions you decide are either necessary or convenient, such as 'open()' and 'release()', or 'llseek()', 'flush(), 'poll()', 'fsync()', 'ioctl()' [A full list of the driver-methods appears in "Linux Device Drivers (3rd Ed)", pages 50-52]. Your driver's device-file already was created in the '/dev' directory by our System Administrators: it is named '/dev/uart', with major-number 84 and minor-number 0. Your driver's 'module_init()' function will need to register your file_operations structure using that name and major-number (and your 'module_exit()' function will later need to unregister it). TESTING PROCEDURES Your driver will get tested, by using the 'cat' and 'echo' commands to send a string of characters from one PC to its neighboring PC, as was done earlier with our 'stash.c' device-driver when we sent a string from one task to another task, both running on the same PC. The receiver PC: $ cat /dev/uart The transmit PC: $ echo Hello, world! > /dev/uart _______________________________________________________________________ (c) Allan B. Cruse University of San Francisco Fall 2007