* 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
+40 -7
View File
@@ -516,7 +516,7 @@ OHCI::_FinishTransfer()
// Free all descriptors of this transfer // Free all descriptors of this transfer
next = (ohci_general_td *)current->next_done_descriptor; next = (ohci_general_td *)current->next_done_descriptor;
_FreeDescriptorChain(transfer->top); _FreeDescriptorChain(transfer->first_descriptor);
// Restart the endpoint // Restart the endpoint
// TODO: what if there are other transfer to this endpoint? // TODO: what if there are other transfer to this endpoint?
@@ -713,8 +713,8 @@ OHCI::_SubmitControlRequest(Transfer *transfer)
_WriteDescriptorChain(setupDescriptor, &vector, 1); _WriteDescriptorChain(setupDescriptor, &vector, 1);
status_t result; status_t result;
if (transfer->VectorCount() > 0) {
ohci_general_td *dataDescriptor = NULL; ohci_general_td *dataDescriptor = NULL;
if (transfer->VectorCount() > 0) {
ohci_general_td *lastDescriptor = NULL; ohci_general_td *lastDescriptor = NULL;
result = _CreateDescriptorChain(&dataDescriptor, result = _CreateDescriptorChain(&dataDescriptor,
&lastDescriptor, &lastDescriptor,
@@ -747,8 +747,8 @@ OHCI::_SubmitControlRequest(Transfer *transfer)
// 3. Tell the controller to process the control list // 3. Tell the controller to process the control list
_WriteReg(OHCI_COMMAND_STATUS, OHCI_CONTROL_LIST_FILLED); _WriteReg(OHCI_COMMAND_STATUS, OHCI_CONTROL_LIST_FILLED);
result = _AddPendingTransfer(transfer, setupDescriptor, statusDescriptor, result = _AddPendingTransfer(transfer, endpoint, setupDescriptor,
directionIn); dataDescriptor, directionIn);
if (result < B_OK) { if (result < B_OK) {
TRACE_ERROR(("usb_ohci: failed to add pending transfer\n")); TRACE_ERROR(("usb_ohci: failed to add pending transfer\n"));
_FreeDescriptorChain(setupDescriptor); _FreeDescriptorChain(setupDescriptor);
@@ -760,11 +760,44 @@ OHCI::_SubmitControlRequest(Transfer *transfer)
status_t status_t
OHCI::_AddPendingTransfer(Transfer *transfer, ohci_general_td *first, OHCI::_AddPendingTransfer(Transfer *transfer, ohci_endpoint_descriptor *endpoint,
ohci_general_td *last, bool direction) ohci_general_td *firstDescriptor, ohci_general_td *dataDescriptor, bool directionIn)
{ {
// TODO 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; 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 { typedef struct transfer_data_s {
Transfer *transfer; Transfer *transfer;
ohci_endpoint_descriptor *endpoint; ohci_endpoint_descriptor *endpoint;
ohci_general_td *top; ohci_general_td *first_descriptor;
ohci_general_td *data_descriptor;
bool incoming; bool incoming;
bool canceled; bool canceled;
transfer_data_s *link; transfer_data_s *link;
@@ -95,8 +96,9 @@ static int32 _InterruptHandler(void *data);
// Transfer functions // Transfer functions
status_t _AddPendingTransfer(Transfer *transfer, status_t _AddPendingTransfer(Transfer *transfer,
ohci_endpoint_descriptor *endpoint,
ohci_general_td *first, ohci_general_td *first,
ohci_general_td *last, ohci_general_td *data,
bool directionIn); bool directionIn);
status_t _UnlinkTransfer(transfer_data *transfer); status_t _UnlinkTransfer(transfer_data *transfer);