502413b9ab
- Add IOSerial: PL011 (0x0900_0000) TX with FIFO-full polling, yield while waiting - Add Arch/IO.h (32-bit MMIO with DSB) and Arch/CPU.h (yield, WFI) - Extend types.h (e.g. ASCII, Address, Int/UInt aliases) - Wire KernelMain to IOSerialPutString for early boot output - Drop .sourcekit-lsp config; note IO glob in CMake (commented)
14 lines
549 B
C
14 lines
549 B
C
#pragma once
|
|
#include <types.h>
|
|
|
|
static inline void IOAddressWrite32(UInt64 address, UInt32 value) {
|
|
__asm__ volatile ("dsb sy" ::: "memory"); // wait till all previous writes are finished physically
|
|
*(volatile UInt32*)address = value;
|
|
__asm__ volatile ("dsb sy" ::: "memory"); // wait till my write is finished physically
|
|
}
|
|
|
|
static inline UInt32 IOAddressRead32(UInt64 address) {
|
|
UInt32 value = *(volatile UInt32*)address;
|
|
__asm__ volatile ("dsb ld" ::: "memory"); // wait till my read is finished physically
|
|
return value;
|
|
} |