diff options
| author | 3gg <3gg@shellblade.net> | 2025-10-15 19:32:21 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-10-15 19:32:21 -0700 |
| commit | 55bcdf37342d782c723166de54ff031d09b1281f (patch) | |
| tree | 11a95bfb390ba6f73e122a17fe0a00312f25dc78 /src/kernel.c | |
| parent | c099bcb7402421985e6e8c025e8cde591eaa073a (diff) | |
Clear framebuffer to pink
Diffstat (limited to 'src/kernel.c')
| -rw-r--r-- | src/kernel.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/kernel.c b/src/kernel.c index 151028d..2a4005a 100644 --- a/src/kernel.c +++ b/src/kernel.c | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | #include <mailbox.h> | 2 | #include <mailbox.h> |
| 3 | #include <mmio.h> | 3 | #include <mmio.h> |
| 4 | #include <raspi.h> | 4 | #include <raspi.h> |
| 5 | #include <string.h> | ||
| 5 | #include <uart.h> | 6 | #include <uart.h> |
| 6 | 7 | ||
| 8 | #include <stdint.h> | ||
| 9 | |||
| 7 | static void halt() { | 10 | static void halt() { |
| 8 | while (1) { | 11 | while (1) { |
| 9 | asm volatile("wfi"); // Wait for interrupt. Core enters low-power state. | 12 | asm volatile("wfi"); // Wait for interrupt. Core enters low-power state. |
| @@ -13,6 +16,7 @@ static void halt() { | |||
| 13 | void main() { | 16 | void main() { |
| 14 | bool success = true; | 17 | bool success = true; |
| 15 | uint32_t error = -1; | 18 | uint32_t error = -1; |
| 19 | char buf[32]; | ||
| 16 | 20 | ||
| 17 | const int raspi = raspi_init(); | 21 | const int raspi = raspi_init(); |
| 18 | mmio_init(raspi); // Must be initialized before other peripherals. | 22 | mmio_init(raspi); // Must be initialized before other peripherals. |
| @@ -31,7 +35,24 @@ void main() { | |||
| 31 | goto end; | 35 | goto end; |
| 32 | } | 36 | } |
| 33 | 37 | ||
| 34 | uart_print("Hello world!\n"); | 38 | const Framebuffer* fb = framebuffer_get(); |
| 39 | uart_print("Framebuffer:"); | ||
| 40 | uart_print("\n width: "); | ||
| 41 | uart_print(utoa(fb->width, buf, sizeof(buf))); | ||
| 42 | uart_print("\n height: "); | ||
| 43 | uart_print(utoa(fb->height, buf, sizeof(buf))); | ||
| 44 | uart_print("\n depth: "); | ||
| 45 | uart_print(utoa(fb->depth, buf, sizeof(buf))); | ||
| 46 | uart_print("\n addr: "); | ||
| 47 | uart_print(ptoa(fb->pixels, buf, sizeof(buf))); | ||
| 48 | uart_print("\n size: "); | ||
| 49 | uart_print(utoa(fb->size, buf, sizeof(buf))); | ||
| 50 | uart_print("\n"); | ||
| 51 | |||
| 52 | uart_print("Clearing framebuffer\n"); | ||
| 53 | framebuffer_clear((Pixel){255, 0, 255}); | ||
| 54 | |||
| 55 | uart_print("All done\n"); | ||
| 35 | 56 | ||
| 36 | end: | 57 | end: |
| 37 | halt(); | 58 | halt(); |
