USB: Initialize packet descriptors inside the stack.

Allows deletion of generic code from bus drivers.
This commit is contained in:
Augustin Cavalier 2024-01-30 00:39:47 -05:00
parent 02f5db9104
commit 8c458fc42b
4 changed files with 5 additions and 21 deletions

View File

@ -302,6 +302,11 @@ IsochronousPipe::QueueIsochronous(void *data, size_t dataLength,
isochronousData->starting_frame_number = startingFrameNumber;
isochronousData->flags = flags;
for (uint32 i = 0; i < isochronousData->packet_count; i++) {
isochronousData->packet_descriptors[i].actual_length = 0;
isochronousData->packet_descriptors[i].status = B_NO_INIT;
}
Transfer *transfer = new(std::nothrow) Transfer(this);
if (!transfer) {
delete isochronousData;

View File

@ -1632,12 +1632,6 @@ OHCI::_SubmitIsochronousTransfer(Transfer *transfer)
if (pipe->Direction() == Pipe::Out)
_WriteIsochronousDescriptorChain(firstDescriptor,
transfer->Vector(), transfer->VectorCount(), transfer->IsPhysical());
else
// Initialize the packet descriptors
for (uint32 i = 0; i < isochronousData->packet_count; i++) {
isochronousData->packet_descriptors[i].actual_length = 0;
isochronousData->packet_descriptors[i].status = B_NO_INIT;
}
// Add to the transfer list
ohci_endpoint_descriptor *endpoint

View File

@ -1314,12 +1314,6 @@ UHCI::SubmitIsochronous(Transfer *transfer)
generic_io_vec *vector = transfer->Vector();
WriteIsochronousDescriptorChain(isoRequest,
isochronousData->packet_count, vector);
} else {
// Initialize the packet descriptors
for (uint32 i = 0; i < isochronousData->packet_count; i++) {
isochronousData->packet_descriptors[i].actual_length = 0;
isochronousData->packet_descriptors[i].status = B_NO_INIT;
}
}
TRACE("isochronous submitted size=%ld bytes, TDs=%" B_PRId32 ", "

View File

@ -1015,15 +1015,6 @@ XHCI::SubmitNormalRequest(Transfer *transfer)
}
if (isochronousData->starting_frame_number != NULL)
*isochronousData->starting_frame_number = frame;
// TODO: The OHCI bus driver seems to also do this for inbound
// isochronous transfers. Perhaps it should be moved into the stack?
if (directionIn) {
for (uint32 i = 0; i < isochronousData->packet_count; i++) {
isochronousData->packet_descriptors[i].actual_length = 0;
isochronousData->packet_descriptors[i].status = B_NO_INIT;
}
}
}
// Set the ENT (Evaluate Next TRB) bit, so that the HC will not switch