* Removed the two extra submit functions and combined them directly into SubmitTransfer()
* The sparation based on async and periodic schedule made no sense as it is a question of queued/non-queued * Therefore removed the near complete code duplication for adding interrupt transfers (that are also queued) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22943 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ed1eff2fec
commit
7f07482988
@ -410,34 +410,18 @@ EHCI::SubmitTransfer(Transfer *transfer)
|
|||||||
if (transfer->TransferPipe()->DeviceAddress() == fRootHubAddress)
|
if (transfer->TransferPipe()->DeviceAddress() == fRootHubAddress)
|
||||||
return fRootHub->ProcessTransfer(this, transfer);
|
return fRootHub->ProcessTransfer(this, transfer);
|
||||||
|
|
||||||
uint32 type = transfer->TransferPipe()->Type();
|
Pipe *pipe = transfer->TransferPipe();
|
||||||
if ((type & USB_OBJECT_CONTROL_PIPE) > 0
|
if (pipe->Type() & USB_OBJECT_ISO_PIPE) {
|
||||||
|| (type & USB_OBJECT_BULK_PIPE) > 0) {
|
// ToDo: implement isochronous transfers...
|
||||||
TRACE(("usb_ehci: submitting async transfer\n"));
|
return B_ERROR;
|
||||||
return SubmitAsyncTransfer(transfer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type & USB_OBJECT_INTERRUPT_PIPE) > 0
|
|
||||||
|| (type & USB_OBJECT_ISO_PIPE) > 0) {
|
|
||||||
TRACE(("usb_ehci: submitting periodic transfer\n"));
|
|
||||||
return SubmitPeriodicTransfer(transfer);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE_ERROR(("usb_ehci: tried to submit transfer for unknown pipe type %lu\n", type));
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
EHCI::SubmitAsyncTransfer(Transfer *transfer)
|
|
||||||
{
|
|
||||||
ehci_qh *queueHead = CreateQueueHead();
|
ehci_qh *queueHead = CreateQueueHead();
|
||||||
if (!queueHead) {
|
if (!queueHead) {
|
||||||
TRACE_ERROR(("usb_ehci: failed to allocate async queue head\n"));
|
TRACE_ERROR(("usb_ehci: failed to allocate queue head\n"));
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipe *pipe = transfer->TransferPipe();
|
|
||||||
status_t result = InitQueueHead(queueHead, pipe);
|
status_t result = InitQueueHead(queueHead, pipe);
|
||||||
if (result < B_OK) {
|
if (result < B_OK) {
|
||||||
TRACE_ERROR(("usb_ehci: failed to init queue head\n"));
|
TRACE_ERROR(("usb_ehci: failed to init queue head\n"));
|
||||||
@ -447,12 +431,13 @@ EHCI::SubmitAsyncTransfer(Transfer *transfer)
|
|||||||
|
|
||||||
bool directionIn;
|
bool directionIn;
|
||||||
ehci_qtd *dataDescriptor;
|
ehci_qtd *dataDescriptor;
|
||||||
if (pipe->Type() & USB_OBJECT_CONTROL_PIPE)
|
if (pipe->Type() & USB_OBJECT_CONTROL_PIPE) {
|
||||||
result = FillQueueWithRequest(transfer, queueHead, &dataDescriptor,
|
result = FillQueueWithRequest(transfer, queueHead, &dataDescriptor,
|
||||||
&directionIn);
|
&directionIn);
|
||||||
else
|
} else {
|
||||||
result = FillQueueWithData(transfer, queueHead, &dataDescriptor,
|
result = FillQueueWithData(transfer, queueHead, &dataDescriptor,
|
||||||
&directionIn);
|
&directionIn);
|
||||||
|
}
|
||||||
|
|
||||||
if (result < B_OK) {
|
if (result < B_OK) {
|
||||||
TRACE_ERROR(("usb_ehci: failed to fill transfer queue with data\n"));
|
TRACE_ERROR(("usb_ehci: failed to fill transfer queue with data\n"));
|
||||||
@ -472,64 +457,14 @@ EHCI::SubmitAsyncTransfer(Transfer *transfer)
|
|||||||
print_queue(queueHead);
|
print_queue(queueHead);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result = LinkQueueHead(queueHead);
|
if (pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) {
|
||||||
if (result < B_OK) {
|
uint8 interval = ((InterruptPipe *)pipe)->Interval();
|
||||||
TRACE_ERROR(("usb_ehci: failed to link queue head to the async list\n"));
|
result = LinkInterruptQueueHead(queueHead, interval);
|
||||||
FreeQueueHead(queueHead);
|
} else
|
||||||
return result;
|
result = LinkQueueHead(queueHead);
|
||||||
}
|
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
EHCI::SubmitPeriodicTransfer(Transfer *transfer)
|
|
||||||
{
|
|
||||||
Pipe *pipe = transfer->TransferPipe();
|
|
||||||
if ((pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) == 0)
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
ehci_qh *queueHead = CreateQueueHead();
|
|
||||||
if (!queueHead) {
|
|
||||||
TRACE_ERROR(("usb_ehci: failed to allocate periodic queue head\n"));
|
|
||||||
return B_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t result = InitQueueHead(queueHead, pipe);
|
|
||||||
if (result < B_OK) {
|
|
||||||
TRACE_ERROR(("usb_ehci: failed to init queue head\n"));
|
|
||||||
FreeQueueHead(queueHead);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool directionIn;
|
|
||||||
ehci_qtd *dataDescriptor;
|
|
||||||
result = FillQueueWithData(transfer, queueHead, &dataDescriptor,
|
|
||||||
&directionIn);
|
|
||||||
|
|
||||||
if (result < B_OK) {
|
if (result < B_OK) {
|
||||||
TRACE_ERROR(("usb_ehci: failed to fill transfer queue with data\n"));
|
TRACE_ERROR(("usb_ehci: failed to link queue head\n"));
|
||||||
FreeQueueHead(queueHead);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = AddPendingTransfer(transfer, queueHead, dataDescriptor, directionIn);
|
|
||||||
if (result < B_OK) {
|
|
||||||
TRACE_ERROR(("usb_ehci: failed to add pending transfer\n"));
|
|
||||||
FreeQueueHead(queueHead);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TRACE_USB
|
|
||||||
TRACE(("usb_ehci: linking interrupt queue\n"));
|
|
||||||
print_queue(queueHead);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
result = LinkInterruptQueueHead(queueHead,
|
|
||||||
((InterruptPipe *)pipe)->Interval());
|
|
||||||
if (result < B_OK) {
|
|
||||||
TRACE_ERROR(("usb_ehci: failed to link queue head to the async list\n"));
|
|
||||||
FreeQueueHead(queueHead);
|
FreeQueueHead(queueHead);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,6 @@ public:
|
|||||||
|
|
||||||
status_t Start();
|
status_t Start();
|
||||||
virtual status_t SubmitTransfer(Transfer *transfer);
|
virtual status_t SubmitTransfer(Transfer *transfer);
|
||||||
status_t SubmitPeriodicTransfer(Transfer *transfer);
|
|
||||||
status_t SubmitAsyncTransfer(Transfer *transfer);
|
|
||||||
virtual status_t CancelQueuedTransfers(Pipe *pipe, bool force);
|
virtual status_t CancelQueuedTransfers(Pipe *pipe, bool force);
|
||||||
|
|
||||||
virtual status_t NotifyPipeChange(Pipe *pipe,
|
virtual status_t NotifyPipeChange(Pipe *pipe,
|
||||||
|
Loading…
Reference in New Issue
Block a user