PIT not working on real hardware

Topics: Using Cosmos (Developing your own OS, projects, etc)
Feb 15, 2013 at 8:27 PM
Hey Cosmofarians ;)

I'm having a problem with the PIT on real hardware.

That's my PIT class:
using System;
namespace dewitcher.Core
{
    public static class PIT
    {
        public static void Mode0(uint frequency)
        {
            dewitcher.Core.IDT.Remap();
            dewitcher.Core.IRQ.ClearMask(0);
            dewitcher.Core.IRQ.ClearMask(15);
            uint divisor = 1193182 / frequency;
            IO.CDDI.outb(0x43, 0x30);
            IO.CDDI.outb(0x40, (byte)(divisor & 0xFF));
            IO.CDDI.outb(0x40, (byte)((divisor >> 8) & 0xFF));
        }
        public static void Mode2(uint frequency)
        {
            dewitcher.Core.IDT.Remap();
            dewitcher.Core.IRQ.ClearMask(0);
            dewitcher.Core.IRQ.ClearMask(15);
            uint divisor = 1193182 / frequency;
            IO.CDDI.outb(0x43, 0x36);
            byte l = (byte)(divisor & 0xFF);
            byte h = (byte)((divisor >> 8) & 0xFF);
            IO.CDDI.outb(0x40, l);
            IO.CDDI.outb(0x40, h);
        }
    }
}
I'm using Mode0 to let the OS freeze for a amount of milliseconds.
I'm converting the milliseconds to hz, calling Mode0 and entering a while(true)-loop.
IRQ0 raises an event when the PIT-Counter is 0. When the Event is called, my OS leaves the while(true)-loop.

It is working on VMWare but sadly not on real hardware.
Can anyone say me why? =P

Thanks, Splitty
Coordinator
Feb 15, 2013 at 8:29 PM

Wrong calculation? You could try the debugger if you have an onboard serial port.

Op 15 feb. 2013 22:27 schreef "SplittyDev" <notifications@codeplex.com> het volgende:

From: SplittyDev

Hey Cosmofarians ;)

I'm having a problem with the PIT on real hardware.

That's my PIT class:
using System;
namespace dewitcher.Core
{
    public static class PIT
    {
        public static void Mode0(uint frequency)
        {
            dewitcher.Core.IDT.Remap();
            dewitcher.Core.IRQ.ClearMask(0);
            dewitcher.Core.IRQ.ClearMask(15);
            uint divisor = 1193182 / frequency;
            IO.CDDI.outb(0x43, 0x30);
            IO.CDDI.outb(0x40, (byte)(divisor & 0xFF));
            IO.CDDI.outb(0x40, (byte)((divisor >> 8) & 0xFF));
        }
        public static void Mode2(uint frequency)
        {
            dewitcher.Core.IDT.Remap();
            dewitcher.Core.IRQ.ClearMask(0);
            dewitcher.Core.IRQ.ClearMask(15);
            uint divisor = 1193182 / frequency;
            IO.CDDI.outb(0x43, 0x36);
            byte l = (byte)(divisor & 0xFF);
            byte h = (byte)((divisor >> 8) & 0xFF);
            IO.CDDI.outb(0x40, l);
            IO.CDDI.outb(0x40, h);
        }
    }
}
I'm using Mode0 to let the OS freeze for a amount of milliseconds.
I'm converting the milliseconds to hz, calling Mode0 and entering a while(true)-loop.
IRQ0 raises an event when the PIT-Counter is 0. When the Event is called, my OS leaves the while(true)-loop.

It is working on VMWare but sadly not on real hardware.
Can anyone say me why? =P

Thanks, Splitty

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com