feat: further kernel power and power optimizations

This commit is contained in:
2026-04-21 20:51:12 +02:00
parent 7d6f001659
commit 38b1f8a7ef
31 changed files with 895 additions and 52 deletions
+13
View File
@@ -377,4 +377,17 @@ namespace Drivers::USB::HidKeyboard {
}
}
uint64_t GetNextTickDeadline() {
if (g_RepeatKey == 0) {
return 0;
}
uint64_t firstRepeat = g_RepeatStartMs + TYPEMATIC_DELAY_MS;
if (g_LastRepeatMs == 0 || g_LastRepeatMs < firstRepeat) {
return firstRepeat;
}
return g_LastRepeatMs + TYPEMATIC_PERIOD_MS;
}
}
+4
View File
@@ -18,4 +18,8 @@ namespace Drivers::USB::HidKeyboard {
// Timer tick for typematic repeat (call from periodic timer, e.g. 1ms)
void Tick();
// Earliest millisecond deadline when typematic repeat needs service again.
// Returns 0 when no repeat is pending.
uint64_t GetNextTickDeadline();
};
+2 -2
View File
@@ -959,7 +959,7 @@ namespace Drivers::USB::Xhci {
// Enable interrupter 0
WriteRt(IR0_IMAN, IMAN_IE);
WriteRt(IR0_IMOD, 0);
WriteRt(IR0_IMOD, IMOD_INTERVAL_100US);
// Start controller
WriteOp(OP_USBCMD, USBCMD_RS | USBCMD_INTE | USBCMD_HSEE);
@@ -1269,7 +1269,7 @@ namespace Drivers::USB::Xhci {
// Step 13: Enable interrupter 0
// -----------------------------------------------------------------
WriteRt(IR0_IMAN, IMAN_IE);
WriteRt(IR0_IMOD, 0); // No moderation
WriteRt(IR0_IMOD, IMOD_INTERVAL_100US);
// -----------------------------------------------------------------
// Step 14: Start controller
+1
View File
@@ -110,6 +110,7 @@ namespace Drivers::USB::Xhci {
// IMAN bits
constexpr uint32_t IMAN_IP = (1 << 0); // Interrupt Pending
constexpr uint32_t IMAN_IE = (1 << 1); // Interrupt Enable
constexpr uint32_t IMOD_INTERVAL_100US = 400; // 100 us in 250 ns units
// ---------------------------------------------------------------------------
// TRB (Transfer Request Block) - 16 bytes