Files
ksOS/Kernel/Include/Arch/IO.h
T
2026-05-03 21:57:20 +04:00

18 lines
627 B
C

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 0xKSor
#pragma once
#include <Types.h>
static inline void IOAddressWrite32(Address address, UInt32 value) {
__asm__ volatile ("dsb sy" ::: "memory"); // wait till all previous writes are finished physically
*(volatile UInt32*)address = value;
__asm__ volatile ("dsb sy" ::: "memory"); // wait till my write is finished physically
}
static inline UInt32 IOAddressRead32(Address address) {
UInt32 value = *(volatile UInt32*)address;
__asm__ volatile ("dsb ld" ::: "memory"); // wait till my read is finished physically
return value;
}