/// <summary> /// Initializes a new queue head with specified underlying memory structure. /// </summary> /// <param name="aQueueHead">The existing underlying queue head.</param> public EHCI_QueueHead(EHCI_QueueHead_Struct* aQueueHead) { queueHead = aQueueHead; }
/// <summary> /// Initialises a queue head - memory must already be allocated. /// </summary> /// <param name="headPtr">A pointer to the queue head structure to initialise.</param> /// <param name="horizPtr"> /// The virtual address of the next queue head in the list (or the first queue head since the /// async queue is a circular buffer). This is translated into the physical address internally. /// </param> /// <param name="firstQTD">A pointer to the first qTD of the queue head.</param> /// <param name="H">The Head of Reclamation list flag.</param> /// <param name="deviceAddr">The address of the USB device to which this queue head belongs.</param> /// <param name="endpoint">The endpoint number of the USB device to which this queue head belongs.</param> /// <param name="maxPacketSize">The maximum packet size to use when transferring.</param> protected void InitQH(EHCI_QueueHead_Struct* headPtr, EHCI_QueueHead_Struct* horizPtr, EHCI_qTD_Struct* firstQTD, bool H, byte deviceAddr, byte endpoint, ushort maxPacketSize) { EHCI_QueueHead head = new EHCI_QueueHead(headPtr); head.HorizontalLinkPointer = (EHCI_QueueHead_Struct*)VirtMemManager.GetPhysicalAddress(horizPtr); head.Type = 0x1; // Types: 00b iTD, 01b QH, 10b siTD, 11b FSTN head.Terminate = false; head.DeviceAddress = deviceAddr; // The device address head.InactiveOnNextTransaction = false; head.EndpointNumber = endpoint; // endpoint 0 contains Device infos such as name head.EndpointSpeed = 2; // 00b = full speed; 01b = low speed; 10b = high speed head.DataToggleControl = true; // get the Data Toggle bit out of the included qTD head.HeadOfReclamationList = H; // mark a queue head as being the head of the reclaim list head.MaximumPacketLength = maxPacketSize; // 64 byte for a control transfer to a high speed device head.ControlEndpointFlag = false; // only used if endpoint is a control endpoint and not high speed head.NakCountReload = 0; // this value is used by EHCI to reload the Nak Counter field. 0=ignores NAK counter. head.InterruptScheduleMask = 0; // not used for async schedule head.SplitCompletionMask = 0; // unused if (not low/full speed and in periodic schedule) head.HubAddr = 0; // unused if high speed (Split transfer) head.PortNumber = 0; // unused if high speed (Split transfer) head.HighBandwidthPipeMultiplier = 1; // 1-3 transaction per micro-frame, 0 means undefined results if (firstQTD == null) { head.NextqTDPointer = null; head.NextqTDPointerTerminate = true; } else { head.NextqTDPointer = (EHCI_qTD_Struct*)VirtMemManager.GetPhysicalAddress(firstQTD); head.NextqTDPointerTerminate = false; } }