Module kernel::driver [] [src]

System call interface for userspace applications.

Drivers implement these interfaces to expose operations to applications.

System-call Overview

Tock supports four system calls. The yield system call is handled entirely by the scheduler, while three others are passed along to drivers:

Mapping system-calls to drivers

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 meanings (e.g. 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 driver-specific.

One convention in Tock is that driver minor number 0 for the command 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).

The yield System-call

While drivers do not handle the yield system call, it is important to understand its function and how it interacts with subscribe.

Reexports

use returncode::ReturnCode;

Traits

Driver

Drivers implement the three driver-specific system calls: subscribe, command and allow.