/************************************************************************************** Copyright (c) 2002 The UbixOS Project $Id$ **************************************************************************************/ #include <drivers/fdc.h> #include <drivers/8259.h> #include <ubixos/gdt.h> #include <ubixos/idt.h> #include <ubixos/types.h> #include <ubixos/io.h> static volatile BOOL done = FALSE; void initFloppy() { setVector(floppyIsr, mVec+6, (dInt+dPresent+dDpl1)); enableIrq(6); } asm( ".globl floppyIsr \n" "floppyIsr: \n" " pusha \n" " pushw %ds \n" " pushw %es \n" " pushw %ss \n" " pushw %ss \n" " popw %ds \n" " popw %es \n" " call floppyIsrhndlr \n" " popw %es \n" " popw %ds \n" " popa \n" " iret \n" ); void floppyIsrhndlr() { done = TRUE; outportByte(0x20,0x20); } void sendByte(int byte) { volatile int msr; int tmo; for (tmo=0;tmo<128;tmo++) { msr = inportByte(fdcMsr); if ((msr & 0xc0) == 0x80) { outportByte(fdcData,byte); return; } inportByte(0x80); } } int getByte() { volatile int msr; int tmo; for (tmo=0;tmo<128;tmo++) { msr = inportByte(fdcMsr); if ((msr & 0xd0) == 0xd0) { return inportByte(fdcData); } inportByte(0x80); } return(-1); }