summaryrefslogtreecommitdiff
path: root/src/mailbox.c
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-10-13 20:44:06 -0700
committer3gg <3gg@shellblade.net>2025-10-13 20:44:06 -0700
commit338bd46fb6dbcb8271102ddb6b896a335eb909dc (patch)
treedafa50f732804df571521751c619de57d12299aa /src/mailbox.c
parent079cd940e727c1705e9f1b30706b9531d5aedda6 (diff)
Finish framebuffer initializationHEADmain
Diffstat (limited to 'src/mailbox.c')
-rw-r--r--src/mailbox.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/mailbox.c b/src/mailbox.c
index aacb747..310b2b1 100644
--- a/src/mailbox.c
+++ b/src/mailbox.c
@@ -16,13 +16,8 @@ static inline uint8_t msg_channel(Message msg) {
16 return msg & 0xf; 16 return msg & 0xf;
17} 17}
18 18
19static inline const void* msg_data(Message msg) {
20 // The data field is actually a pointer to the data.
21 return (const void*)((uintptr_t)(msg >> 4));
22}
23
24static inline Message msg_make(uint8_t channel, volatile const void* data) { 19static inline Message msg_make(uint8_t channel, volatile const void* data) {
25 return ((uintptr_t)(data) << 4) | (channel & 0xf); 20 return ((uintptr_t)(data) & ~0xf) | (channel & 0xf);
26} 21}
27 22
28typedef struct Mailbox { 23typedef struct Mailbox {
@@ -61,7 +56,7 @@ const Mail* mbox_read(uint8_t channel) {
61 // Read the mail. 56 // Read the mail.
62 msg = pMailbox->inbox; 57 msg = pMailbox->inbox;
63 } while (msg_channel(msg) != channel); 58 } while (msg_channel(msg) != channel);
64 return (const Mail*)(msg_data(msg)); 59 return (const Mail*)((uintptr_t)msg & ~0xf);
65} 60}
66 61
67void mbox_write(uint8_t channel, volatile const void* mail) { 62void mbox_write(uint8_t channel, volatile const void* mail) {