System call interface for userspace applications.
Drivers implement these interfaces to expose operations to applications.
Tock supports four system calls. The
yield system call is handled entirely
by the scheduler, while three others are passed along to drivers:
subscribelets an application pass a callback to the driver to be called later, when an event has occurred or data of interest is available.
commandtells the driver to do something immediately.
allowprovides the driver access to an application buffer.
Each of these three system calls takes at least two parameters. The first is
a driver major number and tells the scheduler which driver to forward the
system call to. The second parameters is a driver minor number and is used
by the driver to differentiate system calls with different driver-specific
subscribe to "data ready" vs
subscribe to "send
complete"). The mapping between driver major numbers and drivers is
determined by a particular platform, while the driver minor number is
One convention in Tock is that driver minor number 0 for the
syscall can always be used to determine if the driver is supported by
the running kernel by checking the return code. If the return value is
greater than or equal to zero then the driver is present. Typically this is
implemented by a null command that only returns 0, but in some cases the
command can also return more information, like the number of supported
devices (useful for things like the number of LEDs).
While drivers do not handle the
yield system call, it is important to
understand its function and how it interacts with