CMPE 401 - Computer Interfacing

Assignment #4

Due: In the CMPE 401 assignment box at 15:45 on Friday, Nov. 21, 2008


  1. The Lightweight IP stack has a software architecture that is intended to help achieve several goals: (1) portability across processors; (2) portability across operating systems; (3) portability across communications hardware; (4) minimum memory requirements; and (5) fast processing speed. Briefly explain how architectural and design features of lwIP were used to achieve each of these goals.

  2. Direct Memory Access (DMA) implements what is effectively a block move operation, which usually terminates with an interrupt to alert the CPU that the transfer has finished. A technical challenge exists when DMA is used in a computer with virtual memory. With virtual memory, the amount of information (programs and data) in a CPU's memory space exceeds the size of available fast semiconductor memory (usually DRAM), and most of the information must be stored in slower mass storage devices such as hard disks. To speed up the effective access time to stored information, fixed-size pages (i.e., buffers) of information are brought into regions in a faster physical memory space (usually implemented using DRAM). Address translation hardware is used to translate virtual addresses (used by the software) into physical addresses (used to locate information in the fast physical memory). A DMA controller (DMAC) could be installed to use either physical addresses or virtual addresses. Briefly explain what the advantages would be for a DMAC to use physical addresses or virtual addresses.

  3. Both ping-pong buffers and first-in first-out (FIFO) buffers can be used to absorb short-term mismatches in the data rates of a producer process with a consumer process. Briefly describe what the likely advantages and disadvantages would be of a ping-pong buffer versus a FIFO? What aspects of a particular application would lead you to pick one buffer method over the other?

  4. A circular buffer is accessed by exactly one writing process, and can be accessed by one or more read processes. Design pseudo-code that shows how a circular buffer with one writing process and two reading processes could be implemented.

  5. TCP uses a window-based flow control strategy to ensure that all data bytes arrive at the receiver without overwhelming the receiver. The flow control method operates independently in both directions. Briefly explain how the transmitter determines whether or not to retransmit data packets, and explain how that ensures that information bytes in lost packets will eventually get received correctly at the receiving end (in one direction). Be sure to mention why TCP needs to have the ability to set a certain number of timers to be able to provide its services.

  6. In TCP, briefly explain how the receiving end can prevent itself from being overwhelmed with more data that it can handle.

  7. In the context of a stepper motor with three phases, explain how one could implement full stepping and half stepping. Be sure to provide a table that shows how the three pairs of stator windings (i.e. three phases) would be energized. Whenever a phase is energized, be sure to indicate the direction of polarization.