fix: improve Bluetooth reliability
This commit is contained in:
1 parent
4627ac92fd
commit
18122136dd
20 files changed
+1870
-587
No files matched your search
@@ -988,6 +988,38 @@ namespace Drivers::USB::Xhci {
|
||||
SendCommand(deqTrb);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ResetBulkOutEndpoint - clear a halted bulk OUT endpoint
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
void ResetBulkOutEndpoint(uint8_t slotId) {
|
||||
if (slotId == 0 || slotId > MAX_SLOTS || !g_devices[slotId].Active) return;
|
||||
UsbDeviceInfo& dev = g_devices[slotId];
|
||||
if (dev.BulkOutEpNum == 0 || !dev.BulkOutRing) return;
|
||||
|
||||
uint8_t dci = dev.BulkOutEpNum * 2;
|
||||
|
||||
TRB resetTrb = {};
|
||||
resetTrb.Control = (TRB_RESET_ENDPOINT << TRB_TYPE_SHIFT)
|
||||
| ((uint32_t)slotId << 24)
|
||||
| ((uint32_t)dci << 16);
|
||||
SendCommand(resetTrb);
|
||||
|
||||
// Skip the errored TRB and everything queued behind it. The class
|
||||
// driver releases the corresponding DMA slots before it sends again.
|
||||
uint64_t newDeq = dev.BulkOutRingPhys
|
||||
+ (uint64_t)dev.BulkOutRingEnqueue * sizeof(TRB);
|
||||
if (dev.BulkOutRingCCS) newDeq |= 1; // DCS bit
|
||||
|
||||
TRB deqTrb = {};
|
||||
deqTrb.Parameter0 = (uint32_t)(newDeq & 0xFFFFFFFF);
|
||||
deqTrb.Parameter1 = (uint32_t)(newDeq >> 32);
|
||||
deqTrb.Control = (TRB_SET_TR_DEQUEUE << TRB_TYPE_SHIFT)
|
||||
| ((uint32_t)slotId << 24)
|
||||
| ((uint32_t)dci << 16);
|
||||
SendCommand(deqTrb);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// QueueBulkInTransfer
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user