OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 20, 2024 10:14 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Unable to use PIT
PostPosted: Wed Mar 18, 2020 4:17 am 
Offline
Member
Member
User avatar

Joined: Wed Feb 19, 2020 1:08 pm
Posts: 270
Location: Italy
So, i've merged some tutorials from github and the osdev wiki and got all setted and working: gdt idt isr pic and irqs. now i'm trying to setup the pit but the irq handler is never called. have i Forgot to init something? on what does the pit depends?

_________________
Regards, Bonfra.


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Wed Mar 18, 2020 4:22 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

I'm afraid more detail is going to be needed than that. Are you on an emulator or real hardware. Is a legacy PIC / PIT even present? Post either a link to your code or post minimal relevant code in code tags.

Cheers,
Adam


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Wed Mar 18, 2020 5:28 am 
Offline
Member
Member
User avatar

Joined: Wed Feb 19, 2020 1:08 pm
Posts: 270
Location: Italy
AJ wrote:
Hi,

I'm afraid more detail is going to be needed than that. Are you on an emulator or real hardware. Is a legacy PIC / PIT even present? Post either a link to your code or post minimal relevant code in code tags.

Cheers,
Adam



sure! I caccidentally deleted the link before posting XD

https://github.com/Bonfra04/OS-DEV

_________________
Regards, Bonfra.


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Thu Mar 19, 2020 10:31 am 
Offline
Member
Member
User avatar

Joined: Wed Feb 19, 2020 1:08 pm
Posts: 270
Location: Italy
my thought is that i need to set or enable something first since it does not throw any errors but i really can't get what that is... i am totally stuck

_________________
Regards, Bonfra.


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Thu Mar 19, 2020 5:30 pm 
Offline

Joined: Tue Feb 18, 2020 8:20 am
Posts: 11
I run BonsOS.img with BochsDBG and it seemed to me that in the pic.c file in the pic_set_enable (...) function, the parameter sent to the "master_set_mask (mask)" function has the value of 0xfb. If I am right this will be the reason, but you will have to confirm the value of this parameter (first bit to zero enables the timer int0, value 1 disables it. At begin all interrupt are disable master = slave = 0xff.


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Thu Mar 19, 2020 7:00 pm 
Offline

Joined: Tue Feb 18, 2020 8:20 am
Posts: 11
You have a error in line 62 from pic.h file. Delete extern "C" from there


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Thu Mar 19, 2020 10:02 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1604
Some remarks: Your PIC driver should ensure that IRQ 2 is never used, and never masked. IRQ2 is the chaining IRQ for the slave PIC. It must remain enabled, else IRQs 8-15 can never fire. Also, according to the Linux source code, the port I/O with the PIC is slow, so you should strive to do as little of it as possible. To that end, maybe save the interrupt mask in software. You can probably afford another sixteen bit static variable.

But your problem probably is that you hook your PIT interrupt to IRQ2. The PIT is on IRQ0.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: Unable to use PIT
PostPosted: Fri Mar 20, 2020 2:27 am 
Offline
Member
Member
User avatar

Joined: Wed Feb 19, 2020 1:08 pm
Posts: 270
Location: Italy
nullplan wrote:
Some remarks: Your PIC driver should ensure that IRQ 2 is never used, and never masked. IRQ2 is the chaining IRQ for the slave PIC. It must remain enabled, else IRQs 8-15 can never fire. Also, according to the Linux source code, the port I/O with the PIC is slow, so you should strive to do as little of it as possible. To that end, maybe save the interrupt mask in software. You can probably afford another sixteen bit static variable.

But your problem probably is that you hook your PIT interrupt to IRQ2. The PIT is on IRQ0.


it really was just this... using IRQ 0 works fine! the funny thing is that i tried from 2 to 15 but leaved 0 alone :oops: ... i'm so dumb thank you very much.

_________________
Regards, Bonfra.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot] and 101 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group