summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-01 21:46:10 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-01 21:46:10 +0200
commit32db109e61f7e67c85907f36d00518d662238087 (patch)
treed0e83e50368dfcbcbcc3859843854bdc1b5bef67
parentf15da5019906117605d60846b47b5740b10678dd (diff)
downloadabaos-32db109e61f7e67c85907f36d00518d662238087.tar.gz
abaos-32db109e61f7e67c85907f36d00518d662238087.tar.bz2
reading scancodes from keyboard, no proper PS/2 initialization yet
printing 'M' for main thread, 'T' for timer event, 'KBD 0xXX' for keyboard events, making the functions quite transparent
-rw-r--r--src/interrupts.c6
-rw-r--r--src/kernel.c57
-rw-r--r--src/keyboard.c10
3 files changed, 42 insertions, 31 deletions
diff --git a/src/interrupts.c b/src/interrupts.c
index 9d4caf7..2334f47 100644
--- a/src/interrupts.c
+++ b/src/interrupts.c
@@ -174,11 +174,11 @@ uint32_t interrupts_exception_division_by_zero( interrupt_handler_t *handler, ui
return esp;
}
-static int pit_counter = 0;
uint32_t interrupts_interrupt_PIT( interrupt_handler_t *handler, uint32_t esp )
{
- pit_counter++;
- printf( "PIT PIT PIT PIT PIT PIT PIT %d", pit_counter );
+ // for now do noting with the timer tick
+ printf( "T" );
+
return esp;
}
diff --git a/src/kernel.c b/src/kernel.c
index ccaf911..732151e 100644
--- a/src/kernel.c
+++ b/src/kernel.c
@@ -56,35 +56,44 @@ void entry( void )
console_put_string( &console, "Running.." );
- const char bar[] = "\\|/-";
- int y_pos = vga_get_cursor_y( &vga );
- int x_pos = vga_get_cursor_x( &vga );
- int i = 0;
- for( i = 0; i < 100000; i++ ) {
- if( i % 1000 == 1 ) {
- vga_put_char_at( &vga, x_pos, y_pos, '.' );
- x_pos++;
- if( x_pos > vga.res_x ) {
- x_pos = 0;
- y_pos++;
- if( y_pos > vga.res_y ) {
- y_pos = 0;
- }
- }
-// serial_put_char( &serial, '.' );
+ // endless loop doing nothing, later we have to get events
+ // here from queues and for instance print characters received
+ // from the keyboard to stdout
+ for( int i = 0; i < 1000000000; i++ ) {
+ if( i % 10000000 == 1 ) {
+ printf( "M" );
+ }
+ }
+
+ //~ const char bar[] = "\\|/-";
+ //~ int y_pos = vga_get_cursor_y( &vga );
+ //~ int x_pos = vga_get_cursor_x( &vga );
+ //~ int i = 0;
+ //~ for( i = 0; i < 100000; i++ ) {
+ //~ if( i % 1000 == 1 ) {
+ //~ vga_put_char_at( &vga, x_pos, y_pos, '.' );
+ //~ x_pos++;
+ //~ if( x_pos > vga.res_x ) {
+ //~ x_pos = 0;
+ //~ y_pos++;
+ //~ if( y_pos > vga.res_y ) {
+ //~ y_pos = 0;
+ //~ }
+ //~ }
+//~ // serial_put_char( &serial, '.' );
//~ int y = 0;
//~ int x = 12 / y;
//~ printf( "Hex number is 0x%X and string is '%s'\n", x, "abaos" );
- }
- vga_put_char_at( &vga, x_pos, y_pos, bar[i%4] );
- for( int j = 0; j < 1500; j++ ) {
- }
- }
- vga_put_char_at( &vga, x_pos, y_pos, '.' );
-// serial_put_char( &serial, '.' );
+ //~ }
+ //~ vga_put_char_at( &vga, x_pos, y_pos, bar[i%4] );
+ //~ for( int j = 0; j < 1500; j++ ) {
+ //~ }
+ //~ }
+ //~ vga_put_char_at( &vga, x_pos, y_pos, '.' );
+//~ // serial_put_char( &serial, '.' );
- console_put_newline( &console );
+ //~ console_put_newline( &console );
TERMINATE:
puts( "Terminating" );
diff --git a/src/keyboard.c b/src/keyboard.c
index d06d594..f89332c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5,16 +5,18 @@
void keyboard_init( keyboard_t *keyboard )
{
memset( keyboard, 0, sizeof( keyboard_t ) );
+
+ port8_init( &keyboard->command_port, 0x64 );
+ port8_init( &keyboard->data_port, 0x60 );
+
}
uint32_t keyboard_handle_interrupt( interrupt_handler_t *handler, uint32_t esp )
{
keyboard_t *keyboard = (keyboard_t *)handler->driver;
- printf( "KBD KBD KBD KBD KBD KBD KBD 0x%X\n", keyboard );
+ uint8_t key = port8_read( &keyboard->data_port );
+ printf( "KBD 0x%X ", key );
-int y = 0;
-int x = 12 / y;
-printf( "Hex number is 0x%X and string is '%s'\n", x, "abaos" );
return esp;
}