本文整理汇总了C++中Pipe::DataToggle方法的典型用法代码示例。如果您正苦于以下问题:C++ Pipe::DataToggle方法的具体用法?C++ Pipe::DataToggle怎么用?C++ Pipe::DataToggle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipe
的用法示例。
在下文中一共展示了Pipe::DataToggle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: endpointLocker
status_t
OHCI::_SubmitTransfer(Transfer *transfer)
{
Pipe *pipe = transfer->TransferPipe();
bool directionIn = (pipe->Direction() == Pipe::In);
ohci_general_td *firstDescriptor = NULL;
ohci_general_td *lastDescriptor = NULL;
status_t result = _CreateDescriptorChain(&firstDescriptor, &lastDescriptor,
directionIn ? OHCI_TD_DIRECTION_PID_IN : OHCI_TD_DIRECTION_PID_OUT,
transfer->VectorLength());
if (result < B_OK)
return result;
// Apply data toggle to the first descriptor (the others will use the carry)
firstDescriptor->flags &= ~OHCI_TD_TOGGLE_CARRY;
firstDescriptor->flags |= pipe->DataToggle() ? OHCI_TD_TOGGLE_1
: OHCI_TD_TOGGLE_0;
// Set the last descriptor to generate an interrupt
lastDescriptor->flags &= ~OHCI_TD_INTERRUPT_MASK;
lastDescriptor->flags |=
OHCI_TD_SET_DELAY_INTERRUPT(OHCI_TD_INTERRUPT_IMMEDIATE);
if (!directionIn) {
_WriteDescriptorChain(firstDescriptor, transfer->Vector(),
transfer->VectorCount());
}
// Add to the transfer list
ohci_endpoint_descriptor *endpoint
= (ohci_endpoint_descriptor *)pipe->ControllerCookie();
MutexLocker endpointLocker(endpoint->lock);
result = _AddPendingTransfer(transfer, endpoint, firstDescriptor,
firstDescriptor, lastDescriptor, directionIn);
if (result < B_OK) {
TRACE_ERROR("failed to add pending transfer\n");
_FreeDescriptorChain(firstDescriptor);
return result;
}
// Add the descriptor chain to the endpoint
_SwitchEndpointTail(endpoint, firstDescriptor, lastDescriptor);
endpointLocker.Unlock();
endpoint->flags &= ~OHCI_ENDPOINT_SKIP;
if (pipe->Type() & USB_OBJECT_BULK_PIPE) {
// Tell the controller to process the bulk list
_WriteReg(OHCI_COMMAND_STATUS, OHCI_BULK_LIST_FILLED);
}
return B_OK;
}