rust-raspberrypi-OS-tutorials/09_delays
Andre Richter 969704d498
Use correct sequence of MMIO timer reads
As discussed in #2
2018-08-12 17:06:30 +02:00
..
raspi3_boot Sync with the newest Embedonomicon 2018-08-12 16:41:45 +02:00
src Use correct sequence of MMIO timer reads 2018-08-12 17:06:30 +02:00
aarch64-raspi3-none-elf.json Make it compile on newest nightly 2018-07-16 21:37:40 +02:00
Cargo.lock Sync with the newest Embedonomicon 2018-08-12 16:41:45 +02:00
Cargo.toml Sync with the newest Embedonomicon 2018-08-12 16:41:45 +02:00
kernel8.img Use correct sequence of MMIO timer reads 2018-08-12 17:06:30 +02:00
link.ld Sync with the newest Embedonomicon 2018-08-12 16:41:45 +02:00
Makefile Use llvm objcopy from rust toolchain 🎉 2018-06-29 19:48:42 +02:00
README.md Add tutorial 0A_power 2018-04-23 22:05:22 +02:00

Tutorial 09 - Delays

It is very important to wait precise amounts of time while you are interfacing with low level hardware. In this tutorial, we'll cover thee ways. One is CPU frequency dependent (and useful if wait time is given in CPU clock cycles), the other two are µs based.

delays.rs

delays::wait_cycles(cyc: u32) this is very straightforward, we execute the nop instruction n times.

delays::wait_msec(n: u32) this implementation uses ARM system registers (available on all AArch64 CPUs).

delays::SysTmr::wait_msec_st(&self, n: u64) is a BCM specific implementation, which uses the System Timer peripheral (not available on qemu).

uart.rs

We can now conveniently use delays::wait_cycles() in Uart::init().

main.rs

We test our different wait implementations.