From 508aab5090b68c966ee3cf704b03946a207dd1bc Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Thu, 28 Aug 2014 23:09:41 +0200 Subject: fix floppy driver (dma setup & sectors_per_track) --- kernel/floppy.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/floppy.c b/kernel/floppy.c index f5af4df..9e27214 100644 --- a/kernel/floppy.c +++ b/kernel/floppy.c @@ -38,8 +38,13 @@ void flpydsk_initialize_dma () { x86_outb (0x04, 0xb0); //high x86_outb (0xd8, 0xff); //reset master flip-flop - x86_outb (0x05, 0xff); //count to 0x23ff (number of bytes in a 3.5" floppy disk track) - x86_outb (0x05, 0x23); + + // x86_outb (0x05, 0xff); //count to 0x23ff (number of bytes in a 3.5" floppy disk track) +// x86_outb (0x05, 0x23); +// hey, lets do just ONE sector instead (0x200) + x86_outb (0x05, 0xff); + x86_outb (0x05, 0x01); + x86_outb (0x80, 0); //external page register = 0 x86_outb (0x0a, 0x02); //unmask dma channel 2 log("dma",FOOLOS_LOG_INFO,"initialized"); @@ -345,7 +350,8 @@ void flpydsk_write_sector_imp (uint8_t head, uint8_t track, uint8_t sector) { flpydsk_send_command ( head); // first head should match with above! flpydsk_send_command ( sector); flpydsk_send_command ( FLPYDSK_SECTOR_DTL_512 ); - flpydsk_send_command ( 1 ); // number of tracks we want + //flpydsk_send_command ( 1 ); // number of tracks we want + flpydsk_send_command ( FLPY_SECTORS_PER_TRACK ); // number of tracks ! /* flpydsk_send_command ( @@ -387,7 +393,8 @@ void flpydsk_read_sector_imp (uint8_t head, uint8_t track, uint8_t sector) { flpydsk_send_command ( head); flpydsk_send_command ( sector); flpydsk_send_command ( FLPYDSK_SECTOR_DTL_512 ); - flpydsk_send_command ( 1 ); // number of tracks we want + //flpydsk_send_command ( 1 ); // number of tracks we want + flpydsk_send_command ( FLPY_SECTORS_PER_TRACK ); // number of tracks ! /* flpydsk_send_command ( -- cgit v1.2.3