diff --git a/c_os/devices/PCSPK.cc b/c_os/devices/PCSPK.cc index ccefa71..0424ef0 100755 --- a/c_os/devices/PCSPK.cc +++ b/c_os/devices/PCSPK.cc @@ -56,23 +56,6 @@ void PCSPK::off() { ppi.outb((status >> 2) << 2); // Lautsprecher ausschalten } -/***************************************************************************** - * Methode: PCSPK::readCounter * - *---------------------------------------------------------------------------* - * Beschreibung: Zaehler von PIT Channel 0 auslesen. * - * (wird fuer delay benoetigt). * - * * - * Rückgabewerte: counter * - *****************************************************************************/ -inline unsigned int PCSPK::readCounter() { - unsigned char lo, hi; - - control.outb(0x0); // Latch Command - lo = data0.inb(); // Lobyte des Counters auslesen - hi = data0.inb(); // Hibyte des Counters auslesen - return (hi << 8) | lo; -} - /***************************************************************************** * Methode: PCSPK::delay * *---------------------------------------------------------------------------* @@ -84,6 +67,11 @@ inline void PCSPK::delay(int time) { /* Hier muess Code eingefuegt werden */ + unsigned long start_time = systime; + + // systime is incremented in 10ms steps + while ((systime - start_time) * 10 < time) {} + } /***************************************************************************** diff --git a/c_os/devices/PCSPK.h b/c_os/devices/PCSPK.h index 7ce9ac4..bc79fee 100755 --- a/c_os/devices/PCSPK.h +++ b/c_os/devices/PCSPK.h @@ -71,9 +71,6 @@ private: // Verzoegerung um X ms (in 1ms Schritten; Min. 1ms) inline void delay(int time); - // Zaehler von PIT Channel 0 auslesen (wird fuer delay benoetigt) - inline unsigned int readCounter(); - public: // Konstruktor. Initialisieren der Ports. PCSPK() : control(0x43), data0(0x40), data2(0x42), ppi(0x61) {} diff --git a/c_os/main.cc b/c_os/main.cc index 15a6abc..646d83a 100755 --- a/c_os/main.cc +++ b/c_os/main.cc @@ -75,6 +75,8 @@ int main() { // scheduler.ready(new CoopThreadDemo()); // scheduler.ready(new VBEdemo()); // Switch to VESA graphics mode + // pcspk.tetris(); + // Scheduler starten (schedule() erzeugt den Idle-Thread) scheduler.schedule();