bpmpfw: cleanup makefile and split hpp/cpp
This commit is contained in:
1 parent
e5240d835f
commit
3352dffc39
15 files changed
+464
-266
No files matched your search
@@ -33,20 +33,8 @@ constexpr u32 HaltMsec = (1u << 24);
|
||||
constexpr u32 HaltUsec = (1u << 25);
|
||||
constexpr u32 HaltMaxCnt = 0xFF;
|
||||
|
||||
[[maybe_unused]] inline void usleep(u32 us) {
|
||||
while (us) {
|
||||
const u32 delay = (us > HaltMaxCnt) ? HaltMaxCnt : us;
|
||||
us -= delay;
|
||||
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltUsec | delay;
|
||||
}
|
||||
}
|
||||
[[maybe_unused]] inline void msleep(u32 ms) {
|
||||
while (ms) {
|
||||
const u32 delay = (ms > HaltMaxCnt) ? HaltMaxCnt : ms;
|
||||
ms -= delay;
|
||||
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltMsec | delay;
|
||||
}
|
||||
}
|
||||
[[maybe_unused]] void usleep(u32 us);
|
||||
[[maybe_unused]] void msleep(u32 ms);
|
||||
|
||||
constexpr u32 TmrBase = 0x60005000;
|
||||
constexpr u32 TimerUsCntr1Us = 0x10;
|
||||
@@ -57,27 +45,10 @@ constexpr u32 UartLsr = 0x14;
|
||||
constexpr u32 UartLsrThre = (1u << 5);
|
||||
constexpr u32 UartLsrTmty = (1u << 6);
|
||||
|
||||
inline void UartPutc(char c) {
|
||||
while (!(MMIO32(UartBBase + UartLsr) & UartLsrThre))
|
||||
;
|
||||
MMIO32(UartBBase + UartThr) = static_cast<u32>(static_cast<u8>(c));
|
||||
}
|
||||
void UartPutc(char c);
|
||||
|
||||
// Waits for the byte to be fully transmitted
|
||||
inline void UartFlush() {
|
||||
while (!(MMIO32(UartBBase + UartLsr) & UartLsrTmty))
|
||||
;
|
||||
}
|
||||
void UartFlush();
|
||||
|
||||
inline void UartPuts(const char *s) {
|
||||
while (*s) {
|
||||
UartPutc(*s++);
|
||||
}
|
||||
}
|
||||
void UartPuts(const char *s);
|
||||
|
||||
inline void UartPutHex32(u32 v) {
|
||||
static const char digits[] = "0123456789ABCDEF";
|
||||
for (int i = 28; i >= 0; i -= 4) {
|
||||
UartPutc(digits[(v >> i) & 0xF]);
|
||||
}
|
||||
}
|
||||
void UartPutHex32(u32 v);
|
||||
Reference in new issue
Block a user