mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Support specific EOIs.
This commit is contained in:
parent
d523242e08
commit
0c98a78bb5
@ -75,9 +75,21 @@ class PIC {
|
|||||||
|
|
||||||
// b7, b6, b5: EOI type.
|
// b7, b6, b5: EOI type.
|
||||||
// b2, b1, b0: interrupt level to acknowledge.
|
// b2, b1, b0: interrupt level to acknowledge.
|
||||||
if((value >> 5) == 0b001) {
|
switch(value >> 5) {
|
||||||
// Non-specific EOI.
|
default:
|
||||||
|
printf("PIC: TODO EOI type %d\n", value >> 5);
|
||||||
|
case 0b010: // No-op.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0b001: // Non-specific EOI.
|
||||||
awaiting_eoi_ = false;
|
awaiting_eoi_ = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0b011: { // Specific EOI.
|
||||||
|
if((value & 3) == eoi_target_) {
|
||||||
|
awaiting_eoi_ = false;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,7 +105,7 @@ class PIC {
|
|||||||
|
|
||||||
template <int input>
|
template <int input>
|
||||||
void apply_edge(bool final_level) {
|
void apply_edge(bool final_level) {
|
||||||
const uint8_t input_mask = 1 << input;
|
constexpr uint8_t input_mask = 1 << input;
|
||||||
|
|
||||||
// Guess: level triggered means the request can be forwarded only so long as the
|
// Guess: level triggered means the request can be forwarded only so long as the
|
||||||
// relevant input is actually high. Whereas edge triggered implies capturing state.
|
// relevant input is actually high. Whereas edge triggered implies capturing state.
|
||||||
@ -111,8 +123,6 @@ class PIC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int acknowledge() {
|
int acknowledge() {
|
||||||
awaiting_eoi_ = true;
|
|
||||||
|
|
||||||
in_service_ = 0x01;
|
in_service_ = 0x01;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
while(!(in_service_ & requests_) && in_service_) {
|
while(!(in_service_ & requests_) && in_service_) {
|
||||||
@ -121,6 +131,8 @@ class PIC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(in_service_) {
|
if(in_service_) {
|
||||||
|
eoi_target_ = id;
|
||||||
|
awaiting_eoi_ = true;
|
||||||
requests_ &= ~in_service_;
|
requests_ &= ~in_service_;
|
||||||
return vector_base_ + id;
|
return vector_base_ + id;
|
||||||
}
|
}
|
||||||
@ -138,6 +150,7 @@ class PIC {
|
|||||||
uint8_t vector_base_ = 0;
|
uint8_t vector_base_ = 0;
|
||||||
uint8_t mask_ = 0;
|
uint8_t mask_ = 0;
|
||||||
bool awaiting_eoi_ = false;
|
bool awaiting_eoi_ = false;
|
||||||
|
int eoi_target_ = 0;
|
||||||
|
|
||||||
uint8_t requests_ = 0;
|
uint8_t requests_ = 0;
|
||||||
uint8_t in_service_ = 0;
|
uint8_t in_service_ = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user