mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
As a demo, query the firmware version. `Meta/serenity.sh gdb aarch64` can be used to observe that qemu puts 0x548E1 in x0 in response to this mailbox message.
31 lines
771 B
C++
31 lines
771 B
C++
/*
|
|
* Copyright (c) 2021, Nico Weber <thakis@chromium.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Types.h>
|
|
|
|
namespace Prekernel {
|
|
|
|
// Knows about memory-mapped IO addresses on the Broadcom family of SOCs used in Raspberry Pis.
|
|
// RPi3 is the first Raspberry Pi that supports aarch64.
|
|
// https://datasheets.raspberrypi.org/bcm2836/bcm2836-peripherals.pdf (RPi3)
|
|
// https://datasheets.raspberrypi.org/bcm2711/bcm2711-peripherals.pdf (RPi4 Model B)
|
|
class MMIO {
|
|
public:
|
|
static MMIO& the();
|
|
|
|
u32 read(FlatPtr offset) { return *(u32 volatile*)(m_base_address + offset); }
|
|
void write(FlatPtr offset, u32 value) { *(u32 volatile*)(m_base_address + offset) = value; }
|
|
|
|
private:
|
|
MMIO();
|
|
|
|
unsigned int m_base_address;
|
|
};
|
|
|
|
}
|