26 lines
560 B
C
26 lines
560 B
C
#include <IO/Serial.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;
|
|
}
|