blob: ac803ccd84db9fc7d9c22e1f3a85328d2e7d850e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <framebuffer.h>
#include <mailbox.h>
#include <mmio.h>
#include <raspi.h>
#include <uart.h>
static void halt() {
while (1) {
asm volatile("wfi"); // Wait for interrupt. Core enters low-power state.
}
}
void main() {
bool success = true;
uint32_t error = -1;
const int raspi = raspi_init();
mmio_init(raspi); // Must be initialized before other peripherals.
mbox_init();
uart_init(raspi);
success = framebuffer_init(&error);
if (!success) {
uart_print("Failed to initialize framebuffer\n");
if (error == MAILBOX_DELIVERY_ERROR) {
uart_print("MAILBOX_DELIVERY_ERROR\n");
}
goto end;
}
uart_print("Hello world!\n");
end:
halt();
}
|