Esempio n. 1
0
 //
 // Methods
 //
 internal ApicTimer(Apic apic)
 {
     this.apic = apic;
     SetDivisor(1);
     SetOneShot();
     SetInterruptEnabled(false);
     interrupt = apic.IrqToInterrupt(Apic.TimerIrq);
 }
Esempio n. 2
0
        private byte Initialize()
        {
            if ((ReadRtc(DS1287_D) & DS1287_D_VRT) == 0)
            {
                DebugStub.Print("RTClock weak or defective power source.\n");
            }

            rtcBootTime = PullRtcTime();

            DebugStub.Print("RTClock::Start()\n");

            // Enable and clear interrupts
            // NB it may take 500ms for first interrupt to be generated.

            WriteRtc(DS1287_B, DS1287_B_UTI);
            WriteRtc(DS1287_A, DS1287_A_2HZ);
            WriteRtc(DS1287_A, DS1287_A_DIVON | DS1287_A_2HZ);
            WriteRtc(DS1287_B, DS1287_B_HF_24H | DS1287_B_DF_BCD | DS1287_B_PIE | DS1287_B_SQWE);

            // apic.SetIrqPriority(irq, IrqPriority.High);
            apic.EnableIrq(irq);

            // Here we wait for the first interrupt to be
            // raised, which might be upto 0.5 seconds.  This
            // wait is based on experience, ie not waiting with
            // some boxes (the infamous Ryan's TPM machine for
            // instance) leads to the clock interrupt never being
            // raised.

            while ((ReadRtc(DS1287_C) & DS1287_C_PF) != DS1287_C_PF)
            {
                // TODO: Break out after 1 second and
                // report an error.
            }
            firstStatus = DS1287_C_PF;

            byte ivValue = apic.IrqToInterrupt(irq);

            return(ivValue);
        }