Example #1
0
        /// <summary>
        /// Sets up a USB transfer for sending via the EHCI.
        /// </summary>
        /// <param name="usbDevice">The USb device to send the transfer to.</param>
        /// <param name="transfer">The transfer to send.</param>
        /// <param name="type">The type of USB transfer.</param>
        /// <param name="endpoint">The endpoint of the device to send the transfer to.</param>
        /// <param name="maxLength">The maximum packet size to use when transferring.</param>
        public void SetupTransfer(Devices.USBDeviceInfo usbDevice, USBTransfer transfer, USBTransferType type, byte endpoint,
                                  ushort maxLength)
        {
            transfer.device   = usbDevice;
            transfer.endpoint = endpoint;
            transfer.type     = type;
#if HCI_TRACE
            BasicConsole.WriteLine(((FOS_System.String) "SetupTransfer: maxLength=") + maxLength + ", endpoint=" + endpoint + ", mps=" + ((Endpoint)usbDevice.Endpoints[endpoint]).mps);
#endif
            transfer.packetSize = FOS_System.Math.Min(maxLength, ((Endpoint)usbDevice.Endpoints[endpoint]).MPS);
#if HCI_TRACE
            BasicConsole.WriteLine(((FOS_System.String) "SetupTransfer: packetSize=") + transfer.packetSize);
#endif
            transfer.success      = false;
            transfer.transactions = new List(3);

            _SetupTransfer(transfer);
        }
Example #2
0
        /// <summary>
        /// Sets up a USB transfer for sending via the EHCI.
        /// </summary>
        /// <param name="usbDevice">The USb device to send the transfer to.</param>
        /// <param name="transfer">The transfer to send.</param>
        /// <param name="type">The type of USB transfer.</param>
        /// <param name="endpoint">The endpoint of the device to send the transfer to.</param>
        /// <param name="maxLength">The maximum packet size to use when transferring.</param>
        public void SetupTransfer(Devices.USBDeviceInfo usbDevice, USBTransfer transfer, USBTransferType type, byte endpoint, 
                                  ushort maxLength)
        {
            transfer.device = usbDevice;
            transfer.endpoint = endpoint;
            transfer.type = type;
#if HCI_TRACE
            BasicConsole.WriteLine(((FOS_System.String)"SetupTransfer: maxLength=") + maxLength + ", endpoint=" + endpoint + ", mps=" + ((Endpoint)usbDevice.Endpoints[endpoint]).mps);
#endif
            transfer.packetSize = FOS_System.Math.Min(maxLength, ((Endpoint)usbDevice.Endpoints[endpoint]).MPS);
#if HCI_TRACE
            BasicConsole.WriteLine(((FOS_System.String)"SetupTransfer: packetSize=") + transfer.packetSize);
#endif
            transfer.success = false;
            transfer.transactions = new List(3);

            _SetupTransfer(transfer);
        }