* Implemented _AddPendingTransfer

* renamed trasfer_data memeber top to first_descriptor
* added data_descriptor member to transfer_data (useful for control transfer)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23702 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Salvatore Benedetto
2008-01-22 17:26:36 +00:00
parent 27d7771a1e
commit f2e973d406
2 changed files with 45 additions and 10 deletions
+41 -8
View File
@@ -516,7 +516,7 @@ OHCI::_FinishTransfer()
// Free all descriptors of this transfer
next = (ohci_general_td *)current->next_done_descriptor;
_FreeDescriptorChain(transfer->top);
_FreeDescriptorChain(transfer->first_descriptor);
// Restart the endpoint
// TODO: what if there are other transfer to this endpoint?
@@ -713,8 +713,8 @@ OHCI::_SubmitControlRequest(Transfer *transfer)
_WriteDescriptorChain(setupDescriptor, &vector, 1);
status_t result;
ohci_general_td *dataDescriptor = NULL;
if (transfer->VectorCount() > 0) {
ohci_general_td *dataDescriptor = NULL;
ohci_general_td *lastDescriptor = NULL;
result = _CreateDescriptorChain(&dataDescriptor,
&lastDescriptor,
@@ -747,8 +747,8 @@ OHCI::_SubmitControlRequest(Transfer *transfer)
// 3. Tell the controller to process the control list
_WriteReg(OHCI_COMMAND_STATUS, OHCI_CONTROL_LIST_FILLED);
result = _AddPendingTransfer(transfer, setupDescriptor, statusDescriptor,
directionIn);
result = _AddPendingTransfer(transfer, endpoint, setupDescriptor,
dataDescriptor, directionIn);
if (result < B_OK) {
TRACE_ERROR(("usb_ohci: failed to add pending transfer\n"));
_FreeDescriptorChain(setupDescriptor);
@@ -760,11 +760,44 @@ OHCI::_SubmitControlRequest(Transfer *transfer)
status_t
OHCI::_AddPendingTransfer(Transfer *transfer, ohci_general_td *first,
ohci_general_td *last, bool direction)
OHCI::_AddPendingTransfer(Transfer *transfer, ohci_endpoint_descriptor *endpoint,
ohci_general_td *firstDescriptor, ohci_general_td *dataDescriptor, bool directionIn)
{
// TODO
return B_ERROR;
if (!transfer || !endpoint || !firstDescriptor)
return B_BAD_VALUE;
transfer_data *data = new(std::nothrow) transfer_data;
if (!data)
return B_NO_MEMORY;
status_t result = transfer->InitKernelAccess();
if (result < B_OK) {
delete data;
return result;
}
data->transfer = transfer;
data->endpoint = endpoint;
data->first_descriptor = firstDescriptor;
data->data_descriptor = dataDescriptor;
data->incoming = directionIn;
data->canceled = false;
data->link = NULL;
if (!Lock()) {
delete data;
return B_ERROR;
}
if (fLastTransfer)
fLastTransfer->link = data;
else
fFirstTransfer = data;
fLastTransfer = data;
Unlock();
return B_OK;
}
+4 -2
View File
@@ -21,7 +21,8 @@ class OHCIRootHub;
typedef struct transfer_data_s {
Transfer *transfer;
ohci_endpoint_descriptor *endpoint;
ohci_general_td *top;
ohci_general_td *first_descriptor;
ohci_general_td *data_descriptor;
bool incoming;
bool canceled;
transfer_data_s *link;
@@ -95,8 +96,9 @@ static int32 _InterruptHandler(void *data);
// Transfer functions
status_t _AddPendingTransfer(Transfer *transfer,
ohci_endpoint_descriptor *endpoint,
ohci_general_td *first,
ohci_general_td *last,
ohci_general_td *data,
bool directionIn);
status_t _UnlinkTransfer(transfer_data *transfer);