add pit indicator
This commit is contained in:
@ -26,6 +26,16 @@ void PIT::interval (int us) {
|
|||||||
|
|
||||||
/* hier muss Code eingefuegt werden */
|
/* hier muss Code eingefuegt werden */
|
||||||
|
|
||||||
|
IOport control(0x43);
|
||||||
|
control.outb(0x36); // Zähler 0 Mode 3
|
||||||
|
|
||||||
|
unsigned int cntStart = (1193180.0 / 1000000.0) * us; // 1.19Mhz PIT
|
||||||
|
|
||||||
|
IOport data0(0x40);
|
||||||
|
data0.outb(cntStart & 0xFF); // Zaehler-0 laden (Lobyte)
|
||||||
|
data0.outb(cntStart >> 8); // Zaehler-0 laden (Hibyte)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +50,8 @@ void PIT::plugin () {
|
|||||||
|
|
||||||
/* hier muss Code eingefuegt werden */
|
/* hier muss Code eingefuegt werden */
|
||||||
|
|
||||||
|
intdis.assign(IntDispatcher::timer, *this);
|
||||||
|
pic.allow(PIC::timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +75,20 @@ void PIT::trigger () {
|
|||||||
// und ein weiterer Thread rechnen moechte
|
// und ein weiterer Thread rechnen moechte
|
||||||
|
|
||||||
/* hier muss Code eingefuegt werden */
|
/* hier muss Code eingefuegt werden */
|
||||||
|
|
||||||
|
// Indicator
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preemption
|
||||||
|
if (scheduler.isInitialized()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,15 @@
|
|||||||
class PIT : public ISR {
|
class PIT : public ISR {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PIT(const PIT ©); // Verhindere Kopieren
|
PIT(const PIT ©) = delete; // Verhindere Kopieren
|
||||||
|
|
||||||
private:
|
|
||||||
enum { time_base = 838 }; /* ns */
|
enum { time_base = 838 }; /* ns */
|
||||||
int timer_interval;
|
int timer_interval;
|
||||||
|
|
||||||
|
char indicator[4] = {'|', '/', '-', '\\'};
|
||||||
|
unsigned int indicator_pos = 0;
|
||||||
|
unsigned long last_indicator_refresh = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Zeitgeber initialisieren.
|
// Zeitgeber initialisieren.
|
||||||
PIT (int us) {
|
PIT (int us) {
|
||||||
|
|||||||
@ -32,6 +32,7 @@ extern "C" void int_disp(unsigned int slot);
|
|||||||
void int_disp(unsigned int vector) {
|
void int_disp(unsigned int vector) {
|
||||||
|
|
||||||
/* hier muss Code eingefuegt werden */
|
/* hier muss Code eingefuegt werden */
|
||||||
|
|
||||||
if (vector < 32) {
|
if (vector < 32) {
|
||||||
bs_dump(vector);
|
bs_dump(vector);
|
||||||
cpu.halt();
|
cpu.halt();
|
||||||
|
|||||||
@ -45,6 +45,7 @@ int main() {
|
|||||||
// Tastatur-Unterbrechungsroutine 'einstoepseln'
|
// Tastatur-Unterbrechungsroutine 'einstoepseln'
|
||||||
/* hier muss Code eingefuegt werden */
|
/* hier muss Code eingefuegt werden */
|
||||||
kb.plugin();
|
kb.plugin();
|
||||||
|
pit.plugin();
|
||||||
|
|
||||||
// Interrupts erlauben (Tastatur)
|
// Interrupts erlauben (Tastatur)
|
||||||
/* hier muss Code eingefuegt werden */
|
/* hier muss Code eingefuegt werden */
|
||||||
|
|||||||
Reference in New Issue
Block a user