--- /dev/null
+\lstinputlisting[language=C]{listings/interface.h}
byte & value\\
\midrule
1 & \texttt{'t'}\\
- 2,3 & interval. If the first bit is 1 the other 15 indicate the
- interrupt on which the task should be run. If the first bit is 0
- the other 15 indicate the interval in milliseconds\\
+ 2,3 & interval or interrupt\\
4,5 & length (\texttt{n})\\
6 to n+6 & bytecode\\
\midrule\midrule
architecture~\todo{Add cite} that is also runnable on smaller devices like
\acrshort{ARM}. However, this is limited to fairly high performance devices
that are equipped with high speed communication lines. Devices in \gls{IoT}
-often only have LPLB communication with low bandwidth and a very limited amount
-of processing power. \glspl{mTask} will bridge this gap. It can run on devices
-as small as Arduino microcontrollers and operates via the same paradigms as
-regular \glspl{Task}. The \glspl{mTask} have access to \glspl{SDS} and can run
-small imperative programs.
+often only have \gls{LTN} communication with low bandwidth and a very limited
+amount of processing power. \glspl{mTask} will bridge this gap. It can run on
+devices as small as Arduino microcontrollers and operates via the same
+paradigms as regular \glspl{Task}. The \glspl{mTask} have access to \glspl{SDS}
+and can run small imperative programs.
\section{Document structure}
The structure of the thesis is as follows.
--- /dev/null
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdarg.h>
+
+#define read16() 256*(uint8_t)read_byte() + (uint8_t)read_byte()
+#define from16(a, b) 256*a+b
+#define write16(i) { write_byte((uint8_t)i/256); write_byte((uint8_t)i%256); }
+uint8_t read_byte(void);
+void write_byte(uint8_t b);
+
+void write_dpin(uint8_t i, bool b);
+bool read_dpin(uint8_t i);
+
+void write_apin(uint8_t i, uint8_t a);
+uint8_t read_apin(uint8_t i);
+
+void led_on(uint8_t i);
+void led_off(uint8_t i);
+
+long millis(void);
+bool input_available(void);
+void delay(long ms);
+
+void setup(void);
+void debug(char *fmt, ...);
+void pdie(char *s);
+void die(char *fmt, ...);
+
+#endif
\gls{Clean}~\cite{brus_cleanlanguage_1987}
\section{\acrlong{EDSL}s}
+\glspl{mTask} are expressed in a class based shallowly embedded \gls{EDSL}.
+There are two main types of \glspl{EDSL}.
+\todo{Small shallow embedded dsl intro}
+\todo{Small deep embedded dsl}
+\todo{Show that class based has the best of both worlds}
\section{Devices}
+The client code for the devices is compiled from one codebase. For a device to
+be eligible for \glspl{mTask} it must be able to compile the shared codebase
+and implement (part of) the device specific interface. The shared codebase only
+uses standard \gls{C} and no special libraries or tricks are used. Therefore
+the code is compilable for almost any device or system. Note that it is not
+needed to implement a full interface\todo{handshake}. The full interface,
+listed in Appendix~\label{app:device-interface}, also includes functions for
+accessing the peripherals that not every device might have.
\subsection{Specification}
+Devices are stored in a record type and all devices in the system are stored in
+a \gls{SDS} containing all devices.
\subsection{Communication}
\newacronym{EDSL}{(E)DSL}{(Embedded) Design Specific Language}
\newacronym{RISC}{RISC}{Reduced Instruction Set Computer}
\newacronym{ARM}{ARM}{Acorn \acrshort{RISC} Machine}
+\newacronym{LTN}{LTN}{Low Throughput Network}
\newglossaryentry{Clean}{name=Clean,
description={is a pure lazy functional programming language based on graph
rewriting}}
description={is the basic building block of a \acrshort{TOP} system}}
\newglossaryentry{mTask}{name=mTask,
description={is an abstraction for \glspl{Task} living on \acrshort{IoT} devices}}
+\newglossaryentry{C}{name=C,
+ description={is low-level programming language suitable for embedded devices}}
\begin{document}
\frontmatter{}
\chapter{Communication protocol}\label{app:communication-protocol}
\input{appendix-protocol.tex}
+\chapter{Device client interface}\label{app:device-interface}
+\input{appendix-device-interface.tex}
+
\lstlistoflistings{}
\listoffigures{}
\listoftables{}