summaryrefslogtreecommitdiff
path: root/src/mailbox.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailbox.h')
-rw-r--r--src/mailbox.h12
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/*
2References:
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
9enum 18enum
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
61void mbox_init(); 67void mbox_init();
62const Mail* mbox_read(uint8_t channel); 68const Mail* mbox_read(uint8_t channel);
63void mbox_write(uint8_t channel, volatile const void* mail); 69void mbox_write(uint8_t channel, volatile const void* mail);