feat: Raspberry Pi 4/400 Bluetooth over mini UART (H4, Broadcom patchram, firmware mailbox BT_ON); move BT stack to Drivers/Bluetooth
This commit is contained in:
1 parent
808e1d66fd
commit
ffee9002a6
38 files changed
+2176
-141
No files matched your search
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* RpiFirmware.hpp
|
||||
* Raspberry Pi VideoCore firmware mailbox (property interface)
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
// The VideoCore firmware owns parts of the board the ARM cores cannot reach
|
||||
// directly: the GPIO expander that powers the Wi-Fi/Bluetooth radio, the
|
||||
// clock tree, the board's OTP (serial number, MAC address). The ARM side asks
|
||||
// for them through the property channel of the VideoCore mailbox, which
|
||||
// ACPI describes as BCM2849 (\_SB.GDV0.RPIQ) on the Pi Firmware Task Force
|
||||
// UEFI firmware.
|
||||
//
|
||||
// All calls are synchronous, take a process-context lock, and must not be
|
||||
// made from interrupt context. They return false when there is no mailbox
|
||||
// (any machine but a Pi) or the firmware rejects the request.
|
||||
|
||||
namespace Drivers::Platform::RpiFirmware {
|
||||
|
||||
// Find the mailbox through ACPI and allocate its message buffer.
|
||||
// Idempotent; the other calls initialize on first use.
|
||||
bool Initialize();
|
||||
|
||||
bool IsPresent();
|
||||
|
||||
// Clock identifiers (the firmware's numbering).
|
||||
constexpr uint32_t CLOCK_CORE = 4; // VPU core clock, feeds the mini UART
|
||||
|
||||
// Current rate of a firmware clock, in Hz.
|
||||
bool GetClockRate(uint32_t clockId, uint32_t& hz);
|
||||
|
||||
// The firmware's GPIO expander lines are numbered from 128.
|
||||
constexpr uint32_t EXPGPIO_BASE = 128;
|
||||
constexpr uint32_t EXPGPIO_BT_ON = EXPGPIO_BASE + 0; // Bluetooth power (high = on)
|
||||
constexpr uint32_t EXPGPIO_WL_ON = EXPGPIO_BASE + 1; // Wi-Fi power (high = on)
|
||||
|
||||
bool SetGpioState(uint32_t gpio, bool high);
|
||||
bool GetGpioState(uint32_t gpio, bool& high);
|
||||
|
||||
// The board's Ethernet MAC address from OTP, in transmission order
|
||||
// (mac[0] is the first octet of the OUI).
|
||||
bool GetBoardMacAddress(uint8_t mac[6]);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user