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)
25 lines
562 B
C
25 lines
562 B
C
#include <IO/IOSerial.h>
|
|
#include <Arch/IO.h>
|
|
#include <Arch/CPU.h>
|
|
|
|
Int32 IOSerialPutCharacter(ASCII character) {
|
|
// TXFF -- TRansmit FIFO Full for PL011 is 5 bit of FR reg (0x18)
|
|
UInt64 uartFR = kUARTBaseAddress + 0x18;
|
|
|
|
while ((IOAddressRead32(uartFR) & (1 << 5)) != 0) {
|
|
CPUYield();
|
|
}
|
|
|
|
IOAddressWrite32(kUARTBaseAddress, character);
|
|
return character;
|
|
}
|
|
|
|
Int32 IOSerialPutString(const ASCII* string) {
|
|
Int i = 0;
|
|
while (string[i] != '\0') {
|
|
IOSerialPutCharacter(string[i]);
|
|
i++;
|
|
}
|
|
|
|
return i;
|
|
} |