Ejemplo n.º 1
0
        public int RegisterHandler(PITHandler handler)
        {
            if (handler.id != -1)
            {
                ExceptionMethods.Throw(new FOS_System.Exception("Timer has already been registered!"));
            }

            handler.id = (TimerIdGenerator++);
            ActiveHandlers.Add(handler);

            return(handler.id);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The internal timer 0 interrupt handler.
        /// </summary>
        public void InterruptHandler()
        {
            //if (Processes.ProcessManager.Processes.Count > 1)
            //    BasicConsole.WriteLine("PIT: 1");

            uint       T0Delay = T0DelyNS;
            PITHandler hndlr   = null;

            for (int i = ActiveHandlers.Count - 1; i >= 0; i--)
            {
                //if (Processes.ProcessManager.Processes.Count > 1)
                //    BasicConsole.WriteLine("PIT: 2");

                hndlr = (PITHandler)ActiveHandlers[i];

                //if (Processes.ProcessManager.Processes.Count > 1)
                //    BasicConsole.WriteLine("PIT: 3");

                hndlr.NSRemaining -= T0Delay;

                //if (Processes.ProcessManager.Processes.Count > 1)
                //    BasicConsole.WriteLine("PIT: 4");

                if (hndlr.NSRemaining < T0Delay)
                {
                    //if (Processes.ProcessManager.Processes.Count > 1)
                    //    BasicConsole.WriteLine("PIT: 5");

                    if (hndlr.Recurring)
                    {
                        hndlr.NSRemaining = hndlr.NanosecondsTimeout;
                    }
                    else
                    {
                        hndlr.id = -1;

                        //if (Processes.ProcessManager.Processes.Count > 1)
                        //    BasicConsole.WriteLine("PIT: 6");

                        ActiveHandlers.RemoveAt(i);
                    }

                    //if (Processes.ProcessManager.Processes.Count > 1)
                    //    BasicConsole.WriteLine("PIT: 7");

                    hndlr.HandleTrigger(hndlr.state);
                }
            }
        }
Ejemplo n.º 3
0
Archivo: PIT.cs Proyecto: kztao/FlingOS
        /// <summary>
        /// Registers the specified handler for the timer 0 interrupt.
        /// </summary>
        /// <param name="handler">The handler to register.</param>
        /// <returns>The Id of the registered handler.</returns>
        public int RegisterHandler(PITHandler handler)
        {
            if (handler.id != -1)
            {
                ExceptionMethods.Throw(new FOS_System.Exception("Timer has already been registered!"));
            }

            handler.id = (TimerIdGenerator++);
            ActiveHandlers.Add(handler);

            return handler.id;
        }