[SOLVED] FDC / DMA issue
Posted: Tue Jun 24, 2014 5:19 pm
Well, I gave it 3 days of me trying to figure this out (even completely scrapping my FDC and DMA driver)
So, now I have new drivers that still do not work...
I initialize the FDC (as far as I can tell) with no issue.
I can seek to any cylinder I choose with no issue.
When I read a sector on bochs I timeout because of no IRQ, and real hardware ST0 tells me "abnormal termination"
Also I don't know if this is right or not but is the FDC's ReadSector command supposed to fire IRQ twice, (it does on my H/W).
Because my code would be more or less difficult to shift through I will upload my functions as my modified DEBUG output.
NOTE: DATA READY is called before _FDC_Read and after _FDC_write in my DEBUG (not in the actual running code both are before)
DMA init:
DMA set read:
FDC READ SECTOR (snippit)
And just for completeness:
_FDC_init full DEBUG out:
_FDC_ReadSector full DEBUG out:
I will upload the actual C code if needed, but above has all the port I/Os called by FDC and DMA.
Any help is appreciated, I just can't determine the issue here.
P.S. Hope the tabbing in the code blocks works out decently in all themes.
So, now I have new drivers that still do not work...
I initialize the FDC (as far as I can tell) with no issue.
I can seek to any cylinder I choose with no issue.
When I read a sector on bochs I timeout because of no IRQ, and real hardware ST0 tells me "abnormal termination"
Also I don't know if this is right or not but is the FDC's ReadSector command supposed to fire IRQ twice, (it does on my H/W).
Because my code would be more or less difficult to shift through I will upload my functions as my modified DEBUG output.
NOTE: DATA READY is called before _FDC_Read and after _FDC_write in my DEBUG (not in the actual running code both are before)
DMA init:
Code: Select all
_DMA_outb(0xA, 0x6) MASK DMA CHANNEL 2
_DMA_outb(0xC, 0xFF) RESET MASTER FF
_DMA_outb(0x4, 0x0) ADDR LOW
_DMA_outb(0x4, 0x10) ADDR HIGH
_DMA_outb(0xC, 0xFF) RESET MASTER FF
_DMA_outb(0x5, 0xFF) COUNT LOW
_DMA_outb(0x5, 0x23) COUNT HIGH
_DMA_outb(0x81, 0x0) ADDR EXT
_DMA_outb(0xA, 0x2) UNMASK DMA CHANNEL 2
Code: Select all
_DMA_outb(0xA, 0x6) DMA MASK CHANNEL 2
_DMA_outb(0xC, 0x46) (SINGLE TRANSFER | READ)
_DMA_outb(0xB, 0x46) (SINGLE TRANSFER | READ)
_DMA_outb(0xA, 0x2) DMA UNMASK CHANNEL 2
Code: Select all
_FDC_Write(0x3F0, 0x5, 0xE6) (READ SECTOR | MULTI-TRACK | SKIP | DD)
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) (HEAD << 2) | 1
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) TRACK
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) HEAD
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x1) SECTOR
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x2) DTL
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x2) (SECTOR + 1) OR 18
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x1B) GAP
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0xFF) SECTOR SIZE??
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_WAIT_IR() IT COMPLAINED BIG TIME NOT
FDC IRQ RECIVED
_FDC_WAIT_IR() WAITING FOR THE SECOND IRQ
FDC IRQ RECIVED
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x40 [ST0] 0100 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x10 [ST1] 0001 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [ST2] 0000 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYLINDER] 0000 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [HEAD] 0000 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x1 [SECTOR #] 0000 0001
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x2 [SECTOR SIZE] 0000 0010
_FDC_Write(0x3F0, 0x5, 0x8) SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x80 [ST0] 1000 0000
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x80 [CYL] 1000 0000
_FDC_Write(0x3F0, 0x2, 0xC) MOTOR OFF
_FDC_init full DEBUG out:
Code: Select all
_DMA_outb(0xA, 0x6) MASK DMA CHANNEL 2
_DMA_outb(0xC, 0xFF) RESET MASTER FF
_DMA_outb(0x4, 0x0) ADDR LOW
_DMA_outb(0x4, 0x10) ADDR HIGH
_DMA_outb(0xC, 0xFF) RESET MASTER FF
_DMA_outb(0x5, 0xFF) COUNT LOW
_DMA_outb(0x5, 0x23) COUNT HIGH
_DMA_outb(0x81, 0x0) ADDR EXT
_DMA_outb(0xA, 0x2) UNMASK DMA CHANNEL 2
_FDC_Write(0x3F0, 0x2, 0x0) FDC RESET
FDC IRQ RECIVED
_FDC_Write(0x3F0, 0x2, 0xC) FDC ENABLE
FDC IRQ RECIVED
_FDC_Write(0x3F0, 0x7, 0x0) CCR SPEED
_FDC_WAIT_IR()
_FDC_Write(0x3F0, 0x5, 0x8) FDC SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0xC0 [ST0] 1100 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYL] 0000 0000
_FDC_Write(0x3F0, 0x5, 0x8) FDC SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0xC1 [ST0] 1100 0001
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYL] 0000 0000
_FDC_Write(0x3F0, 0x5, 0x8) FDC SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0xC2 [ST0] 1100 0010
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYL] 0000 0000
_FDC_Write(0x3F0, 0x5, 0x8) FDC SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0xC3 [ST0] 1100 0011
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYL] 0000 0000
_FDC_Write(0x3F0, 0x5, 0x13) FDC CONFIGURE
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) DEFAULT CONFIG
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x10) POLLING DISABLED
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) precomp_val = 0 ?
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x3) FDC SPECIFY
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_Write(0x3F0, 0x5, 0x30) (3 << 4) | (240 & 0XF)
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x21) (16 << 1) | 1
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x2, 0x1C) MOTOR ON
_FDC_Write(0x3F0, 0x5, 0x7) CALIBRATE
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) DRIVE
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_WAIT_IR()
FDC IRQ RECIVED
_FDC_Write(0x3F0, 0x5, 0x8) SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x81 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD1 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x20 [ST0] 0010 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYL] 0000 0000
_FDC_Write(0x3F0, 0x2, 0xC) MOTOR OFF
Code: Select all
_FDC_Write(0x3F0, 0x2, 0x1C) MOTOR ON
_FDC_Write(0x3F0, 0x5, 0xF) SEEK
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) HEAD
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) CYLINDER
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
FDC IRQ RECIVED
_FDC_WAIT_IR()
_FDC_Write(0x3F0, 0x5, 0x8) SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x81 DATA READY
_FDC_READ(0x3F0, 0x4) = 0xD1 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x20 [ST0] 0010 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYL] 0000 0000
_DMA_outb(0xA, 0x6) DMA MASK CHANNEL 2
_DMA_outb(0xC, 0x46) (SINGLE TRANSFER | READ)
_DMA_outb(0xB, 0x46) (SINGLE TRANSFER | READ)
_DMA_outb(0xA, 0x2) DMA UNMASK CHANNEL 2
_FDC_Write(0x3F0, 0x5, 0xE6) (READ SECTOR | MULTI-TRACK | SKIP | DD)
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) (HEAD << 2) | 1
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) TRACK
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x0) HEAD
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x1) SECTOR
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x2) DTL
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x2) (SECTOR + 1) OR 18
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0x1B) GAP
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_Write(0x3F0, 0x5, 0xFF) SECTOR SIZE??
_FDC_READ(0x3F0, 0x4) = 0x90 DATA READY
_FDC_WAIT_IR() IT COMPLAINED BIG TIME NOT
FDC IRQ RECIVED
_FDC_WAIT_IR() WAITING FOR THE SECOND IRQ
FDC IRQ RECIVED
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x40 [ST0] 0100 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x10 [ST1] 0001 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [ST2] 0000 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [CYLINDER] 0000 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x0 [HEAD] 0000 0000
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x1 [SECTOR #] 0000 0001
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x2 [SECTOR SIZE] 0000 0010
_FDC_Write(0x3F0, 0x5, 0x8) SENSE INT
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
...
_FDC_READ(0x3F0, 0x4) = 0xD0 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x80 [ST0] 1000 0000
_FDC_READ(0x3F0, 0x4) = 0x80 DATA READY
_FDC_READ(0x3F0, 0x5) = 0x80 [CYL] 1000 0000
_FDC_Write(0x3F0, 0x2, 0xC) MOTOR OFF
Any help is appreciated, I just can't determine the issue here.
P.S. Hope the tabbing in the code blocks works out decently in all themes.