summaryrefslogtreecommitdiff
path: root/src/framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/framebuffer.c')
-rw-r--r--src/framebuffer.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/framebuffer.c b/src/framebuffer.c
new file mode 100644
index 0000000..a90bcaa
--- /dev/null
+++ b/src/framebuffer.c
@@ -0,0 +1,30 @@
1#include <framebuffer.h>
2
3#include <mailbox.h>
4
5#include <stdint.h>
6
7#define WIDTH 640
8#define HEIGHT 480
9#define DEPTH 32
10
11bool framebuffer_init(uint32_t* error) {
12 volatile const Mail* mail;
13
14 volatile __attribute__((aligned(MAIL_ALIGN))) uint32_t InitFramebuffer[] = {
15 80, // Size in bytes aligned to MAIL_ALIGN(16).
16 MAILBOX_REQUEST,
17 TAG_FRAMEBUFFER_SET_PHYSICAL_SCREEN_SIZE, 8, MAILBOX_REQUEST, WIDTH, HEIGHT,
18 TAG_FRAMEBUFFER_SET_VIRTUAL_SCREEN_SIZE, 8, MAILBOX_REQUEST, WIDTH, HEIGHT,
19 TAG_FRAMEBUFFER_SET_DEPTH, 4, MAILBOX_REQUEST, DEPTH,
20 TAG_END,
21 0, 0, 0 // Pad.
22 };
23
24 mbox_write(PROPERTY_CHANNEL, InitFramebuffer);
25 while ((mail = mbox_read(PROPERTY_CHANNEL)) != (volatile Mail*)(InitFramebuffer));
26
27 *error = mail->code;
28 return mail->code == MAILBOX_SUCCESS;
29}
30