예제 #1
0
 public Breakpoint(int offset, Type bptype, bool rtype = false)
 {
     Offset   = offset;
     BpType   = bptype;
     RType    = rtype ? RamType.VRAM : RamType.RAM;
     IsBP     = true;
     BpString = $"{offset:X4}:{BpType}:{RType}";
 }
예제 #2
0
        /// <summary>
        /// Create switcher that switches from <paramref name="type"/> to opposite.
        /// </summary>
        /// <param name="type">Source type</param>
        /// <returns>Switcher</returns>
        public static IRamTypeSwitcher CreateForSource(RamType type)
        {
            if (type is DoubleDataRate3)
            {
                return(ToDoubleDataRate3LowPowerSwitcher.Instance);
            }
            else if (type is DoubleDataRate3LowPower)
            {
                return(ToDoubleDataRate3Switcher.Instance);
            }

            throw new UnsupportedRamTypeException(type.Name);
        }
예제 #3
0
        private void connectToDevice(object sender, EventArgs e)
        {
            ToolStripMenuItem _sender = (ToolStripMenuItem)sender;

            string _port    = _sender.Text.Split(':')[0];
            int    _address = Int32.Parse(_sender.Text.Split(':')[1]);

            // Disconnect
            if (MySpdReader != null && MySpdReader.IsConnected)
            {
                if (MySpdReader.Disconnect())
                {
                    Logger($"{MySpdReader.PortName}:{MySpdReader.EepromAddress} disconnected");
                }

                if (!MySpdReader.IsConnected)
                {
                    // Uncheck all devices
                    ToolStripItem[] _existingDeviceItem = toolStripDeviceButton.DropDownItems.Find("FoundDevicePortAddress", false);

                    if (_existingDeviceItem.Length > 0)
                    {
                        foreach (ToolStripMenuItem toolStripItem in _existingDeviceItem)
                        {
                            toolStripItem.Checked = false;
                        }
                    }
                    //_sender.Checked = false;
                }

                // Do not reconnect if checked item was clicked
                if (MySpdReader.PortName == _port && MySpdReader.EepromAddress == _address)
                {
                    return;
                }
            }

            // Connect
            if (MySpdReader == null || !MySpdReader.IsConnected)
            {
                MySpdReader         = new Device(_port, _address);
                MySpdReader.SpdSize = Eeprom.GetSpdSize(MySpdReader);
                if (MySpdReader.Connect())
                {
                    _sender.Checked = true;
                    rt = Eeprom.GetRamType(MySpdReader);
                    Logger($"{_port}:{_address} connected ({rt})");
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Конструктор формы выбора оперативной памяти
        /// </summary>
        /// <param name="currentRamType">Текущий тип памяти</param>
        public SelectRAMForm(RamType currentRamType)
        {
            _currentRamType = currentRamType;
            InitializeComponent();
            SubscribeMenuItems();
            btn_OK.Image     = new Bitmap(Resources.camera_test, new Size(20, 20));
            btn_Cancel.Image = new Bitmap(Resources.no, new Size(20, 20));

            созданиеToolStripMenuItem1.Click       += созданиеToolStripMenuItem_Click;
            редактированиеToolStripMenuItem1.Click += редактированиеToolStripMenuItem_Click;
            удалениеToolStripMenuItem1.Click       += удалениеToolStripMenuItem_Click;

            _ctx = new Context();
            InitBindings();
        }
예제 #5
0
        /// <summary>
        /// Gets total EEPROM size
        /// </summary>
        /// <param name="ramType">Ram Type</param>
        /// <returns>SPD size</returns>
        public static SpdSize GetSpdSize(RamType ramType)
        {
            switch (ramType)
            {
            case RamType.SDRAM:                      //return SpdSize.SDRAM;
            case RamType.DDR:                        //return SpdSize.DDR;
            case RamType.DDR2:                       //return SpdSize.DDR2;
            case RamType.DDR2_FB_DIMM:               //return SpdSize.DDR2;
            case RamType.DDR3:
                return(SpdSize.DDR3);

            case RamType.DDR4:
                return(SpdSize.DDR4);

            default:
                return(0);
            }
        }
예제 #6
0
 public Ram(RamType ramType, int size)
 {
     RamType = ramType;
     Size    = size;
 }
예제 #7
0
        /// <summary>
        /// Parse type and compare with expected
        /// </summary>
        /// <param name="binary">Test binary</param>
        /// <param name="expectedType">Expected type</param>
        private void AssertFromBinary(byte[] binary, string expectedType)
        {
            var type = RamType.FromBinary(binary);

            Assert.AreEqual(expectedType, type.Name);
        }
예제 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">Type to send</param>
 public TypeEventArgs(RamType type)
 {
     this.Type = type;
 }