From b66bfac5d796f3dac3eddcbda3f84a98b50ae890 Mon Sep 17 00:00:00 2001 From: ChUrl Date: Sat, 16 Jul 2022 01:01:44 +0200 Subject: [PATCH] reformat --- c_os/devices/PIT.cc | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) mode change 100644 => 100755 c_os/devices/PIT.cc diff --git a/c_os/devices/PIT.cc b/c_os/devices/PIT.cc old mode 100644 new mode 100755 index 5568c6c..bb9b5e8 --- a/c_os/devices/PIT.cc +++ b/c_os/devices/PIT.cc @@ -9,9 +9,8 @@ *****************************************************************************/ #include "devices/PIT.h" -#include "kernel/IOport.h" #include "kernel/Globals.h" - +#include "kernel/IOport.h" /***************************************************************************** * Methode: PIT::interval * @@ -22,23 +21,21 @@ * us: Zeitintervall in Mikrosekunden, nachdem periodisch ein * * Interrupt erzeugt werden soll. * *****************************************************************************/ -void PIT::interval (int us) { +void PIT::interval(int us) { /* hier muss Code eingefuegt werden */ IOport control(0x43); - control.outb(0x36); // Zähler 0 Mode 3 + control.outb(0x36); // Zähler 0 Mode 3 - unsigned int cntStart = (1193180.0 / 1000000.0) * us; // 1.19Mhz PIT + unsigned int cntStart = (1193180.0 / 1000000.0) * us; // 1.19Mhz PIT + // kout << "PIT cntStart: " << dec << cntStart << endl; IOport data0(0x40); data0.outb(cntStart & 0xFF); // Zaehler-0 laden (Lobyte) data0.outb(cntStart >> 8); // Zaehler-0 laden (Hibyte) - - } - /***************************************************************************** * Methode: PIT::plugin * *---------------------------------------------------------------------------* @@ -46,7 +43,7 @@ void PIT::interval (int us) { * wird bei Ablauf des definierten Zeitintervalls die * * Methode 'trigger' aufgerufen. * *****************************************************************************/ -void PIT::plugin () { +void PIT::plugin() { /* hier muss Code eingefuegt werden */ @@ -54,7 +51,6 @@ void PIT::plugin () { pic.allow(PIC::timer); } - /***************************************************************************** * Methode: PIT::trigger * *---------------------------------------------------------------------------* @@ -63,10 +59,10 @@ void PIT::plugin () { * aktualisieren und Thread wechseln durch Setzen der * * Variable 'forceSwitch', wird in 'int_disp' behandelt. * *****************************************************************************/ -void PIT::trigger () { +void PIT::trigger() { /* hier muss Code eingefuegt werden */ - + // alle 10ms, Systemzeit weitersetzen systime++; @@ -77,18 +73,15 @@ void PIT::trigger () { /* hier muss Code eingefuegt werden */ // Indicator - if (systime - this->last_indicator_refresh >= 10) { + if (systime - this->last_indicator_refresh >= 100) { this->indicator_pos = (this->indicator_pos + 1) % 4; kout.show(79, 0, this->indicator[this->indicator_pos]); this->last_indicator_refresh = systime; + + // TODO: Move this out again + // Preemption + if (scheduler.preemption_enabled()) { + scheduler.preempt(); + } } - - // Preemption - if (scheduler.isInitialized()) { - scheduler.preempt(); - } - - } - -