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.
- ADC Microphone: Single ADC pin microphone.
- Analog Sensors: Single ADC pin sensors.
- APDS9960: Proximity sensor.
- FXOS8700CQ: Accelerometer and magnetometer.
- HTS221: Temperature and humidity sensor.
- ISL29035: Light sensor.
- L3GD20: MEMS 3 axys digital gyroscope and temperature sensor.
- LSM303xx Support: Shared files.
- LSM303AGR: 3D accelerometer and 3D magnetometer sensor.
- LSM303DLHC: 3D accelerometer and 3D magnetometer sensor.
- LPS25HB: Pressure sensor.
- MLX90614: Infrared temperature sensor.
- RP2040 Temperature: Analog RP2040 temperature sensor.
- SHT3x: SHT3x temperature and humidity sensor.
- SI7021: Temperature and humidity sensor.
- STM32 Temperature: Analog STM32 temperature sensor.
- TSL2561: Light sensor.
These drivers provide support for various ICs.
- FM25CL: FRAM chip.
- FT6x06: FT6x06 touch panel.
- HD44780 LCD: HD44780 LCD screen.
- 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.
- ST77xx: ST77xx IPS screen.
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.
- Networking: Networking stack.
- 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 Controller: SPI controller device (SPI master)
- SPI Peripheral: SPI peripheral device (SPI 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.
- CTAP: Client to Authenticator Protocol (CTAP) support.
- Humidity: Query humidity sensors.
- LED: Turn on and off LEDs.
- LED Matrix: Control a 2D array of LEDs.
- Proximity: Proximity sensors.
- Screen: Displays and screens.
- SHA: SHA hashes.
- Sound Pressure: Query sound pressure levels.
- Temperature: Query temperature sensors.
- Text Screen: Text-based displays.
- Touch: User touch panels.
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 ADC: Shared single ADC channel.
- Virtual AES-CCM: Shared AES-CCM engine.
- Virtual Alarm: Shared alarm resource.
- Virtual Digest: Shared digest resource.
- Virtual Flash: Shared flash resource.
- Virtual HMAC: Shared HMAC resource.
- Virtual I2C: Shared I2C and fixed addresses.
- Virtual PWM: Shared PWM hardware.
- Virtual RNG: Shared random number generator.
- Virtual SHA: Shared SHA hashes.
- Virtual SPI: Shared SPI and fixed chip select pins.
- Virtual Timer: Shared timer.
- Virtual UART: Shared UART bus.
Other capsules that implement reusable logic.
- Nonvolatile to Pages: Map arbitrary reads and writes to flash pages.
- HMAC: Hash-based Message Authentication Code (HMAC) digest engine.
- Log Storage: Log storage abstraction on top of flash devices.
- Bus Adapters: Generic abstraction for SPI/I2C/8080.
- TicKV: Key-value storage.
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.
- Panic Button: Use a button to force a
panic!()
. - Process Console: Provide a UART console to inspect the status of process and stop/start them.