summaryrefslogtreecommitdiff
path: root/driver/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/keyboard.c')
-rw-r--r--driver/keyboard.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/driver/keyboard.c b/driver/keyboard.c
index 90a18c9..d6ce465 100644
--- a/driver/keyboard.c
+++ b/driver/keyboard.c
@@ -3,6 +3,7 @@
#include "syscalls.h"
#include "log.h"
#include "e1000.h"
+#include "kmalloc.h"
#include <stdbool.h>
@@ -14,20 +15,41 @@ static bool capslock=false;
static uint32_t kb_stream;
static char num_syms[]={')','!','@','#','$','%','^','&','*','('};
+int hex_to_dec(char c)
+{
+ if(c>='0'&&c<='9')return c-'0';
+ return c+10-'a';
+
+}
static void put(uint8_t c)
{
- uint16_t dat[]={
- 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x52,0x5,0x50a,0x00,0x02,0x02,0x08,0x06,0x00,
- 0x01,0x08,0x00,0x06,0x04,0x00,0x01,0x52,0x5,0x50a,0x00,0x02,0x02,0x0a,0x00,0x02,
- 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x52,0x5,0x50a,0x00,0x02,0x02,0x08,0x06,0x00,
- 0x01,0x08,0x00,0x06,0x04,0x00,0x01,0x52,0x5,0x50a,0x00,0x02,0x02,0x0a,0x00,0x02
- };
-
- if(c=='p')e1000_sendPacket(dat,64); // packet
- if(c=='s')e1000_init(0); // start
- if(c=='i')e1000_irq(11); // interrupt
- if(c=='u')e1000_linkup(); // up
- if(c=='d')e1000_linkdown(); // down
+ /*
+0000 8a b1 aa 7e 4d 00 52 54 00 12 34 56 08 00 45 00
+0010 00 54 1e c0 00 00 40 01 da 1f c0 a8 00 14 c0 a8
+0020 00 65 00 00 ce 07 1f 02 03 b0 bf 79 a9 5b 00 00
+0030 00 00 df 9d 08 00 00 00 00 00 10 11 12 13 14 15
+0040 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
+0050 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35
+0060 36 37
+*/
+
+ static char data_raw[]="8ab1aa7e4d005254001234560800450000541ec000004001da1fc0a80014c0a800650000ce071f0203b0bf79a95b00000000df9d080000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637";
+ static uint8_t data[256];//=kballoc(1);
+ int i=0;
+
+ while(data_raw[i]!=0)
+ {
+ uint8_t val=hex_to_dec(data_raw[i])*16+hex_to_dec(data_raw[i+1]);
+ data[i/2]=val;
+ i+=2;
+ }
+
+
+ if(c=='p')e1000_sendPacket(data,i/2); // packet
+// if(c=='s')e1000_init(0); // start
+ // if(c=='i')e1000_irq(11); // interrupt
+ // if(c=='u')e1000_linkup(); // up
+ //if(c=='d')e1000_linkdown(); // down
syscall_generic(SYSCALL_WRITE,kb_stream, (char *)&c , 1, 0);
}