2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2020 Andrew Turner
6 * This work was supported by Innovate UK project 105694, "Digital Security
7 * by Design (DSbD) Technology Platform Prototype".
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #ifndef _BCM2835_FIRMWARE_H_
34 #define _BCM2835_FIRMWARE_H_
36 #define BCM2835_FIRMWARE_TAG_GET_CLOCK_RATE 0x00030002
37 #define BCM2835_FIRMWARE_TAG_SET_CLOCK_RATE 0x00038002
38 #define BCM2835_FIRMWARE_TAG_GET_MAX_CLOCK_RATE 0x00030004
39 #define BCM2835_FIRMWARE_TAG_GET_MIN_CLOCK_RATE 0x00030007
41 #define BCM2835_FIRMWARE_CLOCK_ID_EMMC 0x00000001
42 #define BCM2835_FIRMWARE_CLOCK_ID_UART 0x00000002
43 #define BCM2835_FIRMWARE_CLOCK_ID_ARM 0x00000003
44 #define BCM2835_FIRMWARE_CLOCK_ID_CORE 0x00000004
45 #define BCM2835_FIRMWARE_CLOCK_ID_V3D 0x00000005
46 #define BCM2835_FIRMWARE_CLOCK_ID_H264 0x00000006
47 #define BCM2835_FIRMWARE_CLOCK_ID_ISP 0x00000007
48 #define BCM2835_FIRMWARE_CLOCK_ID_SDRAM 0x00000008
49 #define BCM2835_FIRMWARE_CLOCK_ID_PIXEL 0x00000009
50 #define BCM2835_FIRMWARE_CLOCK_ID_PWM 0x0000000a
51 #define BCM2838_FIRMWARE_CLOCK_ID_EMMC2 0x0000000c
53 union msg_get_clock_rate_body {
63 union msg_set_clock_rate_body {
74 #define BCM2835_FIRMWARE_TAG_GET_VOLTAGE 0x00030003
75 #define BCM2835_FIRMWARE_TAG_SET_VOLTAGE 0x00038003
76 #define BCM2835_FIRMWARE_TAG_GET_MAX_VOLTAGE 0x00030005
77 #define BCM2835_FIRMWARE_TAG_GET_MIN_VOLTAGE 0x00030008
79 #define BCM2835_FIRMWARE_VOLTAGE_ID_CORE 0x00000001
80 #define BCM2835_FIRMWARE_VOLTAGE_ID_SDRAM_C 0x00000002
81 #define BCM2835_FIRMWARE_VOLTAGE_ID_SDRAM_P 0x00000003
82 #define BCM2835_FIRMWARE_VOLTAGE_ID_SDRAM_I 0x00000004
84 union msg_get_voltage_body {
94 union msg_set_voltage_body {
105 #define BCM2835_FIRMWARE_TAG_GET_TEMPERATURE 0x00030006
106 #define BCM2835_FIRMWARE_TAG_GET_MAX_TEMPERATURE 0x0003000a
108 union msg_get_temperature_body {
110 uint32_t temperature_id;
113 uint32_t temperature_id;
118 #define BCM2835_FIRMWARE_TAG_GET_TURBO 0x00030009
119 #define BCM2835_FIRMWARE_TAG_SET_TURBO 0x00038009
121 #define BCM2835_FIRMWARE_TURBO_ON 1
122 #define BCM2835_FIRMWARE_TURBO_OFF 0
124 union msg_get_turbo_body {
134 union msg_set_turbo_body {
145 #define BCM2835_FIRMWARE_TAG_GET_GPIO_STATE 0x00030041
146 #define BCM2835_FIRMWARE_TAG_SET_GPIO_STATE 0x00038041
147 #define BCM2835_FIRMWARE_TAG_GET_GPIO_CONFIG 0x00030043
148 #define BCM2835_FIRMWARE_TAG_SET_GPIO_CONFIG 0x00038043
150 #define BCM2835_FIRMWARE_GPIO_IN 0
151 #define BCM2835_FIRMWARE_GPIO_OUT 1
153 union msg_get_gpio_state {
163 union msg_set_gpio_state {
173 union msg_get_gpio_config {
182 uint32_t term_pull_up;
186 union msg_set_gpio_config {
192 uint32_t term_pull_up;
200 int bcm2835_firmware_property(device_t, uint32_t, void *, size_t);