Ejemplo n.º 1
0
 public void Reset()
 {
     recordsCached = false;
     emptyRecord   = new GaislerAHBPlugAndPlayRecord();
     masterDevices = new List <GaislerAHBPlugAndPlayRecord>();
     slaveDevices  = new List <GaislerAHBPlugAndPlayRecord>();
 }
Ejemplo n.º 2
0
        private void cacheRecords()
        {
            //this.cacheMemory();
            var recordsFound = machine.SystemBus.Children.Where(x => x.Peripheral is IGaislerAHB);

            //.Cast<IRegistered<IGaislerAHB, IRegistrationPoint>>();
            foreach (var record in recordsFound)
            {
                var peripheral   = (IGaislerAHB)record.Peripheral;
                var registration = record.RegistrationPoint;

                var recordEntry = new GaislerAHBPlugAndPlayRecord();

                var deviceAddress = registration.Range.StartAddress;

                recordEntry.IdentificationRegister.Vendor = peripheral.GetVendorID();
                recordEntry.IdentificationRegister.Device = peripheral.GetDeviceID();
                recordEntry.BankAddressRegister[0].Type   = peripheral.GetSpaceType();
                //XXX: hack
                if (recordEntry.IdentificationRegister.Vendor == 0x01 && recordEntry.IdentificationRegister.Device == 0x006)
                {
                    deviceAddress -= PlugAndPlayRecordsOffset;
                }
                if (recordEntry.BankAddressRegister[0].Type == GaislerAHBPlugAndPlayRecord.SpaceType.AHBMemorySpace)
                {
                    recordEntry.BankAddressRegister[0].Address = (uint)((deviceAddress >> 20) & 0xfff);
                }
                else if (recordEntry.BankAddressRegister[0].Type == GaislerAHBPlugAndPlayRecord.SpaceType.AHBIOSpace)
                {
                    recordEntry.BankAddressRegister[0].Address = (uint)((deviceAddress >> 8) & 0xfff);
                }

                recordEntry.BankAddressRegister[0].Mask = 0xfff;

                if (peripheral.IsMaster())
                {
                    masterDevices.Add(recordEntry);
                }
                else
                {
                    slaveDevices.Add(recordEntry);
                }
            }
        }