mirror of
https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials.git
synced 2024-11-19 15:25:29 +00:00
c5981b6ccd
Despite invoking clippy with xargo, it wasnt actually using the custom target, so we don't need xargo here for now... The target argument was missing anyways. Using it throws an error. Needs some more investigation. |
||
---|---|---|
.. | ||
raspi3_boot | ||
src | ||
aarch64-raspi3-none-elf.json | ||
Cargo.lock | ||
Cargo.toml | ||
kernel8.img | ||
link.ld | ||
Makefile | ||
README.md |
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.