Capsules are drivers that live in the kernel and are written in Rust. They are
required to conform to Rust's type system (i.e. no unsafe
). Capsules are
platform agnostic and provide a range of features:
- Drivers for sensors or other ICs
- Virtualization of hardware resources
- Syscall interfaces for userland applications
When using hardware resources, capsules must only use features provided by the HIL (hardware interface layer). This ensures they can be used on multiple microcontrollers and hardware platforms.
Capsules have some flexibility in how they present access to a sensor or
virtualized hardware resource. Some capsules directly implement the Driver
trait and can be used by userland applications. Others provide an internal
interface that can be used by other in-kernel capsules as well as a Driver
interface for applications.
The list of Tock capsules and a brief description.
These implement a driver to setup and read various physical sensors.
- Analog Sensors: Single ADC pin sensors.
- FXOS8700CQ: Accelerometer and magnetometer.
- ISL29035: Light sensor.
- LPS25HB: Pressure sensor.
- SI7021: Temperature and humidity sensor.
- TMP006: Infrared temperature sensor.
- TSL2561: Light sensor.
These drivers provide support for various ICs.
- FM25CL: FRAM chip.
- LTC294X: LTC294X series of coulomb counters.
- MAX17205: Battery fuel gauge.
- MCP230xx: I2C GPIO extender.
- MX25r6435F: SPI flash chip.
- PCA9544A: Multiple port I2C selector.
- SD Card: Support for SD cards.
Support for wireless radios.
- nRF51822 Serialization: Kernel support for using the nRF51 serialization library.
- RF233: Driver for RF233 radio.
- BLE Advertising: Driver for sending BLE advertisements.
Protocol stacks and other libraries.
- IEEE 802.15.4: 802.15.4 networking.
- USB: USB 2.0.
- Segger RTT: Segger RTT support. Provides
hil::uart
interface.
These capsules provide a Driver
interface for common MCU peripherals.
- ADC: Individual and continuous samples.
- Alarm: Oneshot and periodic timers.
- Analog Comparator: Voltage comparison.
- CRC: CRC calculation.
- DAC: Digital to analog conversion.
- GPIO: GPIO configuring and control.
- I2C_MASTER: I2C master access only.
- I2C_MASTER_SLAVE: I2C master and slave access.
- RNG: Random number generation.
- SPI: SPI master and slave.
These provide common and better abstractions for userspace.
- Ambient Light: Query light sensors.
- App Flash: Allow applications to write their own flash.
- Button: Detect button presses.
- Buzzer: Simple buzzer.
- Console: UART console support.
- Humidity: Query humidity sensors.
- LED: Turn on and off LEDs.
- Temperature: Query temperature sensors.
These provide virtualized (i.e. multiple applications can use them simultaneously) support for generic sensor interfaces.
- Asynchronous GPIO: GPIO pins accessed by split-phase calls.
- 9DOF: 9DOF sensors (acceleration, magnetometer, gyroscope).
- Nonvolatile Storage: Persistent storage for userspace.
These allow for multiple users of shared hardware resources in the kernel.
- Virtual Alarm: Shared alarm resource.
- Virtual Flash: Shared flash resource.
- Virtual I2C: Shared I2C and fixed addresses.
- Virtual PWM: Shared PWM hardware.
- Virtual SPI: Shared SPI and fixed chip select pins.
- Virtual UART: Shared UART bus.
Other capsules that implement reusable logic.
- Nonvolatile to Pages: Map arbitrary reads and writes to flash pages.
- AES Encryption: AES-CCM encryption.
These are selectively included on a board to help with testing and debugging various elements of Tock.
- Debug Process Restart: Force all processes to enter a fault state when a button is pressed.
- Low-Level Debug: Provides system calls for low-level debugging tasks, such as debugging toolchain and relocation issues.
- Process Console: Provide a UART console to inspect the status of process and stop/start them.