예제 #1
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();
        }
예제 #2
0
        public LcdDisplay(IARMHost ihost, ARMSim.Plugins.UIControls.Lcd lcd)
        {
            mIhost = ihost;
            mLcd   = lcd;

            mIhost.RequestMemoryBlock(0x0c300000, 0xffff0000, onMemoryAccessRead, onMemoryAccessWrite);
            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();
        }
        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();
        }
예제 #5
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();
        }
예제 #6
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);
        }
예제 #7
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();
        }
예제 #8
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();
        }
예제 #9
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();
        }
예제 #11
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
예제 #12
0
        }//init

        /// <summary>
        /// The onLoad function is called after all the plugins have been loaded and their
        /// init methods called.
        /// </summary>
        public void onLoad(object sender, EventArgs e)
        {
            //Subscribe to the restart event so we can clear the eight segment display when the simulation is restarted.
            mIHost.Restart += onRestart;

            //Create the Eight segment display user control
            mEightSegmentDisplayControl = new UIControls.EightSegmentDisplay();

            //request a panel from the UI and add our control
            Panel panel = mIHost.RequestPanel(this.PluginName);

            panel.Controls.Add(mEightSegmentDisplayControl);

            //request reads/writes to the memory address of the display
            mIHost.RequestMemoryBlock(0x02140000, 0xffffffff, this.onMemoryAccessRead, this.onMemoryAccessWrite);

            //request that we get the SWI instruction (swi 0x100) for our plugin and specify the function
            // to call when it is encountered by the simulation engine.
            mIHost.RequestOpCodeRange(0x0f000100, 0x0fffffff, this.onExecuteSWI);

            //Here we are going to request part of the undefined opcode space of the ARM processor.
            //We are going to create 2 instructions to write to the Eight Segment Display as follows:
            // SEGDIGIT reg,  where reg is a gernal purpose register
            //    This instruction will take the digit in register reg and write that digit to the display.
            //    If the digit is NOT 0-9, nothing is written to the display
            //
            // SEGPATTERN reg, where reg is a gernal purpose register
            //    This instruction will take the 8 bit pattern in register reg and write that pattern to the display.
            //    The top 24 bits are ignored, only the bottom 8 bits are used.
            //
            // We will encode which instruction in bit 8 of the opcode and encode the register number in the
            // bottom 4 bits of the opcode (bits 0-3) (See onExecuteEightSegmentOpcode for details)
            mIHost.RequestOpCodeRange(0x0ef000f0, 0x0ffffef0, this.onExecuteEightSegmentOpcode);
            //mIHost.RequestOpcodeRange("*ef00ef*", this.onExecuteEightSegmentOpcode);

            // To make testing of these instructions easier, we will insert some mnemonics into the parsing
            // tables so we can reference the instructions by their symbols. We need to provide a base opcode
            // and the expected paramaters. In this case we expect a single register so we use the operand "R"
            // We also need to provide a delegate callback that the parser will call when this mnemonic is parsed.
            //
            // However, RequestMnemonic is no longer supported in ARMSim#2.0
            // these requests will throw an exception
            mIHost.RequestMnemonic("SEGDIGIT", 0x0ef000f0, "R", this.onFormEightSegmentOpCode);
            mIHost.RequestMnemonic("SEGPATTERN", 0x0ef001f0, "R", this.onFormEightSegmentOpCode);
        }//onLoad
예제 #13
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();
        }
예제 #14
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
예제 #15
0
 public void onLoad()
 {
     mIhost.RequestMemoryBlock(0x00000000, 0xffffff00, onMemoryAccessRead, onMemoryAccessWrite);
 }