Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile | 2 سال پیش | |
---|---|---|
.. | ||
Makefile | 5 سال پیش | |
Makefile.clang | 2 سال پیش | |
Makefile.gcc | 2 سال پیش | |
OLVASSEL.md | 6 سال پیش | |
README.md | 6 سال پیش | |
gpio.h | 6 سال پیش | |
kernel8.img | 4 سال پیش | |
link.ld | 6 سال پیش | |
main.c | 6 سال پیش | |
mbox.c | 6 سال پیش | |
mbox.h | 6 سال پیش | |
start.S | 3 سال پیش | |
uart.c | 6 سال پیش | |
uart.h | 6 سال پیش |
Before we could go on with UART0, we need mailboxes. So in this tutorial we introduce the mailbox interface. We'll use it to query the board's serial number and print that out on UART1.
NOTE: qemu does not redirect UART1 to terminal by default, only UART0, so you have to use -serial null -serial stdio
.
uart_hex(d)
prints out a binary value in hexadecimal format.
The mailbox interface. First we fill up the message in mbox
array, then we call
mbox_call(ch)
to pass it to the GPU, specifying the mailbox channel.
In this example we have used the property channel,
which requires the message to be formatted as:
0. size of the message in bytes, (x+1)*4
1. MBOX_REQUEST magic value, indicates request message
2-x. tags
x+1. MBOX_TAG_LAST magic value, indicates no more tags
Where each tag looks like:
n+0. tag identifier
n+1. value buffer size in bytes
n+2. must be zero
n+3. optional value buffer
We query the board's serial number and then we display it on the serial console.