diff options
author | 3gg <3gg@shellblade.net> | 2025-10-14 17:54:17 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-10-14 17:54:17 -0700 |
commit | c099bcb7402421985e6e8c025e8cde591eaa073a (patch) | |
tree | b78e46d44406909bb8f93fc655f1417fc9666c3c /src/mailbox.h | |
parent | 338bd46fb6dbcb8271102ddb6b896a335eb909dc (diff) |
Add MAIL_T macro; read framebuffer allocation response
Diffstat (limited to 'src/mailbox.h')
-rw-r--r-- | src/mailbox.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mailbox.h b/src/mailbox.h index b35c7a6..2104265 100644 --- a/src/mailbox.h +++ b/src/mailbox.h | |||
@@ -1,3 +1,9 @@ | |||
1 | /* | ||
2 | References: | ||
3 | https://github-wiki-see.page/m/raspberrypi/firmware/wiki/Mailbox-property-interface | ||
4 | https://jsandler18.github.io/extra/prop-channel.html | ||
5 | https://jsandler18.github.io/extra/mailbox.html | ||
6 | */ | ||
1 | #pragma once | 7 | #pragma once |
2 | 8 | ||
3 | #include <stdint.h> | 9 | #include <stdint.h> |
@@ -6,6 +12,9 @@ | |||
6 | // must be aligned to a 16-byte boundary. | 12 | // must be aligned to a 16-byte boundary. |
7 | #define MAIL_ALIGN 16 | 13 | #define MAIL_ALIGN 16 |
8 | 14 | ||
15 | // Type prefix for data arrays used as mail. | ||
16 | #define MAIL_T volatile __attribute__((aligned(MAIL_ALIGN))) | ||
17 | |||
9 | enum | 18 | enum |
10 | { | 19 | { |
11 | PROPERTY_CHANNEL = 8, | 20 | PROPERTY_CHANNEL = 8, |
@@ -55,9 +64,6 @@ typedef struct __attribute__((aligned(MAIL_ALIGN))) Mail { | |||
55 | Tag tags[]; // Variable quantity. | 64 | Tag tags[]; // Variable quantity. |
56 | } Mail; | 65 | } Mail; |
57 | 66 | ||
58 | // TODO: Remove? Unused. | ||
59 | #define MAIL_SIZE(TYPE) (sizeof(TYPE) + (2 * sizeof(uint32_t))) | ||
60 | |||
61 | void mbox_init(); | 67 | void mbox_init(); |
62 | const Mail* mbox_read(uint8_t channel); | 68 | const Mail* mbox_read(uint8_t channel); |
63 | void mbox_write(uint8_t channel, volatile const void* mail); | 69 | void mbox_write(uint8_t channel, volatile const void* mail); |