예제 #1
0
        public void Init(IARMHost iHost)
        {
            mHost = iHost;

            //set the load handler so we get called when all the plugins are loaded
            mHost.Load += onLoad;
        }
예제 #2
0
        /// <summary>
        /// Construct a timer control.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="buttonTimerDisplay"></param>
        public TimerControl(IARMHost host, ButtonTimerDisplay buttonTimerDisplay)
        {
            //cache the simulator host interface and the timers user interface
            mHost = host;
            mButtonTimerDisplay = buttonTimerDisplay;

            //subscribe to the Start and Stop events so we can track when the simulation is running
            mHost.StartSimulation += mHost_Start;
            mHost.StopSimulation  += mHost_Stop;

            //Create the 2 timers and set their notification events
            mTimerBlocks[0]              = new TimerBlock();
            mTimerBlocks[1]              = new TimerBlock();
            mTimerBlocks[0].TimerNotify += TimerNotify;
            mTimerBlocks[1].TimerNotify += TimerNotify;

            //request to be notified when our area of the memory map is written or read
            mHost.RequestMemoryBlock(0x01d30000, 0xffffff00, onMemoryAccessRead, onMemoryAccessWrite);

            //request to be notified when cycles are expended so we can update the timers
            mHost.Cycles += mHost_Cycles;

            //request simulator restart notification so we can reset the timers to their default state
            mHost.Restart += mHost_Restart;

            //force timers into default state.
            init();
        }
예제 #3
0
        /// <summary>
        /// Load a string from memory. Read bytes from memory until a 0 is found.
        /// </summary>
        /// <param name="ihost">Simulator reference</param>
        /// <param name="address">Address to load from</param>
        /// <param name="maxSize">max number of bytes to load</param>
        /// <returns>string read from memory</returns>
        public static string loadStringFromMemory(IARMHost ihost, uint address, uint maxSize)
        {
            StringBuilder str       = new StringBuilder();
            uint          bytesLeft = maxSize;

            try
            {
                uint data;
                do
                {
                    data = ihost.GetMemory(address++, MemorySize.Byte);
                    if (data == 0)
                    {
                        break;
                    }
                    str.Append((char)data);
                } while (--bytesLeft > 0);
            }//try
            catch (Exception ex)
            {
                ARMPluginInterfaces.Utils.OutputDebugString("Error while reading string from memory:" + ex.Message);
                str.Length = 0;
            } //catch
            return(str.ToString());
        }     //loadStringFromMemory
예제 #4
0
        /// <summary>
        /// The Init method of the plugin. This method is called when the plugin has been created by ARMSim.
        /// ARMSim will pass an instance of IARMHost to the plugin so that the plugin can make requests back to ARMSim.
        /// </summary>
        /// <param name="ihost"></param>
        public void Init(IARMHost ihost)
        {
            //cache the interface to ARMSim
            mHost = ihost;

            //set the load handler so we get called when all the plugins are loaded
            mHost.Load += onLoad;
        }//Init
예제 #5
0
        /// <summary>
        /// The init function is called once the plugin has been loaded.
        /// From this function you can subscribe to the events the
        /// simulator supports.
        /// </summary>
        /// <param name="IHost"></param>
        public void Init(IARMHost ihost)
        {
            //cache a copy of the host reference so we can communicate back to ARMSim
            mIHost = ihost;

            //and subscribe to the Load event so we will be notified once all the plugins have been created
            mIHost.Load += onLoad;
        }//init
        /// <summary>
        /// Called when plugin is first created. Host passes in interface here
        /// </summary>
        /// <param name="ihost"></param>
        public void Init(IARMHost ihost)
        {
            //save the reference to the simulator
            mIhost = ihost;

            //subscribe to the Load event
            mIhost.Load += onLoad;
        }//Init
예제 #7
0
        public LcdDisplay(IARMHost ihost, ARMSim.Plugins.UIControls.Lcd lcd)
        {
            mIhost = ihost;
            mLcd   = lcd;

            mIhost.RequestMemoryBlock(0x0c300000, 0xffff0000, onMemoryAccessRead, onMemoryAccessWrite);
            this.Restart();
        }
예제 #8
0
        public Leds(IARMHost ihost, IOPorts ioPorts, ARMSim.Plugins.UIControls.Leds ledsControl)
        {
            mIhost       = ihost;
            mIOPorts     = ioPorts;
            mLedsControl = ledsControl;

            mIOPorts.RequestPortNotify(IOPorts.PortNumbers.PDATB, ioPortNotify);
            this.Restart();
        }
        public EightSegmentDisplay(IARMHost ihost, ARMSim.Plugins.UIControls.EightSegmentDisplay eightSegmentDisplay)
        {
            mIHost = ihost;
            mEightSegmentDisplay = eightSegmentDisplay;

            //request reads/writes to the memory address of the display
            mIHost.RequestMemoryBlock(0x02140000, 0xffffffff, this.onMemoryAccessRead, this.onMemoryAccessWrite);
            this.Restart();
        }
예제 #10
0
        public InteruptController(IARMHost ihost, InterruptControllerDisplay interruptControllerDisplay)
        {
            mIhost = ihost;
            mInterruptControllerDisplay = interruptControllerDisplay;

            //request to be notified when our area of the memory map is written or read
            mIhost.RequestMemoryBlock(0x01e00000, 0xffffffc0, onMemoryAccessRead, onMemoryAccessWrite);
            this.Restart();
        }
예제 #11
0
        /// <summary>
        /// Called when plugin is first created. Host passes in interface here
        /// </summary>
        /// <param name="ihost"></param>
        public void Init(IARMHost iHost)
        {
            //save the reference to the simulator
            mIhost = iHost;

            //subscribe to the Load event
            mIhost.Load += onLoad;

            timer = System.Diagnostics.Stopwatch.StartNew();  // start the timer
        }//init
예제 #12
0
        public WatchDogTimer(IARMHost ihost, InteruptController interuptController)
        {
            mIhost = ihost;
            _interuptController = interuptController;

            //request to be notified when our area of the memory map is written or read
            mIhost.RequestMemoryBlock(0x01d30000, 0xfffffff0, onMemoryAccessRead, onMemoryAccessWrite);
            mIhost.Cycles += onClock;
            this.Restart();
        }
예제 #13
0
        public BlueButtons(IARMHost ihost, IOPorts ioPorts, InteruptController interuptController, ARMSim.Plugins.UIControls.BlueButtons blueButtons)
        {
            mIhost               = ihost;
            mIOPorts             = ioPorts;
            mInteruptController  = interuptController;
            mBlueButtons         = blueButtons;
            mBlueButtons.Notify += ButtonPressPortNotify;

            //request to be notified when our area of the memory map is written or read
            mIhost.RequestMemoryBlock(keyboard_base, 0xffffff00, onMemoryAccessRead, onMemoryAccessWrite);
        }
예제 #14
0
        public Uarts(IARMHost ihost, InteruptController interuptController)
        {
            mIhost = ihost;
            mInteruptController = interuptController;
            mIhost.RequestMemoryBlock(mLowerAddress, 0xffff0000, onMemoryAccessRead, onMemoryAccessWrite);

            mUart0.Create("COM1");
            mUart1.Create("COM2");

            this.Restart();
        }
예제 #15
0
        /// <summary>
        /// Control ctor.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="BlackButtonsDisplay"></param>
        public BlackButtonsControl(IARMHost host, BlackButtonsDisplay blackButtonsDisplay)
        {
            mHost = host;
            mBlackButtonsDisplay         = blackButtonsDisplay;
            mBlackButtonsDisplay.Notify += BlackButtonPressNotify;

            //request to be notified when our area of the memory map is written or read
            mHost.RequestMemoryBlock(mBaseAddress, 0xffffffff, onMemoryAccessRead, onMemoryAccessWrite);

            //get notified when the simulation is restarted so we can put buttons back to its initial state
            mHost.Restart += mHost_Restart;

            //and make sure display is init
            init();
        }
예제 #16
0
        /// <summary>
        /// Control ctor
        /// </summary>
        /// <param name="host"></param>
        /// <param name="ledsDisplay"></param>
        public LedsControl(IARMHost host, LedsDisplay ledsDisplay)
        {
            //cache the simulator host interface and the LEDs user interface
            mHost        = host;
            mLedsDisplay = ledsDisplay;

            //request to be notified when our area of the memory map is written or read
            mHost.RequestMemoryBlock(0x01d20000, 0xffffffff, onMemoryAccessRead, onMemoryAccessWrite);

            //request simulator restart notification so we can reset the LEDs to their default state
            mHost.Restart += mHost_Restart;

            //init LEDs to default state
            init();
        }
        /// <summary>
        /// Control ctor
        /// </summary>
        /// <param name="host"></param>
        /// <param name="eightSegmentDisplay"></param>
        public EightSegmentControl(IARMHost host, EightSegmentDisplay eightSegmentDisplay)
        {
            //cache the simulator host interface and the LEDs user interface
            mHost = host;
            mEightSegmentDisplay = eightSegmentDisplay;

            //request to be notified when our area of the memory map is written or read
            mHost.RequestMemoryBlock(0x01d10000, 0xffffffff, onMemoryAccessRead, onMemoryAccessWrite);

            //request simulator restart notification so we can reset the 8 segment display to its default state
            mHost.Restart += mHost_Restart;

            //Force 8 segment display to a default state.
            init();
        }
예제 #18
0
        /// <summary>
        /// Control ctor.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="twoLineLCDDisplay"></param>
        public TwoLineLCDControl(IARMHost host, TwoLineLCDDisplay twoLineLCDDisplay)
        {
            mHost = host;
            mTwoLineLCDDisplay = twoLineLCDDisplay;

            //request to be notified when our area of the memory map is written or read
            //0x02f00000:Data Register
            //0x02f00004:Command Register
            mHost.RequestMemoryBlock(mBaseAddress, 0xfffffff0, onMemoryAccessRead, onMemoryAccessWrite);

            //get notified when the simulation is restarted so we can put display back to its initial state
            mHost.Restart += mHost_Restart;

            //and make sure display is init
            init();
        }//TwoLineLCDControl
예제 #19
0
        public TrackBarControl(IARMHost host, TrackBar trackBar, Label trackBarLabel)
        {
            mHost          = host;
            mTrackBar      = trackBar;
            mTrackBarLabel = trackBarLabel;

            //request to be notified when our area of the memory map is read. We don't care about writes so use null.
            mHost.RequestMemoryBlock(mBaseAddress, 0xffffffff, onMemoryAccessRead, null);

            //get notified when the simulation is restarted so we can put buttons back to its initial state
            mHost.Restart += mHost_Restart;

            //set notification for scroll events on trackbar
            mTrackBar.Scroll += new System.EventHandler(this.trackBar1_Scroll);

            //and make sure display is init
            init();
        }
예제 #20
0
        public IOPorts(IARMHost ihost)
        {
            mIhost = ihost;
            //request to be notified when our area of the memory map is written or read
            mIhost.RequestMemoryBlock(mLowerAddress, 0xffffff80, onMemoryAccessRead, onMemoryAccessWrite);

            mPortDefinitions[0] = new PortDefinition(PortNumbers.PCONA, 10);
            mPortDefinitions[1] = new PortDefinition(PortNumbers.PDATA, 10);
            mPortDefinitions[2] = new PortDefinition(PortNumbers.PCONB, 11);
            mPortDefinitions[3] = new PortDefinition(PortNumbers.PDATB, 11);

            mPortDefinitions[4] = new PortDefinition(PortNumbers.PCONC, 32);
            mPortDefinitions[5] = new PortDefinition(PortNumbers.PDATC, 16);
            mPortDefinitions[6] = new PortDefinition(PortNumbers.PUPC, 16);

            mPortDefinitions[7] = new PortDefinition(PortNumbers.PCOND, 16);
            mPortDefinitions[8] = new PortDefinition(PortNumbers.PDATD, 8);
            mPortDefinitions[9] = new PortDefinition(PortNumbers.PUPD, 8);

            mPortDefinitions[10] = new PortDefinition(PortNumbers.PCONE, 18);
            mPortDefinitions[11] = new PortDefinition(PortNumbers.PDATE, 9);
            mPortDefinitions[12] = new PortDefinition(PortNumbers.PUPE, 8);

            mPortDefinitions[13] = new PortDefinition(PortNumbers.PCONF, 22);
            mPortDefinitions[14] = new PortDefinition(PortNumbers.PDATF, 9);
            mPortDefinitions[15] = new PortDefinition(PortNumbers.PUPF, 9);

            mPortDefinitions[16] = new PortDefinition(PortNumbers.PCONG, 16);
            mPortDefinitions[17] = new PortDefinition(PortNumbers.PDATG, 8);
            mPortDefinitions[18] = new PortDefinition(PortNumbers.PUPG, 8);

            mPortDefinitions[19] = new PortDefinition(PortNumbers.SPUCR, 3);
            mPortDefinitions[20] = new PortDefinition(PortNumbers.EXTINT, 31);
            mPortDefinitions[21] = new PortDefinition(PortNumbers.EXTPND, 4, true);

            this.Restart();
        }//ctor
 /// <summary>
 /// The init function is called once the plugin has been loaded.
 /// From this function you can subscribe to the events the
 /// simulator supports.
 /// </summary>
 /// <param name="iHost"></param>
 public void Init(IARMHost iHost)
 {
     mIHost       = iHost;
     mIHost.Load += onLoad;
 }//init
예제 #22
0
 public ZeroPage(IARMHost ihost)
 {
     mIhost = ihost;
 }
 /// <summary>
 /// ARMSimConsoleStream ctor
 /// </summary>
 /// <param name="handle">handle of this console</param>
 /// <param name="ihost">a reference back to the simulator</param>
 public ARMSimConsoleStream(uint handle, IARMHost ihost)
 {
     _handle = handle;
     _ihost  = ihost;
 }
예제 #24
0
 /// <summary>
 /// The init function is called once the plugin has been loaded.
 /// From this function you can subscribe to the events the
 /// simulator supports.
 /// </summary>
 /// <param name="IHost"></param>
 public void Init(IARMHost IHost)
 {
     mIHost          = IHost;
     mIHost.Load    += onLoad;
     mIHost.Restart += onRestart;
 }//init