compiler/
kernel/
kernel/
tools/
kernel.rad
684 B
mmio.rad
2.5 KiB
root.rad
2.6 KiB
scheduler.rad
1.7 KiB
lib/
scripts/
seed/
sublime/
test/
vim/
.gitignore
336 B
.gitsigners
112 B
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
9.2 KiB
README
2.5 KiB
STYLE
2.5 KiB
std.lib
1.5 KiB
std.lib.test
662 B
kernel/mmio.rad
raw
| 1 | //! Fixed-width register access through live Device capabilities. |
| 2 | use super::abi; |
| 3 | |
| 4 | /// Compiler primitive for one checked 8-bit register read. |
| 5 | @intrinsic fn deviceRead8(handle: u64, offset: u64) -> u8; |
| 6 | /// Compiler primitive for one checked 8-bit register write. |
| 7 | @intrinsic fn deviceWrite8(handle: u64, offset: u64, value: u8); |
| 8 | |
| 9 | /// Read an aligned 8-bit register at a byte offset within the device. |
| 10 | export fn read8(handle: abi::Handle, offset: u64) -> u8 { |
| 11 | return deviceRead8(*handle, offset); |
| 12 | } |
| 13 | |
| 14 | /// Write an aligned 8-bit register at a byte offset within the device. |
| 15 | export fn write8(handle: abi::Handle, offset: u64, value: u8) { |
| 16 | deviceWrite8(*handle, offset, value); |
| 17 | } |
| 18 | |
| 19 | /// Compiler primitive for one checked 16-bit register read. |
| 20 | @intrinsic fn deviceRead16(handle: u64, offset: u64) -> u16; |
| 21 | /// Compiler primitive for one checked 16-bit register write. |
| 22 | @intrinsic fn deviceWrite16(handle: u64, offset: u64, value: u16); |
| 23 | |
| 24 | /// Read an aligned 16-bit register at a byte offset within the device. |
| 25 | export fn read16(handle: abi::Handle, offset: u64) -> u16 { |
| 26 | return deviceRead16(*handle, offset); |
| 27 | } |
| 28 | |
| 29 | /// Write an aligned 16-bit register at a byte offset within the device. |
| 30 | export fn write16(handle: abi::Handle, offset: u64, value: u16) { |
| 31 | deviceWrite16(*handle, offset, value); |
| 32 | } |
| 33 | |
| 34 | /// Compiler primitive for one checked 32-bit register read. |
| 35 | @intrinsic fn deviceRead32(handle: u64, offset: u64) -> u32; |
| 36 | /// Compiler primitive for one checked 32-bit register write. |
| 37 | @intrinsic fn deviceWrite32(handle: u64, offset: u64, value: u32); |
| 38 | |
| 39 | /// Read an aligned 32-bit register at a byte offset within the device. |
| 40 | export fn read32(handle: abi::Handle, offset: u64) -> u32 { |
| 41 | return deviceRead32(*handle, offset); |
| 42 | } |
| 43 | |
| 44 | /// Write an aligned 32-bit register at a byte offset within the device. |
| 45 | export fn write32(handle: abi::Handle, offset: u64, value: u32) { |
| 46 | deviceWrite32(*handle, offset, value); |
| 47 | } |
| 48 | |
| 49 | /// Compiler primitive for one checked 64-bit register read. |
| 50 | @intrinsic fn deviceRead64(handle: u64, offset: u64) -> u64; |
| 51 | /// Compiler primitive for one checked 64-bit register write. |
| 52 | @intrinsic fn deviceWrite64(handle: u64, offset: u64, value: u64); |
| 53 | |
| 54 | /// Read an aligned 64-bit register at a byte offset within the device. |
| 55 | export fn read64(handle: abi::Handle, offset: u64) -> u64 { |
| 56 | return deviceRead64(*handle, offset); |
| 57 | } |
| 58 | |
| 59 | /// Write an aligned 64-bit register at a byte offset within the device. |
| 60 | export fn write64(handle: abi::Handle, offset: u64, value: u64) { |
| 61 | deviceWrite64(*handle, offset, value); |
| 62 | } |