public USBKeyboard()
 {
     queue = new Queue <byte>();
     endpointDescriptor = new EndpointUSBDescriptor[3];
     for (int i = 0; i < NumberOfEndpoints; i++)
     {
         endpointDescriptor[i] = new EndpointUSBDescriptor();
     }
     fillEndpointsDescriptors(endpointDescriptor);
     interfaceDescriptor[0].EndpointDescriptor   = endpointDescriptor;
     configurationDescriptor.InterfaceDescriptor = interfaceDescriptor;
 }
Example #2
0
 public USBMouse()
 {
     endpointDescriptor = new EndpointUSBDescriptor[3];
     for (int i = 0; i < NumberOfEndpoints; i++)
     {
         endpointDescriptor[i] = new EndpointUSBDescriptor();
     }
     fillEndpointsDescriptors(endpointDescriptor);
     interfaceDescriptor[0].EndpointDescriptor   = endpointDescriptor;
     configurationDescriptor.InterfaceDescriptor = interfaceDescriptor;
     x      = 0;
     y      = 0;
     mstate = 0;
     queue  = new Queue <sbyte>();
 }
 void Init()
 {
     endpointDescriptor = new EndpointUSBDescriptor[NumberOfEndpoints];
     for (int i = 0; i < NumberOfEndpoints; i++)
     {
         endpointDescriptor[i] = new EndpointUSBDescriptor();
     }
     FillEndpointsDescriptors(endpointDescriptor);
     interfaceDescriptor[0].EndpointDescriptor   = endpointDescriptor;
     configurationDescriptor.InterfaceDescriptor = interfaceDescriptor;
     inquiry.FillVendor("Generic ");
     inquiry.FillIdentification("STORAGE DEVICE  ");
     inquiry.FillRevision("0207");
     oData = new List <byte>();
 }
Example #4
0
        public void Reset()
        {
            x = y = 0;
            otherConfigurationDescriptor = new ConfigurationUSBDescriptor();
            deviceQualifierDescriptor    = new DeviceQualifierUSBDescriptor();
            endpointDescriptor           = new EndpointUSBDescriptor[3];
            for (int i = 0; i < NumberOfEndpoints; i++)
            {
                endpointDescriptor[i] = new EndpointUSBDescriptor();
            }
            fillEndpointsDescriptors(endpointDescriptor);
            interfaceDescriptor[0].EndpointDescriptor   = endpointDescriptor;
            configurationDescriptor.InterfaceDescriptor = interfaceDescriptor;

            mstate      = 0;
            changeState = false;
            buffer      = new byte[6];
        }
        public SMSC9500()
        {
            MAC = EmulationManager.Instance.CurrentEmulation.MACRepository.GenerateUniqueMAC();
            for (int i = 0; i < NumberOfEndpoints; i++)
            {
                dataToggleBit[i] = false;
            }
            endpointDescriptor = new EndpointUSBDescriptor[NumberOfEndpoints];
            for (int i = 0; i < NumberOfEndpoints; i++)
            {
                endpointDescriptor[i] = new EndpointUSBDescriptor();
            }
            fillEndpointsDescriptors(endpointDescriptor);
            interfaceDescriptor[0].EndpointDescriptor   = endpointDescriptor;
            configurationDescriptor.InterfaceDescriptor = interfaceDescriptor;

            rxPacketQueue = new Queue <EthernetFrame>();
        }
        public UsbHub(Machine machine)
        {
            this.machine       = machine;
            registeredDevices  = new Dictionary <byte, IUSBPeripheral>();
            endpointDescriptor = new EndpointUSBDescriptor[NumberOfEndpoints];
            NumberOfPorts      = 3;
            ports = new uint [NumberOfPorts];
            hubDescriptor.NbrPorts = NumberOfPorts;
            for (int i = 0; i < NumberOfEndpoints; i++)
            {
                endpointDescriptor[i] = new EndpointUSBDescriptor();
            }
            fillEndpointsDescriptors(endpointDescriptor);
            interfaceDescriptor[0].EndpointDescriptor   = endpointDescriptor;
            configurationDescriptor.InterfaceDescriptor = interfaceDescriptor;

            for (int i = 0; i < NumberOfPorts; i++)
            {
                ports[i] = (uint)PortStatus.PortPower;
            }
        }
        private void setEndpointsDescriptors()
        {
            endpointDescriptor = new EndpointUSBDescriptor[endpointsAmount];
            for (byte i = 0; i < endpointsAmount; i++)
            {
                endpointDescriptor[i] = new EndpointUSBDescriptor();
            }
            for (byte i = 0; i < endpointsAmount; i++)
            {
                endpointDescriptor[i].EndpointNumber      = i;
                endpointDescriptor[i].MaxPacketSize       = 512;
                endpointDescriptor[i].SynchronizationType = EndpointUSBDescriptor.SynchronizationTypeEnum.Asynchronous;
                endpointDescriptor[i].UsageType           = EndpointUSBDescriptor.UsageTypeEnum.Data;
            }
            endpointDescriptor[2].MaxPacketSize = 16;

            endpointDescriptor[0].InEnpoint = true;
            endpointDescriptor[1].InEnpoint = false;
            endpointDescriptor[2].InEnpoint = true;

            endpointDescriptor[0].TransferType = EndpointUSBDescriptor.TransferTypeEnum.Bulk;
            endpointDescriptor[1].TransferType = EndpointUSBDescriptor.TransferTypeEnum.Bulk;
            endpointDescriptor[2].TransferType = EndpointUSBDescriptor.TransferTypeEnum.Interrupt;
        }