Exam starts at 14:00 Tue Nov 26 and ends at 14:00 Wed Nov 27.
Network Console Library

The network console library provides a very simple virtual "serial" device driver that uses UDP/IP to send data, without error correction or packet loss detection, to a UDP port on the AOS ODroid-C2 cluster server. The port is different for each odroid connected to the server and can be connected to via odroid netcon on your local terminal, or 9242 odroid netcon if you're working on CSE.

IP addresses

The IP addresses used by SOS are configured using cmake, and referred to as SosIP and SosGateway. See the framework documentation for configuring variables with CMake. However, both IP addresses have been set by default to the IPs expected by U-Boot on the odroid-c2, so you shouldn't need to change these.

Libnetworkconsole interface

network_console_init

struct network_console *network_console_init()

network_console_init initialises the network console by setting up the udp socket and returns a handle that must be passed to other network console functions. Note that this function will fail if called before the network has been initialised.

network_console_send

int network_console_send(struct network_console *network_console, char *data, int len);

network_console_send will write len bytes of data to the UDP port to appear on your local "serial" interface. This function returns the number of bytes written, which may be less than len. This occurs if the internal buffer fills faster than it can actually output data. In this case it is up to the calling code to handle the situation, either by retrying or returning an error to the user.

You can see this output using odroid netcon in your terminal.

network_console_register_handler

int network_console_register_handler(struct network_console *network_console, void (*handler)(struct network_console *)network_console, char c));

To receive input from your odroid netcon interface, you must register a handler function, which will be called by the network console when data is available. The provided function pointer type simply takes the inputted character as its only argument. Once registered, your handler function will be called during an interrupt context (so it should be reasonably light-weight).

What's really happening here

The network console driver uses a network stack library (picotcp) to package/unpackage UDP frames, which are sent to/received from the SosGateway(your machine), to act as a simple serial interface.