This commit is contained in:
Daniil Gentili 2022-12-21 19:32:32 +01:00
parent 59025d1c7d
commit c097b01176
3 changed files with 6 additions and 5 deletions

View File

@ -16,5 +16,5 @@ _start:
mov sp, #LOW_MEMORY // Initialize the kernel stack pointer to +4mb, growing downwards mov sp, #LOW_MEMORY // Initialize the kernel stack pointer to +4mb, growing downwards
bl kernel_main // kernel_main() bl kernel_main // kernel_main()
halt: halt: // Doesn't actually shut down the other cores for now, just makes them spin endlessly
b halt b halt

View File

@ -36,7 +36,8 @@ void kernel_main(void)
delay(1000); delay(1000);
uart_send_string("Hello, world!\r\n"); uart_send_string("Hello, world!\r\n");
/*while (1) { while (1) {
// Echo back chars, the way a normal console would.
uart_send(uart_recv()); uart_send(uart_recv());
}*/ }
} }

View File

@ -58,12 +58,12 @@ void uart_init(void)
void uart_send(char c) void uart_send(char c)
{ {
while(get32(UART_FR) & (1<<5)); while (get32(UART_FR) & (1<<5));
put32(UART_DR, c); put32(UART_DR, c);
} }
char uart_recv() char uart_recv()
{ {
while(get32(UART_FR) & (1<<4)); while (get32(UART_FR) & (1<<4));
return put32(UART_DR) & 0xFF; return put32(UART_DR) & 0xFF;
} }