ardera
Posts: 3
Joined: Wed Jul 18, 2018 9:49 am

Understanding the mailbox property interface

Wed Jul 18, 2018 10:14 am

Hello,
I am really confused about this documentation: https://github.com/raspberrypi/firmware ... -interface
For example: it says "concatenated tags" in there. That does mean the complete tags are placed in that buffer, not the pointers to them, doesn't it? (cause using pointers it'd be a lot easier to implement IMO)

Next, when I want to find out the VideoCore firmware revision for example: the property tag would look like this, wouldn't it?

Code: Select all

struct {
	uint32_t id = 0x00000001;	// ID 1 = get VC firmware revision
	uint32_t vbuffer_size = 0;	// no request value, so the value buffer size is 0
	uint32_t req_resp_code = 0;	// bit 31 clear = request
} p_tag_t;
(no real C i know)

But where does the return value go then? does the GPU shift the whole property request by 4 bytes in order to fit its response (the firmware revision) into the value buffer? (seems highly unlikely)
Or do I have to include a value buffer large enough for the return values?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20464
Joined: Sat Jul 30, 2011 7:41 pm

Re: Understanding the mailbox property interface

Wed Jul 18, 2018 10:31 am

I've started writing a more comprehensive mailbox document, the work in [progress is here

https://github.com/raspberrypi/document ... /mailboxes

Does that help?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

ardera
Posts: 3
Joined: Wed Jul 18, 2018 9:49 am

Re: Understanding the mailbox property interface

Wed Jul 18, 2018 12:44 pm

Yep, now I understand. Thanks!

User avatar
DougieLawson
Posts: 33787
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Understanding the mailbox property interface

Wed Jul 18, 2018 1:25 pm

jamesh wrote:
Wed Jul 18, 2018 10:31 am
I've started writing a more comprehensive mailbox document, the work in [progress is here

https://github.com/raspberrypi/document ... /mailboxes

Does that help?
In your article can you include a simple sample C program that anyone can cut'n'paste and get running. Do something naff like reading the CPU serial with a mailbox call.

(Yes I know I can write that, I'm thinking about the newbies.)

Edit: Or just steal https://github.com/AndrewFromMelbourne/ ... _mailbox.c
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20464
Joined: Sat Jul 30, 2011 7:41 pm

Re: Understanding the mailbox property interface

Wed Jul 18, 2018 3:44 pm

DougieLawson wrote:
Wed Jul 18, 2018 1:25 pm
jamesh wrote:
Wed Jul 18, 2018 10:31 am
I've started writing a more comprehensive mailbox document, the work in [progress is here

https://github.com/raspberrypi/document ... /mailboxes

Does that help?
In your article can you include a simple sample C program that anyone can cut'n'paste and get running. Do something naff like reading the CPU serial with a mailbox call.

(Yes I know I can write that, I'm thinking about the newbies.)

Edit: Or just steal https://github.com/AndrewFromMelbourne/ ... _mailbox.c
Yes, don't see why not. Similar to the linked code, but with comments to explain everything. I'll add it to the list.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20464
Joined: Sat Jul 30, 2011 7:41 pm

Re: Understanding the mailbox property interface

Wed Jul 18, 2018 4:26 pm

Turns out we already had a link to our own example source code on the first page, but I have also added a link to the example linked above, as that is pretty clear and simple.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

bzt
Posts: 160
Joined: Sat Oct 14, 2017 9:57 pm

Re: Understanding the mailbox property interface

Wed Jul 18, 2018 4:42 pm

Considering this question was asked under Bare Metal, I suppose opening "/dev/vcio" (as in the example linked above) is not really an option. I think this example would be more appropriate (also MIT licensed):
https://github.com/bztsrc/raspi3-tutori ... xes/main.c
Just a sidenote, because of the varying number of tags, I have used an uint32_t array instead of a struct. Although if you don't plan to take advantage of more tags in a single query you can use your struct as well.

Cheers,
bzt

Return to “Bare metal, Assembly language”

Who is online

Users browsing this forum: No registered users and 5 guests