Man page - vcmailbox(7)

Packages contas this manual

Manual

VCMAILBOX(7) Miscellaneous Information Manual VCMAILBOX(7)

vcmailbox - the VideoCore mailbox property interface

The mailbox can be used by the ARM on the Raspberry Pi to communicate with the VideoCore processor. From the command line, the vcmailbox(1) can be used for this purpose. The mailbox operates a simple request / response protocol:

The response overwrites the request.
The callee is not allowed to return a different buffer address, this allows the caller to make independent asynchronous requests.
  • The buffer itself is 16-byte aligned as only the upper 28 bits of the address can be passed via the mailbox.
  • All u64/u32/u16 values are in host CPU endian order.
  • Unknown tags are ignored (the response bit will not be set).
  • Response may include unsolicited tags.
  • Response tag lengths may be longer than expected if additional information is provided in a future format.
  • The response is truncated to the provided buffer length.
  • Incompatible changes require a new tag so that where the buffer is the size required by a previous version the truncated part should be readable as per the previous version.
  • Response length indicates the desired length even when it is longer than the buffer size filled.
  • Tag value length can be used to infer the version of the request/response.
Tags should be processed in order except where an interface requires multiple tags for a single operation (like the frame buffer).

The mailbox interface has 28 bits (MSB) available for the value and 4 bits (LSB) for the channel.
  • Request message: 28 bits (MSB) buffer address
  • Response message: 28 bits (MSB) buffer address
Channels 8 and 9 are used.
  • Channel 8: Request from ARM for response by VC
  • Channel 9: Request from VC for response by ARM (none currently defined)

buffer size in bytes (including the header values, the end tag and padding)
buffer request/response code

Request codes:

0x00000000
process request
All other values reserved

Response codes:

0x80000000
request successful
0x80000001
error parsing request buffer (partial response)
All other values reserved
sequence of concatenated tags
0x0 (end tag)
padding

tag identifier
value buffer size in bytes
Request codes:
request
reserved
Response codes:
response
value length in bytes
value buffer
padding to align the tag to 32 bits.

0x00000001
0 bytes
4 bytes
firmware revision

0x00010001
0 bytes
4 bytes
board model

0x00010002
0 bytes
4 bytes
board revision

0x00010003
0 bytes
6 bytes
MAC address in network byte order

0x00010004
0 bytes
8 bytes
board serial

0x00010005
0 bytes
8 bytes
base address in bytes
size in bytes

Future formats may specify multiple base+size combinations.

0x00010006
0 bytes
8 bytes
base address in bytes
size in bytes

Future formats may specify multiple base+size combinations.

0x00010007
0 bytes
variable bytes (multiple of 8)
parent clock id (0 for a root clock)
clock id
(repeated)

Returns all clocks that exist in top-down, breadth-first order. Clocks that depend on another clock should be defined as children of that clock. Clocks that depend on no other clocks should have no parent. Clock IDs are as in the CLOCK TAGS section below.

0x00050001
0 bytes
variable bytes
ASCII command line string

Caller should not assume the string is null terminated.

0x00060001
0 bytes
4 bytes
mask
DMA channels 0-15 (0=do not use, 1=usable)
reserved for future use

Caller assumes that the VC has enabled all the usable DMA channels.

0x00000000
SD Card
0x00000001
UART0
0x00000002
UART1
0x00000003
USB HCD
0x00000004
I2C0
0x00000005
I2C1
0x00000006
I2C2
0x00000007
SPI
0x00000008
CCP2TX
0x00000009
Unknown (RPi4)
0x0000000a
Unknown (RPi4)

0x00020001
4 bytes
device id
8 bytes
device id
state
0=off, 1=on
0=device exists, 1=device does not exist
reserved for future use

Response indicates current state.

0x00020002
4 bytes
device id
8 bytes
device id
enable wait time in microseconds

Response indicates wait time required after turning a device on before power is stable. Returns 0 wait time if the device does not exist.

0x00028001
8 bytes
device id
state
0=off, 1=on
0=do not wait, 1=wait
reserved for future use (set to 0)
8 bytes
device id
state
0=off, 1=on
0=device exists, 1=device does not exist
reserved for future use

Response indicates new state, with/without waiting for the power to become stable.

0x00000000
reserved
0x00000001
EMMC
0x00000002
UART
0x00000003
ARM
0x00000004
CORE
0x00000005
V3D
0x00000006
H264
0x00000007
ISP
0x00000008
SDRAM
0x00000009
PIXEL
0x0000000a
PWM
0x0000000b
HEVC
0x0000000c
EMMC2
0x0000000d
M2MC
0x0000000e
PIXEL_BVB

All clocks are the base clocks for those peripherals, e.g. 3MHz for UART, 50/100MHz for EMMC, not the dividers applied using the peripheral.

0x00030001
4 bytes
clock id
8 bytes
clock id
state
0=off, 1=on
0=clock exists, 1=clock does not exist
reserved for future use

0x00038001
8 bytes
clock id
state
0=off, 1=on
0=clock exists, 1=clock does not exist
reserved for future use (set to 0)
8 bytes
clock id
state
0=off, 1=on
0=clock exists, 1=clock does not exist
reserved for future use

0x00030002
4 bytes
clock id
8 bytes
clock id
rate (in Hz)

Next enable rate should be returned even if the clock is not running. A rate of 0 is returned if the clock does not exist.

0x00038002
12 bytes
clock id
rate (in Hz)
skip setting turbo
8 bytes
clock id
rate (in Hz)

Next supported enable rate should be returned even if the clock is not running. A rate of 0 is returned if the clock does not exist. The clock rate may be clamped to the supported range.

By default when setting arm freq above default, other turbo settings will be enabled (e.g. voltage, sdram and gpu frequencies). You can disable this effect by setting "skip setting turbo" to 1.

0x00030004
4 bytes
clock id
8 bytes
clock id
rate (in Hz)

Return the maximum supported clock rate for the given clock. Clocks should not be set higher than this.

0x00030007
4 bytes
clock id
8 bytes
clock id
rate (in Hz)

Return the minimum supported clock rate for the given clock. This may be used when idle.

0x00030009
4 bytes
id
8 bytes
id
level

Get the turbo state for index id. id should be 0. level will be zero for non-turbo and one for turbo.

0x00038009
8 bytes
id
level
8 bytes
id
level

Set the turbo state for index id. id should be zero. level will be zero for non-turbo and one for turbo. This will cause GPU clocks to be set to maximum when enabled and minimum when disabled.

0x00000000
reserved
0x00000001
Core
0x00000002
SDRAM_C
0x00000003
SDRAM_P
0x00000004
SDRAM_I

0x00030003
4 bytes
voltage id
8 bytes
voltage id
value (offset from 1.2V in units of 0.025V)

The voltage value may be clamped to the supported range. A value of 0x80000000 means the id was not valid.

0x00038003
8 bytes
voltage id
value (offset from 1.2V in units of 0.025V)
8 bytes
voltage id
value (offset from 1.2V in units of 0.025V)

The voltage value may be clamped to the supported range. A value of 0x80000000 means the id was not valid.

0x00030005
4 bytes
voltage id
8 bytes
voltage id
value (offset from 1.2V in units of 0.025V)

Return the maximum supported voltage rate for the given id. Voltages should not be set higher than this.

0x00030008
4 bytes
voltage id
8 bytes
voltage id
value (offset from 1.2V in units of 0.025V)

Return the minimum supported voltage rate for the given id. This may be used when idle.

0x00030006
4 bytes
temperature id
8 bytes
temperature id
value

Return the temperature of the SoC in thousandths of a degree C. id should be zero.

0x0003000a
4 bytes
temperature id
8 bytes
temperature id
value

Return the maximum safe temperature of the SoC in thousandths of a degree C. id should be zero. Overclock may be disabled above this temperature.

0x0003000c
12 bytes
size
alignment
flags
4 bytes
handle

Allocates contiguous memory on the GPU. size and alignment are in bytes. flags contain:

Name Value Comments
_ _ _
MEM_FLAG_NORMAL 0 normal allocating alias; don't use from ARM
MEM_FLAG_DISCARDABLE 1 << 0 can be resized to 0 at any time; use for cached data
MEM_FLAG_DIRECT 1 << 2 0xC alias uncached
MEM_FLAG_COHERENT 1 << 3 0x8 alias; non-allocating in L2 but coherent
MEM_FLAG_L1_NONALLOCATING 3 << 2 Allocating in L2
MEM_FLAG_ZERO 1 << 4 Initialise buffer to all zeros
MEM_FLAG_NO_INIT 1 << 5 Don't initialise; default is initialise to all ones
MEM_FLAG_HINT_PERMALOCK 1 << 6 Likely to be locked for long periods of time

0x0003000d
4 bytes
handle
4 bytes
bus address

Lock buffer in place, and return a bus address. Must be done before memory can be accessed

0x0003000e
4 bytes
handle
4 bytes
status

Unlock buffer. It retains contents, but may move. Needs to be locked before next use. status=0 is success.

0x0003000f
4 bytes
handle
4 bytes
status

Free the memory buffer. status=0 is success.

0x00030010
28 bytes
function pointer
r0
r1
r2
r3
r4
r5
4 bytes
r0

Calls the function at given (bus) address and with arguments given. E.g. r0 = fn(r0, r1, r2, r3, r4, r5); It blocks until call completes. The (GPU) instruction cache is implicitly flushed. Setting the lsb of function pointer address will suppress the instruction cache flush if you know the buffer hasn't changed since last execution.

0x00030014
4 bytes
dispmanx resource handle
8 bytes
0 is successful
mem handle for resource

Gets the mem_handle associated with a created dispmanx resource. This can be locked and the memory directly written from the arm to avoid having to copy the image data to GPU.

0x00030020
4 bytes
block number
136 bytes
block number
status
EDID block

This reads the specified EDID block from attached HDMI/DVI device. There will always be at least one block of 128 bytes, but there may be additional blocks. You should keep requesting blocks (starting from 0) until the status returned is non-zero.

  • All tags in the request are processed in one operation.
  • It is not valid to mix Test tags with Get/Set tags in the same operation and no tags will be returned.
  • Get tags will be processed after all Set tags.
  • If an allocate buffer tag is omitted when setting parameters, then no change occurs unless it can be accommodated without changing the buffer base or size.
  • When an allocate buffer response is returned, the old buffer area (if the base or size has changed) is implicitly freed.

For example:

1.
The current values/defaults are loaded into a temporary struct
2.
The tags are used to overwrite some or all of the values
3.
Validation of Test/Set tags occurs
4.
The Set changes are applied and responses based on the requested Get/Test/Set tags are written to the buffer Duplicating the same tag in one request/response is prohibited. The expected result is either an error or implementation specified undefined behaviour (such as only using the last instance of the tag).

0x00040001
4 bytes
alignment in bytes
8 bytes
frame buffer base address in bytes
frame buffer size in bytes

If the requested alignment is unsupported then the current base and size (which may be 0 if not allocated) is returned and no change occurs.

0x00048001
0 bytes
0 bytes

Releases and disables the frame buffer.

0x00040002
4 bytes
state
0=off, 1=on
reserved for future use (set to 0)
4 bytes
state
0=off, 1=on
reserved for future use

0x00040003
0 bytes
8 bytes
width in pixels
height in pixels

Note that the "physical (display)" size is the size of the allocated buffer in memory, not the resolution of the video signal sent to the display device.

0x00044003
8 bytes
width in pixels
height in pixels
8 bytes
width in pixels
height in pixels

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x00048003
8 bytes
width in pixels
height in pixels
8 bytes
width in pixels
height in pixels

The response may not be the same as the request so it must be checked. May be the previous width/height or 0 for unsupported.

0x00040004
0 bytes
8 bytes
width in pixels
height in pixels

Note that the "virtual (buffer)" size is the portion of buffer that is sent to the display device, not the resolution the buffer itself. This may be smaller than the allocated buffer size in order to implement panning.

0x00044004
8 bytes
width in pixels
height in pixels
8 bytes
width in pixels
height in pixels

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x00048004
8 bytes
width in pixels
height in pixels
8 bytes
width in pixels
height in pixels

The response may not be the same as the request so it must be checked. May be the previous width/height or 0 for unsupported.

0x00040005
0 bytes
4 bytes
bits per pixel

Test depth

0x00044005
4 bytes
bits per pixel
4 bytes
bits per pixel

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x00048005
4 bytes
bits per pixel
4 bytes
bits per pixel

The response may not be the same as the request so it must be checked. May be the previous depth or 0 for unsupported.

0x00040006
0 bytes
4 bytes
state
0x0
BGR
0x1
RGB

0x00044006
4 bytes
state (as above)
4 bytes
state (as above)

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x00048006
4 bytes
state (as above)
4 bytes
state (as above)

The response may not be the same as the request so it must be checked.

0x00040007
0 bytes
4 bytes
state
0x0
Alpha channel enabled (0 = fully opaque)
0x1
Alpha channel reversed (0 = fully transparent)
0x2
Alpha channel ignored

0x00044007
4 bytes
state (as above)
4 bytes
state (as above)

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x00048007
4 bytes
state (as above)
4 bytes
state (as above)

The response may not be the same as the request so it must be checked.

0x00040008
0 bytes
4 bytes
bytes per line

0x00040009
0 bytes
8 bytes
X in pixels
Y in pixels

0x00044009
8 bytes
X in pixels
Y in pixels
8 bytes
X in pixels
Y in pixels

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x00048009
8 bytes
X in pixels
Y in pixels
8 bytes
X in pixels
Y in pixels

The response may not be the same as the request so it must be checked. May be the previous offset or 0 for unsupported.

0x0004000a
0 bytes
16 bytes
top in pixels
bottom in pixels
left in pixels
right in pixels

0x0004400a
16 bytes
top in pixels
bottom in pixels
left in pixels
right in pixels
16 bytes
top in pixels
bottom in pixels
left in pixels
right in pixels

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x0004800a
16 bytes
top in pixels
bottom in pixels
left in pixels
right in pixels
16 bytes
top in pixels
bottom in pixels
left in pixels
right in pixels

The response may not be the same as the request so it must be checked. May be the previous overscan or 0 for unsupported.

0x0004000b
0 bytes
1024 bytes
RGBA palette values (index 0 to 255)

0x0004400b
24 bytes..1032 bytes
offset: first palette index to set (0-255)
length: number of palette entries to set (1-256)
RGBA palette values (offset to offset+length-1)
4 bytes
0=valid, 1=invalid

Response is the same as the request (or modified), to indicate if this configuration is supported (in combination with all the other settings). Does not modify the current hardware or frame buffer state.

0x0004800b
24 bytes..1032 bytes
offset: first palette index to set (0-255)
length: number of palette entries to set (1-256)
RGBA palette values (offset to offset+length-1)
4 bytes
0=valid, 1=invalid

The response may not be the same as the request so it must be checked. Palette changes should not be partially applied.

0x00008010
24 bytes
width
height
(unused)
pointer to pixels
hotspotX
hotspotY
4 bytes
0=valid, 1=invalid

Format is 32bpp (ARGB). Width and height should be >= 16 and (width * height) <= 64.

0x00008011
16 bytes
enable (1=visible, 0=invisible)
x
y
flags; 0=display coords, 1=framebuffer coords
4 bytes
0=valid, 1=invalid

if Set Cursor Info hasn't been called a default cursor will be used (64x64 with hotspot at 0,0).