first try for ps2, time to debug
This commit is contained in:
@@ -89,8 +89,11 @@ enum ControllerCommand {
|
|||||||
*
|
*
|
||||||
* \param value data to be sent
|
* \param value data to be sent
|
||||||
*/
|
*/
|
||||||
[[maybe_unused]] static void sendData(uint8_t value) {
|
static void sendData(uint8_t value) {
|
||||||
// TODO: You have to implement this method
|
|
||||||
|
if (!(ctrl_port.inb()&HAS_OUTPUT)) {
|
||||||
|
data_port.outb(value);
|
||||||
|
}
|
||||||
(void)value;
|
(void)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,8 +109,20 @@ void init() {
|
|||||||
|
|
||||||
bool fetch(Key &pressed) {
|
bool fetch(Key &pressed) {
|
||||||
// TODO: You have to implement this method
|
// TODO: You have to implement this method
|
||||||
(void)pressed;
|
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;
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRepeatRate(Speed speed, Delay delay) {
|
void setRepeatRate(Speed speed, Delay delay) {
|
||||||
|
|||||||
12
main.cc
12
main.cc
@@ -7,7 +7,7 @@
|
|||||||
#include "arch/serial.h"
|
#include "arch/serial.h"
|
||||||
#include "device/serialstream.h"
|
#include "device/serialstream.h"
|
||||||
#include "device/textstream.h"
|
#include "device/textstream.h"
|
||||||
|
#include "device/ps2controller.h"
|
||||||
TextStream kout = TextStream(0, 80, 0, 12, true);
|
TextStream kout = TextStream(0, 80, 0, 12, true);
|
||||||
|
|
||||||
TextStream dout[8] = {
|
TextStream dout[8] = {
|
||||||
@@ -74,8 +74,17 @@ extern "C" int main() {
|
|||||||
* enabled before the APs are booted. Otherwise it might interfere with the
|
* 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
|
* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +95,6 @@ extern "C" int main_ap() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TextWindow dout0 = TextWindow(0,20,13,19, false);
|
//TextWindow dout0 = TextWindow(0,20,13,19, false);
|
||||||
//dout0.reset();
|
//dout0.reset();
|
||||||
//dout0.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::RED, false));
|
//dout0.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::RED, false));
|
||||||
|
|||||||
Reference in New Issue
Block a user