April 2020
Intermediate to advanced
412 pages
9h 58m
English
The Raspberry PI has a number of peripheral devices that are accessible over MMIO. To demonstrate how MMIO works, our application will access the system timer:
#include <iostream>#include <chrono>#include <system_error>#include <thread>#include <fcntl.h>#include <sys/mman.h>constexpr uint32_t kTimerBase = 0x3F003000;struct SystemTimer { uint32_t CS; uint32_t counter_lo; uint32_t counter_hi;};
int main() { int memfd = ...