|
CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
|
The Arty A7 configuration has two LEDs (LD5 and LD6), four buttons, and four switches, exposed over GPIO. More...
#include <platform-gpio.hh>

Classes | |
| struct | InputBits |
| Helper that defines a set of bits in a GPIO input word used for a specific purpose. More... | |
Public Member Functions | |
| template<InputBits Bits> | |
| uint32_t | bits () volatile |
| Helper to read all of the bits defined by an InputBits instance. | |
| template<InputBits Bits> | |
| uint32_t | bit (uint32_t index) volatile |
| Helper to read a single bit defined by an InputBits instance. | |
| uint32_t | buttons () volatile |
| Read the value of all of the buttons. | |
| uint32_t | switches () volatile |
| Read the value of all of the switches. | |
| uint32_t | button (uint32_t index) volatile |
| Read the value of one of the buttons, indicated by index. | |
| uint32_t | switch_value (uint32_t index) volatile |
| Read the value of one of the switches, indicated by index. | |
| void | enable_all () volatile |
| Enable all of the LED GPIO pins. | |
| void | led_on (uint32_t index) volatile |
| Turn on the LED specified by index. | |
| void | led_off (uint32_t index) volatile |
| Turn off the LED specified by index. | |
Static Public Member Functions | |
| static constexpr uint32_t | led_bit (uint32_t index) |
| Helper that maps from an LED index to a bit to set / clear to control that LED. | |
Public Attributes | |
| uint32_t | read |
| Input register. | |
| uint32_t | write |
| The output register. | |
| uint32_t | writeEnable |
| Write enable. | |
Static Public Attributes | |
| static constexpr uint32_t | FirstLED = 14 |
| The index of the first GPIO pin connected to a LED. | |
| static constexpr uint32_t | LastLED = 15 |
| The index of the last GPIO pin connected to a LED. | |
| static constexpr uint32_t | LEDCount = LastLED - FirstLED + 1 |
| The number of GPIO pins used for LEDs. | |
| static constexpr InputBits | Buttons = {4, 4} |
| The buttons zero to three are in the low four bits. | |
| static constexpr InputBits | Switches = {4, 0} |
| Switches zero to three are in the next four bits. | |
The Arty A7 configuration has two LEDs (LD5 and LD6), four buttons, and four switches, exposed over GPIO.
This provides a simple driver for them.
Definition at line 11 of file platform-gpio.hh.
|
inline |
Helper to read a single bit defined by an InputBits instance.
Definition at line 95 of file platform-gpio.hh.
References read.
Referenced by button(), and switch_value().
|
inline |
Helper to read all of the bits defined by an InputBits instance.
Definition at line 86 of file platform-gpio.hh.
References read.
Referenced by buttons(), and switches().
|
inline |
Read the value of one of the buttons, indicated by index.
Definition at line 119 of file platform-gpio.hh.
References bit().
|
inline |
Read the value of all of the buttons.
Definition at line 103 of file platform-gpio.hh.
References bits().
|
inline |
Enable all of the LED GPIO pins.
This must be called before led_on or led_off.
Definition at line 153 of file platform-gpio.hh.
References led_bit(), LEDCount, and writeEnable.
|
inlinestaticconstexpr |
Helper that maps from an LED index to a bit to set / clear to control that LED.
Returns 0 for out-of-bounds LED values and so can be safely masked.
Definition at line 139 of file platform-gpio.hh.
References FirstLED, and LEDCount.
Referenced by enable_all(), led_off(), and led_on().
|
inline |
Turn off the LED specified by index.
Definition at line 174 of file platform-gpio.hh.
|
inline |
Turn on the LED specified by index.
Definition at line 166 of file platform-gpio.hh.
|
inline |
Read the value of one of the switches, indicated by index.
This should be called switch, but that's a keyword in C/C++.
Definition at line 129 of file platform-gpio.hh.
References bit().
|
inline |
Read the value of all of the switches.
Definition at line 111 of file platform-gpio.hh.
References bits().
|
staticconstexpr |
The buttons zero to three are in the low four bits.
Definition at line 75 of file platform-gpio.hh.
|
staticconstexpr |
The index of the first GPIO pin connected to a LED.
Definition at line 29 of file platform-gpio.hh.
Referenced by led_bit().
|
staticconstexpr |
The index of the last GPIO pin connected to a LED.
Definition at line 33 of file platform-gpio.hh.
The number of GPIO pins used for LEDs.
Definition at line 37 of file platform-gpio.hh.
Referenced by enable_all(), and led_bit().
| uint32_t GPIO::read |
|
staticconstexpr |
Switches zero to three are in the next four bits.
Definition at line 80 of file platform-gpio.hh.
| uint32_t GPIO::write |
The output register.
This is a bitmap of GPIO lines to set.
Definition at line 20 of file platform-gpio.hh.
| uint32_t GPIO::writeEnable |
Write enable.
This sets the pins that should be controlled by write.
Definition at line 24 of file platform-gpio.hh.
Referenced by enable_all().