mbv: clang-format

This commit is contained in:
2025-06-25 08:38:46 -07:00
parent 0c7206f186
commit 7f1f924331
13 changed files with 38 additions and 52 deletions

View File

@@ -1,7 +1,8 @@
#include "interrupts.h"
#include <cstdint>
#include "bios.h"
#include "interrupts.h"
namespace {
@@ -12,8 +13,7 @@ constexpr uint32_t kInterruptCauseMask = 0xff;
Isr external_handler = nullptr;
__attribute__((interrupt))
void TrapHandler() {
__attribute__((interrupt)) void TrapHandler() {
uint32_t mcause;
uint32_t mip;
asm volatile("csrr %0, mcause" : "=r"(mcause));
@@ -26,7 +26,7 @@ void TrapHandler() {
}
mip &= ~(kMieExternalInterruptMask);
asm volatile("csrw mip, %0" :: "r"(mip));
asm volatile("csrw mip, %0" ::"r"(mip));
} else {
BiosWozmon();
}
@@ -34,18 +34,16 @@ void TrapHandler() {
} // namespace
void SetExternalInterruptHandler(Isr handler) {
external_handler = handler;
}
void SetExternalInterruptHandler(Isr handler) { external_handler = handler; }
void EnableExternalInterrupts() {
uint32_t mie;
Isr trap = TrapHandler;
asm volatile("csrr %0, mie" : "=r"(mie));
asm volatile("csrw mtvec, %0" :: "r"(trap));
asm volatile("csrw mtvec, %0" ::"r"(trap));
mie |= kMieExternalInterruptMask;
asm volatile("csrw mie, %0" :: "r"(mie));
asm volatile("csrw mie, %0" ::"r"(mie));
}
bool EnableInterrupts(bool on) {
@@ -61,6 +59,6 @@ bool EnableInterrupts(bool on) {
mstatus &= ~kMstatusMieMask;
}
asm volatile("csrw mstatus, %0" :: "r"(mstatus));
asm volatile("csrw mstatus, %0" ::"r"(mstatus));
return was_on;
}