Software Design

Software flow chart

Much of this project was in software, as the hardware for the ethernet controller is provided by the MPC. A large amount of time was spent initializing the Ethernet controller. All of this code was written in assembly, although much thought went into deciding that over C.

One of the reasons for doing the driver entirely in assembly was we did not have experience in writing drivers in C. We saw a sample driver from freescale written in C, and we feared that using this method would result in single mistakes cascading into many problems, and overcomplicate many things. While some of the data manipulation was more difficult in assembly, the writing to special purpose registers was much easier. Assembly also gave us much more flexibility with where exactly in memory our data was, and where exactly we put the buffers for ethernet.

Aside from the the ethernet driver, and basic timer interrupts that interfaced with the ADC, the rest of the code was written in C. This made it far easier to examine data and parse it, as there were many layers of protocols to wade through.

In addition, the API to use the graphics display was also written in C.  Since the graphics display was interfaced as a memory mapped io device, it was fairly straightforward to assign a C pointer to the address of the graphics display and then dereference the variable whenever we needed to read/write from it.   This allowed for rapid development to the graphics display API starting with functions to do simple tasks such as check the status of the display, and evolved into more complex functions such as a print function that had functionality similar to printf in C, and functions for using the graphics capabilities of the display.

Interrupts were a huge part of this project - the entire project was interrupt driven. Every time a packet was recieved, or the timer went off, an interrupt was generated.