unsigned char floppy_read(unsigned short port) { int counter=0; unsigned char in=0; while(((inb(FP_MAIN_STATUS_REGISTER) & 0x80)==0)) { if(counter>=90) { kprint("\nFloppy Lesezugriff Zeitueberschreitung\n"); break; } counter++; timerSleep(10); } //kprint("\nFloppy Daten gelesen\n"); timerSleep(1); waitIO(); in=inb(FP_DATA_FIFO); waitIO(); return in; }
int timerLoop (void) { IxOsalTimeval now; IxOsalVoidFnVoidPtr callback = NULL; void *callbackParam = NULL; IxOsalTimerRec *nextTimer; IX_STATUS status; while (1) { /* * This loop catches all cases in a simple way. If multiple * timers expire together, then lowest will be <=0 until all * have been processed and the queue get won't get invoked. */ status = ixOsalSemaphoreWait (&ixOsalCriticalSectSem, IX_OSAL_WAIT_FOREVER); if (status != IX_SUCCESS) { ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT, "timerLoop fail to get semaphore \n", 0, 0, 0, 0, 0, 0); return IX_FAIL; } ixOsalTimeGet (&now); nextTimer = findNextTimeout (now); if ((nextTimer == NULL) || IX_OSAL_TIME_GT ((nextTimer->expires), (now))) { callback = NULL; } else { rescheduleTimer (nextTimer); callback = nextTimer->callback; callbackParam = nextTimer->callbackParam; } status = ixOsalSemaphorePost (&ixOsalCriticalSectSem); if (status != IX_SUCCESS) { ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT, "timerLoop fail to release semaphore \n", 0, 0, 0, 0, 0, 0); return IX_FAIL; } if (callback != NULL) { callTimerCallback (callback, callbackParam); } else { timerSleep (nextTimer, now); } } }
void floppy_motorOff() { if(floppy_motor_on) { outb(FP_DIGITAL_OUTPUT_REGISTER,0x0c); timerSleep(100); } }
void floppy_motorOn() { if(!floppy_motor_on) { outb(FP_DIGITAL_OUTPUT_REGISTER,0x1c); timerSleep(100); floppy_motor_on=1; } }
void floppy_out(char cmd) { int counter=0; while(((inb(FP_MAIN_STATUS_REGISTER) & 0x80)==0)) { if(counter>=90) { kprint("\nFloppy Schreibzugriff Zeitueberschreitung\n"); break; } counter++; timerSleep(10); } //kprint("\nFloppy Daten geschrieben\n"); outb(FP_DATA_FIFO, cmd); waitIO(); }