コード例 #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
        }//mHost_Stop

        /// <summary>
        /// This function is called when one of the timers has counted down to 0,
        /// is enabled and has the interrupt enable bit set.
        /// Determine which timer it was, set the timer interrupt bit in the id
        /// register and finally notify the simulator we wish to assert the FIQ interrupt.
        /// </summary>
        /// <param name="timerBlock"></param>
        private void TimerNotify(TimerBlock timerBlock)
        {
            // set id bit based on which timer fired
            int id = (timerBlock == mTimerBlocks[0]) ? 0x01 : 0x02;

            //set the bit in the ID register
            mInterruptID |= (uint)(id & 0x03);

            //notify simulator to fire FIQ interrupt.
            mHost.AssertInterrupt(true);
        } //TimerNotify
コード例 #3
0
ファイル: Form1.cs プロジェクト: BogdanRaven/TimerStudy
        private void button2_Click(object sender, EventArgs e)
        {
            id++;
            plusButton.Location = new Point(123, id * 85);
            TimerBlock tim = new TimerBlock();

            tim.id = id;
            tim.TimerBlockLoad();
            Controls.Add(tim.labelName);
            Controls.Add(tim.labelHour);
            Controls.Add(tim.labelMinute);
            Controls.Add(tim.labelSecond);
            Controls.Add(tim.playbutton);
            Controls.Add(tim.block);
            listTimer.Add(tim);
            //foreach(TimerBlock b in listTimer)
            // {


            // }
        }