Esempio n. 1
0
 internal Tsl2591Registers(IRegisterManagerAdapter adapter) : base(adapter, true)
 {
     enable = new EnableRegister(this);
     _registers.Add(enable);
     config = new ConfigRegister(this);
     _registers.Add(config);
     interruptLowThreshold = new InterruptLowThresholdRegister(this);
     _registers.Add(interruptLowThreshold);
     interruptHighThreshold = new InterruptHighThresholdRegister(this);
     _registers.Add(interruptHighThreshold);
     noPersistLowThreshold = new NoPersistLowThresholdRegister(this);
     _registers.Add(noPersistLowThreshold);
     noPersistHighThreshold = new NoPersistHighThresholdRegister(this);
     _registers.Add(noPersistHighThreshold);
     persist = new PersistRegister(this);
     _registers.Add(persist);
     packageId = new PackageIdRegister(this);
     _registers.Add(packageId);
     deviceId = new DeviceIdRegister(this);
     _registers.Add(deviceId);
     status = new StatusRegister(this);
     _registers.Add(status);
     ch0 = new Ch0Register(this);
     _registers.Add(ch0);
     ch1 = new Ch1Register(this);
     _registers.Add(ch1);
 }
Esempio n. 2
0
 internal Bmp280Registers(IRegisterManagerAdapter adapter) : base(adapter, true)
 {
     t1 = new T1Register(this);
     _registers.Add(t1);
     t2 = new T2Register(this);
     _registers.Add(t2);
     t3 = new T3Register(this);
     _registers.Add(t3);
     p1 = new P1Register(this);
     _registers.Add(p1);
     p2 = new P2Register(this);
     _registers.Add(p2);
     p3 = new P3Register(this);
     _registers.Add(p3);
     p4 = new P4Register(this);
     _registers.Add(p4);
     p5 = new P5Register(this);
     _registers.Add(p5);
     p6 = new P6Register(this);
     _registers.Add(p6);
     p7 = new P7Register(this);
     _registers.Add(p7);
     p8 = new P8Register(this);
     _registers.Add(p8);
     p9 = new P9Register(this);
     _registers.Add(p9);
     h1 = new H1Register(this);
     _registers.Add(h1);
     id = new IdRegister(this);
     _registers.Add(id);
     reset = new ResetRegister(this);
     _registers.Add(reset);
     h2 = new H2Register(this);
     _registers.Add(h2);
     h3 = new H3Register(this);
     _registers.Add(h3);
     h4 = new H4Register(this);
     _registers.Add(h4);
     h4h5 = new H4h5Register(this);
     _registers.Add(h4h5);
     h5 = new H5Register(this);
     _registers.Add(h5);
     h6 = new H6Register(this);
     _registers.Add(h6);
     ctrlHumidity = new CtrlHumidityRegister(this);
     _registers.Add(ctrlHumidity);
     status = new StatusRegister(this);
     _registers.Add(status);
     ctrlMeasure = new CtrlMeasureRegister(this);
     _registers.Add(ctrlMeasure);
     config = new ConfigRegister(this);
     _registers.Add(config);
     pressure = new PressureRegister(this);
     _registers.Add(pressure);
     temperature = new TemperatureRegister(this);
     _registers.Add(temperature);
     humidity = new HumidityRegister(this);
     _registers.Add(humidity);
 }
Esempio n. 3
0
 internal Ads1115Registers(IRegisterManagerAdapter adapter) : base(adapter, true)
 {
     conversion = new ConversionRegister(this);
     _registers.Add(conversion);
     config = new ConfigRegister(this);
     _registers.Add(config);
     lowThreshold = new LowThresholdRegister(this);
     _registers.Add(lowThreshold);
     highThreshold = new HighThresholdRegister(this);
     _registers.Add(highThreshold);
 }
            public SystemControlUnit(VR4300 cpu)
            {
                this.cpu   = cpu;
                Config     = new ConfigRegister(this);
                Status     = new StatusRegister(this);
                Cause      = new CauseRegister(this);
                operations = new Dictionary <Instruction, Action <Instruction> >
                {
                    [From(OpCode.MT)] = i =>
                    {
                        var destination = i.RD;
                        var data        = cpu.GPR[i.RT];

                        switch ((RegisterIndex)destination)
                        {
                        case RegisterIndex.Cause:
                            Registers[destination] &= ~CauseRegister.WriteMask;
                            Registers[destination] |= data & CauseRegister.WriteMask;
                            return;

                        case RegisterIndex.Compare:
                            var ip = Cause.IP;
                            ip.TimerInterrupt = false;
                            Cause.IP          = ip;
                            break;
                        }

                        Registers[destination] = data;
                    },
                    [From(OpCode.MF)]         = i => cpu.GPR[i.RT] = (ulong)(int)Registers[i.RD],
                    [From(FunctOpCode.TLBWI)] = i => { /* TODO. */ },
                    [From(FunctOpCode.ERET)]  = i =>
                    {
                        if (Status.ERL)
                        {
                            cpu.PC     = Registers[(int)RegisterIndex.ErrorEPC];
                            Status.ERL = false;
                        }
                        else
                        {
                            cpu.PC     = Registers[(int)RegisterIndex.EPC];
                            Status.EXL = false;
                        }

                        cpu.LLBit     = false;
                        cpu.DelaySlot = null;
                    }
                };
            }
Esempio n. 5
0
 /// <summary>
 /// Set configuration
 /// </summary>
 /// <param name="cr">config</param>
 public void SetConfigRegister(ConfigRegister cr)
 {
     Write(Register.IOCON, (byte)cr);
 }
Esempio n. 6
0
 public regs()
 {
     Config = new ConfigRegister();
 }