mirror of
https://github.com/reactos/reactos.git
synced 2024-07-30 16:18:43 +00:00
[USBOHCI]
- More traces to fix isochronous problem - Fix broken assert found by mjmartin svn path=/branches/usb-bringup/; revision=52004
This commit is contained in:
parent
d2accc6c3e
commit
f73caa061d
|
@ -545,12 +545,15 @@ CUSBHardwareDevice::StartController(void)
|
||||||
//
|
//
|
||||||
ASSERT((Control & OHCI_HC_FUNCTIONAL_STATE_MASK) == OHCI_HC_FUNCTIONAL_STATE_OPERATIONAL);
|
ASSERT((Control & OHCI_HC_FUNCTIONAL_STATE_MASK) == OHCI_HC_FUNCTIONAL_STATE_OPERATIONAL);
|
||||||
ASSERT((Control & OHCI_ENABLE_LIST) == OHCI_ENABLE_LIST);
|
ASSERT((Control & OHCI_ENABLE_LIST) == OHCI_ENABLE_LIST);
|
||||||
|
DPRINT1("Control %x\n", Control);
|
||||||
|
|
||||||
//
|
//
|
||||||
// get frame interval
|
// get frame interval
|
||||||
//
|
//
|
||||||
FrameInterval = (READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_FRAME_INTERVAL_OFFSET)) & OHCI_FRAME_INTERVAL_TOGGLE) ^ OHCI_FRAME_INTERVAL_TOGGLE;
|
FrameInterval = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_FRAME_INTERVAL_OFFSET));
|
||||||
|
DPRINT1("FrameInterval %x IntervalValue %x\n", FrameInterval, m_IntervalValue);
|
||||||
FrameInterval |= OHCI_FSMPS(m_IntervalValue) | m_IntervalValue;
|
FrameInterval |= OHCI_FSMPS(m_IntervalValue) | m_IntervalValue;
|
||||||
|
DPRINT1("FrameInterval %x\n", FrameInterval);
|
||||||
|
|
||||||
//
|
//
|
||||||
// write frame interval
|
// write frame interval
|
||||||
|
@ -562,7 +565,7 @@ CUSBHardwareDevice::StartController(void)
|
||||||
//
|
//
|
||||||
Periodic = OHCI_PERIODIC(m_IntervalValue);
|
Periodic = OHCI_PERIODIC(m_IntervalValue);
|
||||||
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_PERIODIC_START_OFFSET), Periodic);
|
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_PERIODIC_START_OFFSET), Periodic);
|
||||||
|
DPRINT1("Periodic Start %x\n", Periodic);
|
||||||
|
|
||||||
//
|
//
|
||||||
// read descriptor
|
// read descriptor
|
||||||
|
@ -919,6 +922,8 @@ CUSBHardwareDevice::StopController(void)
|
||||||
//
|
//
|
||||||
m_IntervalValue = OHCI_GET_INTERVAL_VALUE(FrameInterval);
|
m_IntervalValue = OHCI_GET_INTERVAL_VALUE(FrameInterval);
|
||||||
|
|
||||||
|
DPRINT1("FrameInterval %x Interval %x\n", FrameInterval, m_IntervalValue);
|
||||||
|
|
||||||
//
|
//
|
||||||
// now reset controller
|
// now reset controller
|
||||||
//
|
//
|
||||||
|
@ -1206,10 +1211,30 @@ VOID
|
||||||
CUSBHardwareDevice::GetCurrentFrameNumber(
|
CUSBHardwareDevice::GetCurrentFrameNumber(
|
||||||
PULONG FrameNumber)
|
PULONG FrameNumber)
|
||||||
{
|
{
|
||||||
|
ULONG Control;
|
||||||
|
ULONG Number;
|
||||||
|
|
||||||
|
|
||||||
|
Number = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_FRAME_INTERVAL_NUMBER_OFFSET));
|
||||||
|
DPRINT1("FrameNumberInterval %x Frame %x\n", Number, m_HCCA->CurrentFrameNumber);
|
||||||
|
|
||||||
|
//
|
||||||
|
// remove reserved bits
|
||||||
|
//
|
||||||
|
Number &= 0xFFFF;
|
||||||
|
|
||||||
//
|
//
|
||||||
// store frame number
|
// store frame number
|
||||||
//
|
//
|
||||||
*FrameNumber = m_HCCA->CurrentFrameNumber;
|
*FrameNumber = Number;
|
||||||
|
|
||||||
|
//
|
||||||
|
// is the controller started
|
||||||
|
//
|
||||||
|
Control = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_CONTROL_OFFSET));
|
||||||
|
ASSERT((Control & OHCI_ENABLE_LIST) == OHCI_ENABLE_LIST);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -1339,7 +1364,7 @@ InterruptServiceRoutine(
|
||||||
//
|
//
|
||||||
// defer processing
|
// defer processing
|
||||||
//
|
//
|
||||||
DPRINT("Status %x Acknowledge %x\n", Status, Acknowledge);
|
DPRINT1("Status %x Acknowledge %x FrameNumber %x\n", Status, Acknowledge, This->m_HCCA->CurrentFrameNumber);
|
||||||
KeInsertQueueDpc(&This->m_IntDpcObject, (PVOID)Status, (PVOID)(DoneHead & ~1));
|
KeInsertQueueDpc(&This->m_IntDpcObject, (PVOID)Status, (PVOID)(DoneHead & ~1));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -98,6 +98,11 @@
|
||||||
#define OHCI_GET_FS_LARGEST_DATA_PACKET(s) (((s) >> 16) & 0x7fff)
|
#define OHCI_GET_FS_LARGEST_DATA_PACKET(s) (((s) >> 16) & 0x7fff)
|
||||||
#define OHCI_FRAME_INTERVAL_TOGGLE 0x80000000
|
#define OHCI_FRAME_INTERVAL_TOGGLE 0x80000000
|
||||||
|
|
||||||
|
//
|
||||||
|
// frame interval
|
||||||
|
//
|
||||||
|
#define OHCI_FRAME_INTERVAL_NUMBER_OFFSET 0x3C
|
||||||
|
|
||||||
//
|
//
|
||||||
// periodic start register
|
// periodic start register
|
||||||
//
|
//
|
||||||
|
|
|
@ -278,6 +278,16 @@ CUSBQueue::AddUSBRequest(
|
||||||
//
|
//
|
||||||
CurrentDescriptor = CurrentDescriptor->NextLogicalDescriptor;
|
CurrentDescriptor = CurrentDescriptor->NextLogicalDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// get current frame number
|
||||||
|
//
|
||||||
|
m_Hardware->GetCurrentFrameNumber(&FrameNumber);
|
||||||
|
|
||||||
|
DPRINT1("Hardware 1ms %p Iso %p\n",m_InterruptEndpoints[0], m_IsoHeadEndpointDescriptor);
|
||||||
|
ASSERT(m_InterruptEndpoints[0]->NextPhysicalEndpoint == m_IsoHeadEndpointDescriptor->PhysicalAddress.LowPart);
|
||||||
|
|
||||||
|
PrintEndpointList(m_IsoHeadEndpointDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -699,7 +709,7 @@ CUSBQueue::FindInterruptEndpointDescriptor(
|
||||||
//
|
//
|
||||||
// sanity check
|
// sanity check
|
||||||
//
|
//
|
||||||
ASSERT(InterruptInterval < OHCI_BIGGEST_INTERVAL);
|
ASSERT(InterruptInterval <= OHCI_BIGGEST_INTERVAL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// find interrupt index
|
// find interrupt index
|
||||||
|
|
|
@ -628,7 +628,7 @@ CUSBRequest::CreateIsochronousTransferDescriptor(
|
||||||
//
|
//
|
||||||
// initialize descriptor, hardware part
|
// initialize descriptor, hardware part
|
||||||
//
|
//
|
||||||
Descriptor->Flags = OHCI_ITD_SET_FRAME_COUNT(FrameCount) | OHCI_ITD_SET_DELAY_INTERRUPT(OHCI_TD_INTERRUPT_NONE) | OHCI_TD_SET_CONDITION_CODE(OHCI_TD_CONDITION_NOT_ACCESSED);
|
Descriptor->Flags = OHCI_ITD_SET_FRAME_COUNT(FrameCount) | OHCI_ITD_SET_DELAY_INTERRUPT(OHCI_TD_INTERRUPT_NONE);// | OHCI_TD_SET_CONDITION_CODE(OHCI_TD_CONDITION_NOT_ACCESSED);
|
||||||
Descriptor->BufferPhysical = 0;
|
Descriptor->BufferPhysical = 0;
|
||||||
Descriptor->NextPhysicalDescriptor = 0;
|
Descriptor->NextPhysicalDescriptor = 0;
|
||||||
Descriptor->LastPhysicalByteAddress = 0;
|
Descriptor->LastPhysicalByteAddress = 0;
|
||||||
|
@ -661,6 +661,7 @@ CUSBRequest::BuildIsochronousEndpoint(
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
PURB Urb;
|
PURB Urb;
|
||||||
|
PHYSICAL_ADDRESS Address;
|
||||||
|
|
||||||
//
|
//
|
||||||
// get current irp stack location
|
// get current irp stack location
|
||||||
|
@ -704,6 +705,10 @@ CUSBRequest::BuildIsochronousEndpoint(
|
||||||
//
|
//
|
||||||
ASSERT(ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(m_TransferBufferMDL), MmGetMdlByteCount(m_TransferBufferMDL)) <= 2);
|
ASSERT(ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(m_TransferBufferMDL), MmGetMdlByteCount(m_TransferBufferMDL)) <= 2);
|
||||||
|
|
||||||
|
Status = m_DmaManager->Allocate(m_TransferBufferLength, &Buffer, &Address);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
|
||||||
while(Index < Urb->UrbIsochronousTransfer.NumberOfPackets)
|
while(Index < Urb->UrbIsochronousTransfer.NumberOfPackets)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -732,7 +737,7 @@ CUSBRequest::BuildIsochronousEndpoint(
|
||||||
//
|
//
|
||||||
// get page offset
|
// get page offset
|
||||||
//
|
//
|
||||||
PageOffset = MmGetMdlByteOffset(m_TransferBufferMDL);
|
PageOffset = BYTE_OFFSET(Page);
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize descriptor
|
// initialize descriptor
|
||||||
|
@ -936,6 +941,8 @@ CUSBRequest::AllocateEndpointDescriptor(
|
||||||
Descriptor->Flags |= OHCI_ENDPOINT_SET_ENDPOINT_NUMBER(GetEndpointAddress());
|
Descriptor->Flags |= OHCI_ENDPOINT_SET_ENDPOINT_NUMBER(GetEndpointAddress());
|
||||||
Descriptor->Flags |= OHCI_ENDPOINT_SET_MAX_PACKET_SIZE(GetMaxPacketSize());
|
Descriptor->Flags |= OHCI_ENDPOINT_SET_MAX_PACKET_SIZE(GetMaxPacketSize());
|
||||||
|
|
||||||
|
DPRINT1("Flags %x DeviceAddress %x EndpointAddress %x PacketSize %x\n", Descriptor->Flags, GetDeviceAddress(), GetEndpointAddress(), GetMaxPacketSize());
|
||||||
|
|
||||||
//
|
//
|
||||||
// is there an endpoint descriptor
|
// is there an endpoint descriptor
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue