first try for ps2, time to debug

main
Simon 6 months ago
parent 69c1afa5dc
commit 35d9c7bd48

@ -89,8 +89,11 @@ enum ControllerCommand {
*
* \param value data to be sent
*/
[[maybe_unused]] static void sendData(uint8_t value) {
// TODO: You have to implement this method
static void sendData(uint8_t value) {
if (!(ctrl_port.inb()&HAS_OUTPUT)) {
data_port.outb(value);
}
(void)value;
}
@ -106,8 +109,20 @@ void init() {
bool fetch(Key &pressed) {
// TODO: You have to implement this method
(void)pressed;
return false;
uint8_t status_reg = ctrl_port.inb();
if(status_reg & IS_MOUSE || !(status_reg & HAS_OUTPUT) )
return false; // TODO Remove mouse events from buffer
uint8_t out_buffer = data_port.inb();
pressed = key_decoder.decode(out_buffer);
if (pressed.alt() || pressed.ctrl() || pressed.shift) {
return false;
}
else
return true;
}
void setRepeatRate(Speed speed, Delay delay) {

@ -7,7 +7,7 @@
#include "arch/serial.h"
#include "device/serialstream.h"
#include "device/textstream.h"
#include "device/ps2controller.h"
TextStream kout = TextStream(0, 80, 0, 12, true);
TextStream dout[8] = {
@ -68,14 +68,23 @@ extern "C" int main() {
kout << "pointer: " << reinterpret_cast<void*>(1994473406541717165ull)
<< " -> 0x1badcafefee1dead" << endl;
kout << "smiley: " << static_cast<char>(1) << endl;
/* Start application processors
* To avoid unexpected behaviour, make sure that interrupts are not
* enabled before the APs are booted. Otherwise it might interfere with the
* Startup IPIs or even block devices like keyboard because of a missing EOI
*/
ApplicationProcessor::boot();
ApplicationProcessor::boot();
PS2Controller::init();
Key key = Key();
while (true){
if (PS2Controller::fetch(key)) {
kout << key.ascii() ;
}
}
return 0;
}
@ -86,7 +95,6 @@ extern "C" int main_ap() {
//TextWindow dout0 = TextWindow(0,20,13,19, false);
//dout0.reset();
//dout0.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::RED, false));

Loading…
Cancel
Save