Esempio n. 1
0
 public USBKeyboard(Machine machine)
 {
     this.machine       = machine;
     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;
 }
Esempio n. 2
0
 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>();
 }
Esempio n. 3
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];
        }
Esempio n. 4
0
        public SMSC9500(Machine machine)
        {
            this.machine = machine;
            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>();
        }
Esempio n. 5
0
        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;
        }