Name
GPU Communication Support — Use of GPU mailbox
Synopsis
#include <cyg/hal/hal_io.h>
void hal_bcm283x_board_model(
cyg_uint32 *model
)
;
void hal_bcm283x_board_revision(
cyg_uint32 *revision
)
;
void hal_bcm283x_board_serial(
cyg_uint64 *serial
)
;
void hal_bcm283x_mac_address(
cyg_uint8 *macaddr
)
;
void hal_bcm283x_arm_memory(
cyg_uint32 *base
cyg_uint32 *size
)
;
void hal_bcm283x_clock_rate(
cyg_uint32 clock
cyg_uint32 *rate
)
;
void hal_bcm283x_clock_rate_max(
cyg_uint32 clock
cyg_uint32 *rate
)
;
void hal_bcm283x_clock_rate_min(
cyg_uint32 clock
cyg_uint32 *rate
)
;
void hal_bcm283x_clock_rate_set(
cyg_uint32 clock
cyg_uint32 rate
)
;
void hal_bcm283x_dma_channels(
cyg_uint32 *channels
)
;
void hal_bcm283x_set_gpu_gpio(
cyg_uint32 pin
cyg_uint32 val
)
;
void hal_bcm283x_temperature(
cyg_uint32 id
cyg_uint32 *temperature
)
;
void hal_bcm283x_temperature_max(
cyg_uint32 id
cyg_uint32 *temperature
)
;
void hal_bcm283x_property_exchange(
cyg_uint32 channel
void *prop
int size
)
;
Description
The BCM283X GPU provides information about and control over various aspects of the system. A hardware mailbox mechanism is used to exchange messages with the GPU to query or control these aspects. The BCM283X HAL provides some functions to access this interface. The default functions are limited to just those exchanges that are of direct relevance to eCos, although there is scope for expanding these, or for performing a property exchange directly.
hal_bcm283x_board_model()
and
hal_bcm283x_board_revision()
fetch the
board model and revision numbers. The model number is usually
zero, but the revision number encodes the board properties as
described Raspberry
Pi Revision codes page. Normally the eCos HAL reads the
revision code at startup and decodes it into a set of variables.
hal_bcm283x_board_serial()
returns the
board's serial number; this is a 64 bit identifier unique to
this board. The function
hal_bcm283x_mac_address()
returns a MAC
address for this board; this consists of the lower 24 bits of
the serial number combined with a vendor ID assigned to the
Raspberry Pi Foundation.
hal_bcm283x_arm_memory()
returns the base
and size of the RAM available to the ARM processor. The base
will be zero and the size will indicate the top of memory after
the GPU memory specified in the config.txt
file has been allocated.
hal_bcm283x_clock_rate()
returns the
current rate of the given clock in Hz. Clock identifiers can be
found in bcm238x.h
.
hal_bcm283x_clock_rate_max()
and
hal_bcm283x_clock_rate_min()
return the
maximum and minimum rates for the
clock. hal_bcm283x_clock_rate_set()
sets
the given clock to the supplied rate.
hal_bcm283x_dma_channels()
returns a mask
of the available DMA channels.
hal_bcm283x_set_gpu_gpio()
sets the value
(0 or 1) of a GPIO pin controlled by the GPU through the
external GPIO extender. This is mainly used to control the ACT
LED on Pi3B and Pi3A boards.
hal_bcm283x_temperature()
reads the
temperature of the SoC in thousandths of a degree
C. hal_bcm283x_temperature_max()
returns
the maximum SoC temperature, above which overclocking will be
disabled. In both cases the id should be zero.
hal_bcm283x_property_exchange()
performs a
property exchange with the GPU and may be used to implement
requests that are not covered above. The protocol used is
described on the Raspberry
Pi Mailbox properties GitHub page. This function copies the array of
property tags pointed to by prop
into a
properly aligned buffer after the standard buffer header and
terminates it an end tag. It then sends a mailbox message to the
GPU and waits for a response. Finally, the updated property
buffer is copied back out to prop
. In SMP
systems a spinlock is used to control concurrent access from
different CPUs.
2024-03-18 | eCosPro Non-Commercial Public License |