Exemple #1
0
        internal override void RegisterInternal(EmulatorComponent ec)
        {
            VerifyAccess();

            ComPort comPort = ec as ComPort;

            if (comPort == null)
            {
                throw new Exception("Attempt to register a non ComPort with ComPortCollection.");
            }

            ComPortHandle handle = comPort.ComPortHandle;

            Debug.Assert(!(comPort is ComPortNull));

            if (Exists(handle))
            {
                throw new Exception("Duplicate " + handle + " ComPorts found.");
            }

            _ports[handle] = comPort;
            _validPorts.Add(comPort);

            base.RegisterInternal(ec);
        }
Exemple #2
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     if (ec is ComPort)
     {
         return(((ComPort)ec).ComPortHandle == this.ComPortHandle);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     if (ec is SpiDevice)
     {
         return((((SpiDevice)ec).ChipSelectPin == this.ChipSelectPin) && this.HasValidChipSelectPin);
     }
     else
     {
         return(false);
     }
 }
Exemple #4
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     if (ec is GpioPort)
     {
         return(((GpioPort)ec).Pin == _pin);
     }
     else
     {
         return(false);
     }
 }
Exemple #5
0
        public override bool IsReplaceableBy(EmulatorComponent ec)
        {
            FileSystem fs = ec as FileSystem;

            if (fs != null)
            {
                return(fs.Namespace == _namespace);
            }

            return(false);
        }
Exemple #6
0
        internal override void UnregisterInternal(EmulatorComponent ec)
        {
            SpiDevice spiDevice = ec as SpiDevice;

            if (spiDevice != null)
            {
                _devices.Remove(spiDevice);
                _validDevices.Remove(spiDevice);

                base.UnregisterInternal(ec);
            }
        }
Exemple #7
0
        public override bool IsReplaceableBy(EmulatorComponent ec)
        {
            I2cDevice i2cDevice = ec as I2cDevice;

            if (i2cDevice != null)
            {
                return(i2cDevice.Address == this.Address);
            }
            else
            {
                return(false);
            }
        }
Exemple #8
0
        internal override void UnregisterInternal(EmulatorComponent ec)
        {
            GpioPort gpioPort = ec as GpioPort;

            if (gpioPort != null)
            {
                Debug.Assert(_ports[(int)gpioPort.Pin] == gpioPort);

                _ports[(int)gpioPort.Pin] = null;
                _validPorts.Remove(gpioPort);

                base.UnregisterInternal(ec);
            }
        }
Exemple #9
0
        internal override void UnregisterInternal(EmulatorComponent ec)
        {
            I2cDevice i2cDevice = ec as I2cDevice;

            if (i2cDevice != null)
            {
                Debug.Assert(_deviceLookup[i2cDevice.Address] == i2cDevice);

                _deviceLookup.Remove(i2cDevice.Address);
                _validDevices.Remove(i2cDevice);

                base.UnregisterInternal(ec);
            }
        }
Exemple #10
0
        internal override void UnregisterInternal(EmulatorComponent ec)
        {
            VerifyAccess();

            ComPort comPort = ec as ComPort;

            if (comPort != null)
            {
                if (_ports[comPort.ComPortHandle] == comPort)
                {
                    _ports.Remove(comPort.ComPortHandle);
                    _validPorts.Remove(comPort);

                    base.UnregisterInternal(ec);
                }
            }
        }
Exemple #11
0
        internal override void UnregisterInternal(EmulatorComponent ec)
        {
            // The list of File system cannot change after configuration is completed
            // or the volumeId will get mixed up
            ThrowIfNotSetup();

            FileSystem fs = ec as FileSystem;

            if (fs != null)
            {
                if (_fileSystems.Remove(fs) == false)
                {
                    Debug.Assert(false);
                    return;
                }

                base.UnregisterInternal(ec);
            }
        }
Exemple #12
0
        internal override void RegisterInternal(EmulatorComponent ec)
        {
            SpiDevice spiDevice = ec as SpiDevice;

            if ((spiDevice == null) || (spiDevice is SpiDeviceNull))
            {
                throw new Exception("Attempt to register a non SpiDevice with SpiBus.");
            }

            if (LookupSpiDeviceFromPin(spiDevice.ChipSelectPin) != null)
            {
                throw new Exception(string.Format("SPI device already set up on pin {0}", spiDevice.ChipSelectPin));
            }

            _devices.Add(spiDevice);
            _validDevices.Add(spiDevice);

            base.RegisterInternal(ec);
        }
Exemple #13
0
        internal override void RegisterInternal(EmulatorComponent ec)
        {
            I2cDevice i2cDevice = ec as I2cDevice;

            if ((i2cDevice == null) || (i2cDevice is I2cDeviceNull))
            {
                throw new Exception("Attempt to register a non I2cDevice with I2cBus.");
            }

            byte address = i2cDevice.Address;

            if (Exists(address))
            {
                throw new Exception("I2C device already set up at address " + address + ".");
            }

            _deviceLookup[address] = i2cDevice;
            _validDevices.Add(i2cDevice);

            base.RegisterInternal(ec);
        }
Exemple #14
0
        internal override void RegisterInternal(EmulatorComponent ec)
        {
            // The list of File system cannot change after configuration is completed
            // or the volumeId will get mixed up
            ThrowIfNotSetup();

            FileSystem fs = ec as FileSystem;

            if (fs == null)
            {
                throw new Exception("Attempt to register a non FileSystem with FileSystemCollection.");
            }

            if (Exists(fs.Namespace))
            {
                throw new Exception("An FileSystem with namespace " + fs.Namespace + " is already set.");
            }

            _fileSystems.Add(fs);

            base.RegisterInternal(ec);
        }
Exemple #15
0
        internal override void RegisterInternal(EmulatorComponent ec)
        {
            GpioPort port = ec as GpioPort;

            if (port == null)
            {
                throw new Exception("Attempt to register a non GpioPort with GpioPortCollection.");
            }

            Cpu.Pin pin = port.Pin;

            Debug.Assert(!(port is GpioPortNull));

            if (Exists(pin))
            {
                throw new Exception("GPIO port " + pin + " is already set.");
            }

            _ports[(int)pin] = port;
            _validPorts.Add(port);

            base.RegisterInternal(ec);
        }
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return (ec is NamedPipeServer);
 }
Exemple #17
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return(ec is RamManager);
 }
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return(ec is BatteryCell);
 }
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return(ec is NamedPipeServer);
 }
Exemple #20
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return(ec is TimingServices);
 }
Exemple #21
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return(ec is LcdDisplay);
 }
Exemple #22
0
 public override bool IsReplaceableBy(EmulatorComponent ec)
 {
     return(ec is SerialPortCollection);
 }