Assignment 4, due Sept. 14

Part of the homework for 22C:112, Fall 2012
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID and on the class list! Assignments are due at the start of class on the day indicated (usually Friday). Exceptions will be by advance arrangement unless there is what lawyers call "an act of God" (something outside your control). Homework must be turned in on paper, either in class or in the teaching assistant's mailbox. Never push late work under someone's door!

  1. Background: Suppose you decided to break mush.c into separate files, one for each of the functions, so you have getcommand.c, parseargv.c, launch.c and main.c. Any global variable shared by two or more of the above is placed in a header file (thereby forcing compatible declarations wherever that variable is used). As a result, we have command.h shared by getcommand.c and parseargv.c, and we have argv.h shared by parseargv.c and launch.c.

    A problem: Write out the entire makefile for the project, assuming that the makefile and all of the other files for this project are stored in the same directory, probably a directory named mush. of the code goes in the same directory. (1.0 point)

    Note: This is not a machine problem. You are welcome to break mush up as suggested above to test your solution, but you are not required to do so, nor are you required to turn in your broken-up versions of mush.

  2. Background: Look at the datasheet for the Broadcom BCM2835 ARM Peripherals, specifically chapter 6, which starts on page 89 of the PDF, on the General Purpose I/O (GPIO) pins supported by that chip.

    a) Are the I/O device registers on this system mapped as memory addresses, or is there a separate address space for I/O, as on the classic x86 architecture? (0.3 points)

    b) What range of addresses are used for controlling the GPIO pins on this system. (0.3 points)

    c) Assuming that the GPIO funciton select pins have been so that GPIO pins 0 to 7 are configured as outputs, what value sould you store in the GPSET0 and GPCLR0 registers in order to output the value C516. Note that bits are numbered in littleendian order. (0.4 points)

  3. Background Look at the datasheet for the Broadcom BCM2835 ARM Peripherals, specifically section 2.2.1, which starts on page 11, describing the mini UART on that chip, and look at the notes for Lecture 10, specifically, the example output driver.

    The example output driver given in the notes uses two device regtisters, COM1DATA and COM1LSR, and it only uses 8 bits from the data register and one bit from the line status register.

    a) Which bits of which mini UART interface register correspond to the use made of COM1DATA in the notes? (0.5 points)

    b) Which bits of which mini UART interface register correspond to the use made of COM1LSR in the notes? (0.5 points) Note: Given the above, you could now write code to output data to the mini UART on a Raspberry Pi, assuming that you had configured the GPIO pins appropriately so that the mini UART was connected, and assuming that you were running your code in such a way that it had access to the input-output device registers.