OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 6:50 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: pmode FDC driver
PostPosted: Fri Jun 13, 2003 10:34 am 
hi, i am working on a pmode FDC driver and i am wondering how to go about reading the result phase of the commands sent to the fdc controller. i try sending commands (for instance a seek command) and i hear the drive move, then i get a fdc interrupt. it is this point where i have the question. once i get the fdc interrupt, can i want till the Main Status Register says there is data available, and then when it does begin reading the result phase bytes? do i have to wait till the MSR says there is data available between each result byte? and do i have to do anything to acknowledge that i read the results other than reading from the port?

thanks a lot in advance!!


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Fri Jun 13, 2003 10:57 am 
ok, one more thing: in protected mode, does the fdc still set a bit of the bios data area at 40:3E? if so, where is this in protected mode? right where it would be in real mode?


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Fri Jun 13, 2003 4:12 pm 
HOS wrote:
ok, one more thing: in protected mode, does the fdc still set a bit of the bios data area at 40:3E? if so, where is this in protected mode? right where it would be in real mode?

When the FDC is done, it issues an IRQ linked to an interrupt (normally #6?). In Pmode, you have to set up your own Interrupt Table which means that the code can do whatever you want when the FDC is done. Yes, it should be at the same spot but you have to use the linear address.


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Fri Jun 13, 2003 4:42 pm 
HOS wrote:
hi, i am working on a pmode FDC driver and i am wondering how to go about reading the result phase of the commands sent to the fdc controller. i try sending commands (for instance a seek command) and i hear the drive move, then i get a fdc interrupt. it is this point where i have the question. once i get the fdc interrupt, can i want till the Main Status Register says there is data available, and then when it does begin reading the result phase bytes? do i have to wait till the MSR says there is data available between each result byte? and do i have to do anything to acknowledge that i read the results other than reading from the port?

thanks a lot in advance!!


No. To my knowledge, you check only once if the FDC is ready to send the result bytes. And reading them is the only acknowledge it needs.


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Sun Jun 15, 2003 8:51 am 
Thank you for your replies.

I have a ISR set up for IRQ 6 which displays "FDC interrupt" and then reads & displays the results. when i issue a command, "FDC interrupt" is displayed and then the results, this appears to be fine. the problem is that i issue another command but then i do not get another interrupt. i monitor linear address 0x43E before and after command and results but it does not change at all (is it possible it changes only in real mode if the bios is handling IRQ 6?) so i still do not know if there is another way to acknowledge the results or am i doing something else wrong?


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Sun Jun 15, 2003 3:31 pm 
HOS wrote:
Thank you for your replies.

I have a ISR set up for IRQ 6 which displays "FDC interrupt" and then reads & displays the results. when i issue a command, "FDC interrupt" is displayed and then the results, this appears to be fine. the problem is that i issue another command but then i do not get another interrupt. i monitor linear address 0x43E before and after command and results but it does not change at all (is it possible it changes only in real mode if the bios is handling IRQ 6?) so i still do not know if there is another way to acknowledge the results or am i doing something else wrong?

Wait... in your ISR, do you set the highest bit at 0x43E? And do you send EOI (End Of Interrupt) to both the PIC's in order to acknowledge the interrupt?


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Mon Jun 16, 2003 6:24 am 
Aha! its amazing how we forget the little things when concentrating so hard on details... a simple call to eoi() enabled me to get results every time i sent a command. eoi() just sends 0x20 to 0x20. is this sufficient? also, it still seems that my readSector function is not working correctly. could be my dma initialization. could you confirm my numbers for floppy disks (of the 1.40 meg 3.5" variety):
head: 0 or 1
cylinder: 1 to 80
sector: 1 to 18
sectors per track: 18

this could also be causing me some problems...


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Mon Jun 16, 2003 7:59 am 
I thought it was cylinder 0 to 79, but I could be wrong about that, it's been a while.

Did you remember to issue the SPECIFY command, with parameters #xDF #x03? (at least, it's #xDF #x03 on my system)

--Jamethiel


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Mon Jun 16, 2003 8:20 am 
Well, i tried to send 0 for cylinder and 1 for sector and that returned bit 2 of ST1 set (no data - could not find sector) so i tried sending 1 and 1 and that returned 0 for ST1. so does that mean cylinder numbers start at 1?

no, i did not send the Specify command. i did not know i had to, (this is my first time programming the fdc :)) but i will try that. should that be done immediately before every read command or just once before using any commands?

Thank you.


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Mon Jun 16, 2003 1:23 pm 
Just send SPECIFY once.


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Tue Jun 17, 2003 6:58 am 
ok, i sent a SPECIFY command once before sending the read command. the byte sequence was:

0x03 (specify command)
0xDF
0x02 (i am using dma mode)

however, this did not change what happened after i sent a readSector command, it still does not appear to read a thing. i get the result phase back from the command, and it looks fine, but it seems like it didn't read a thing. could i test to see if my dma init is my problem by putting the fdc in non-dma mode? if so, is an interrupt triggered every time a byte is read or what?

thanks


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Tue Jun 17, 2003 9:30 am 
HOS wrote:
Aha! its amazing how we forget the little things when concentrating so hard on details... a simple call to eoi() enabled me to get results every time i sent a command. eoi() just sends 0x20 to 0x20. is this sufficient? also, it still seems that my readSector function is not working correctly. could be my dma initialization. could you confirm my numbers for floppy disks (of the 1.40 meg 3.5" variety):
head: 0 or 1
cylinder: 1 to 80
sector: 1 to 18
sectors per track: 18

this could also be causing me some problems...

No, from what I know that is not sufficient. You should send EOI to both PICs (0x20 and 0xA0). At least this is the way I have understood it.

The cylinder number should be 0 to 79.

In non-DMA, the interrupt should be triggered (once) when the drive has completed (when it is ready to send data).


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Tue Jun 17, 2003 9:36 am 
Ok, if cylinder #'s are 0-79 then why when i send a 0 for cylinder do i get NDAT in ST1 back?

and in non-dma mode if i get an interrupt does that mean that i can read a byte at a time, each byte of the result phase and then immediately afterwards each byte of the actual data read from the sector? or does the actual data go somewhere else?

Thank you once again :)


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Wed Jun 18, 2003 5:04 pm 
HOS wrote:
Ok, if cylinder #'s are 0-79 then why when i send a 0 for cylinder do i get NDAT in ST1 back?

and in non-dma mode if i get an interrupt does that mean that i can read a byte at a time, each byte of the result phase and then immediately afterwards each byte of the actual data read from the sector? or does the actual data go somewhere else?

Thank you once again :)

I have really no idea... maybe that is the error I get too... Maybe some clever guy like Pype knows...

As I've understood it, you get the result bytes and after that you poll the drive for one byte at a time... and places it where you want it to be...


Top
  
 
 Post subject: Re:pmode FDC driver
PostPosted: Thu Jun 19, 2003 1:27 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
sorry, i have virtually no practice of floppy programming so far ...

_________________
Image May the source be with you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 214 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