Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile 2 年之前
..
Makefile 426205e2a3 Added makefiles for LLVM Clang 5 年之前
Makefile.clang 9c5c2813a0 Update QEMU command in all README and Makefile 2 年之前
Makefile.gcc 9c5c2813a0 Update QEMU command in all README and Makefile 2 年之前
OLVASSEL.md a2ce05070e Fixes in comments 6 年之前
README.md a2ce05070e Fixes in comments 6 年之前
gpio.h 7ace64ba9f Initial commit 6 年之前
kernel8.img 8ce0f75b47 Recompiled with latest gcc 4 年之前
link.ld 7ace64ba9f Initial commit 6 年之前
main.c a798ff59f4 Fixed issue #3 6 年之前
mbox.c 214885df63 compute the mailbox cmd only once 6 年之前
mbox.h 7ace64ba9f Initial commit 6 年之前
start.S ea4691947c Improve comments wrt stack setup 3 年之前
uart.c e1c97f2904 Fixed issue #2 6 年之前
uart.h 7ace64ba9f Initial commit 6 年之前

README.md

Tutorial 04 - Mailboxes

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.h, uart.c

uart_hex(d) prints out a binary value in hexadecimal format.

Mbox.h, mbox.c

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

Main

We query the board's serial number and then we display it on the serial console.