add a shnitton of loggers
This commit is contained in:
@ -33,6 +33,9 @@ void int_disp(unsigned int vector) {
|
||||
|
||||
/* hier muss Code eingefuegt werden */
|
||||
|
||||
// 32 = Timer Interrupt
|
||||
// kout << "Interrupt: " << dec << vector << endl;
|
||||
|
||||
if (vector < 32) {
|
||||
bs_dump(vector);
|
||||
cpu.halt();
|
||||
@ -45,17 +48,6 @@ void int_disp(unsigned int vector) {
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Konstruktor: IntDispatcher::IntDispatcher *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Beschreibung: Initialisierung der ISR map mit einer Default-ISR. *
|
||||
*****************************************************************************/
|
||||
IntDispatcher::IntDispatcher() {
|
||||
for (unsigned int slot = 0; slot < size; slot++) {
|
||||
map[slot] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Methode: IntDispatcher::assign *
|
||||
*---------------------------------------------------------------------------*
|
||||
@ -72,12 +64,12 @@ int IntDispatcher::assign(unsigned int vector, ISR& isr) {
|
||||
/* hier muss Code eingefuegt werden */
|
||||
|
||||
if (vector >= this->size) {
|
||||
if constexpr (DEBUG) { kout << "Invalid vector number when assigning" << endl; }
|
||||
log << ERROR << "Invalid vector number when assigning" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
this->map[vector] = &isr;
|
||||
if constexpr (DEBUG) { kout << "Registered ISR for vector " << dec << vector << endl; }
|
||||
log << INFO << "Registered ISR for vector " << dec << vector << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -103,7 +95,7 @@ int IntDispatcher::report(unsigned int vector) {
|
||||
ISR* isr = this->map[vector];
|
||||
|
||||
if (isr == 0) {
|
||||
if constexpr (DEBUG) { kout << "No ISR registered for vector " << vector << endl; }
|
||||
log << ERROR << "No ISR registered for vector " << vector << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -14,12 +14,15 @@
|
||||
#define __IntDispatcher_include__
|
||||
|
||||
#include "kernel/interrupts/ISR.h"
|
||||
#include "user/lib/Logger.h"
|
||||
|
||||
class IntDispatcher {
|
||||
|
||||
private:
|
||||
IntDispatcher(const IntDispatcher& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
Logger log;
|
||||
|
||||
enum { size = 256 };
|
||||
ISR* map[size];
|
||||
|
||||
@ -32,7 +35,11 @@ public:
|
||||
};
|
||||
|
||||
// Initialisierung der ISR map mit einer Default-ISR.
|
||||
IntDispatcher();
|
||||
IntDispatcher() : log("IntDis") {
|
||||
for (unsigned int slot = 0; slot < size; slot++) {
|
||||
map[slot] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Registrierung einer ISR. (Rueckgabewert: 0 = Erfolg, -1 = Fehler)
|
||||
int assign(unsigned int vector, ISR& isr);
|
||||
|
||||
Reference in New Issue
Block a user