Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
CS397/CS497 - Wireless Protocols for the Internet of Things Homework: Background
This is an individual assignment. Submission is through Gradescope. You can submit a scanned version of this document, a computer edited version, or simply paper with the answers. Please be careful to ensure that answers are labeled and legible.
The goal of this homework is largely to act as a quick refresher on low-level C concepts which you will need to use in lab and to understand and follow along in some of the lecture material. A lot of understanding various networking designs comes down to understanding how bits and bytes are arranged at various stages.
If you run into issues on this homework, please reach out to the professor! We’re happy to help review background material with you.
Background: Pointers & Peripherals
Most peripherals in embedded systems (and modern computing more generally) are interfaced with via Memory-Mapped I/O (MMIO). Basically, there are addresses that don’t point to RAM or other traditional memory, but instead point to pieces of hardware. We call these hardware registers or often just registers.
One simple peripheral is General-Purpose I/O (GPIO). A GPIO pin is a real, physical pin that comes out of the processor, which the processor can set to logic low (aka, 0 V), logic high (aka, 3.3 V; or whatever the system supply voltage level is), or don’t care (commonly called tristate or sometimes floating, this is when the processor does not drive the pin high or low, so it will just float around randomly).
GPIOs can be controlled with two registers, an OutputControl register, which indicates “(1): the processor should drive a value on this pin, or (0): let it float” and a GPIOLevel register, which indicates the current value (0 or 1) of a GPIO pin.
For more background here, take a look at this lecture on Microcontroller I/O.
Q1: Basic Operation [40pts]
Assume we are working with a 32-bit microcontroller that has 32 GPIO pins. Each GPIO is mapped to one bit in each register; i.e., pin 0 is controlled by bit 0. There are two relevant GPIO registers:
• 0x4000_1000 configures whether the pin is an input (0) or output (1)
• 0x4000_1004 controls or reads the current level of the pin (0 or 1)
Both registers are initialized to all 0’s at startup.
Complete the following code snippet:
#include
Q2: Helper Functions [40pts]
Q3: Many Views of Memory [20pts]
Given the partial output of this code, complete the rest. You may assume no optional features or anything complicated is happening here. Here’s a helpful explanation of the IPv4 packet structure. That will help you get one of the answers and you’ll need to do your own research to find the other. Beware: the addresses are in hexadecimal!!
buffer begins at: 0x20004000
eth begins at: 0x20004008
ipv4 begins at: 0x20004016
udp begins at:
payload begins at: