1

add logging + restore preemption

This commit is contained in:
2022-07-16 16:35:59 +02:00
parent d3ea908a1c
commit a47635e022
2 changed files with 12 additions and 7 deletions

View File

@ -62,6 +62,8 @@ void PIT::trigger() {
/* hier muss Code eingefuegt werden */ /* hier muss Code eingefuegt werden */
log << TRACE << "Incrementing systime" << endl;
// alle 10ms, Systemzeit weitersetzen // alle 10ms, Systemzeit weitersetzen
systime++; systime++;
@ -72,15 +74,15 @@ void PIT::trigger() {
/* hier muss Code eingefuegt werden */ /* hier muss Code eingefuegt werden */
// Indicator // Indicator
if (systime - this->last_indicator_refresh >= 100) { if (systime - this->last_indicator_refresh >= 10) {
this->indicator_pos = (this->indicator_pos + 1) % 4; this->indicator_pos = (this->indicator_pos + 1) % 4;
kout.show(79, 0, this->indicator[this->indicator_pos]); kout.show(79, 0, this->indicator[this->indicator_pos]);
this->last_indicator_refresh = systime; this->last_indicator_refresh = systime;
}
// TODO: Move this out again // Preemption
// Preemption if (scheduler.preemption_enabled()) {
if (scheduler.preemption_enabled()) { log << TRACE << "Preemption" << endl;
scheduler.preempt(); scheduler.preempt();
}
} }
} }

View File

@ -12,6 +12,7 @@
#define __PIT_include__ #define __PIT_include__
#include "kernel/interrupts/ISR.h" #include "kernel/interrupts/ISR.h"
#include "user/lib/Logger.h"
class PIT : public ISR { class PIT : public ISR {
private: private:
@ -20,13 +21,15 @@ private:
enum { time_base = 838 }; /* ns */ enum { time_base = 838 }; /* ns */
int timer_interval; int timer_interval;
Logger log;
char indicator[4] = {'|', '/', '-', '\\'}; char indicator[4] = {'|', '/', '-', '\\'};
unsigned int indicator_pos = 0; unsigned int indicator_pos = 0;
unsigned long last_indicator_refresh = 0; unsigned long last_indicator_refresh = 0;
public: public:
// Zeitgeber initialisieren. // Zeitgeber initialisieren.
PIT(int us) { PIT(int us) : log("PIT") {
this->interval(us); this->interval(us);
} }