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 */
log << TRACE << "Incrementing systime" << endl;
// alle 10ms, Systemzeit weitersetzen
systime++;
@ -72,15 +74,15 @@ void PIT::trigger() {
/* hier muss Code eingefuegt werden */
// Indicator
if (systime - this->last_indicator_refresh >= 100) {
if (systime - this->last_indicator_refresh >= 10) {
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.preemption_enabled()) {
log << TRACE << "Preemption" << endl;
scheduler.preempt();
}
}

View File

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