X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=main.c;h=dcc2f19b3bdbae5deb1669ecdc9a8e8eb75b6796;hb=505298a9ae4bdce58a448aea253f7bf24b069406;hp=bbb7d39c9c81b72da7091708cbcdac569cb1a92f;hpb=3666a86b4f779f93a780c76a926b4eb46951da00;p=ppcskel.git diff --git a/main.c b/main.c index bbb7d39..dcc2f19 100644 --- a/main.c +++ b/main.c @@ -26,6 +26,8 @@ Copyright (C) 2009 John Kelley #include "console.h" #include "irq.h" #include "usb/core/core.h" +#include "usb/drivers/class/hid.h" +#include "hollywood.h" #define MINIMUM_MINI_VERSION 0x00010001 @@ -87,7 +89,10 @@ int main(void) irq_initialize(); irq_bw_enable(BW_PI_IRQ_RESET); irq_bw_enable(BW_PI_IRQ_HW); //hollywood pic + /* external ohci */ irq_hw_enable(IRQ_OHCI0); + /* internal ohci */ + //irq_hw_enable(IRQ_OHCI1); ipc_initialize(); ipc_slowping(); @@ -100,8 +105,6 @@ int main(void) VIDEO_SetFrameBuffer(get_xfb()); VISetupEncoder(); - usb_init(); - u32 version = ipc_getvers(); u16 mini_version_major = version >> 16 & 0xFFFF; u16 mini_version_minor = version & 0xFFFF; @@ -115,17 +118,48 @@ int main(void) ; // better ideas welcome! } - /* - print_str_noscroll(112, 112, "ohai, world!\n"); - testOTP(); - printf("bye, world!\n"); - */ + /* external ohci */ + usb_init(OHCI0_REG_BASE); + + /* internal ohci */ + //usb_init(OHCI1_REG_BASE); + + /* load HID keyboard driver */ + usb_hidkb_init(); + + /* you are welcome to make this nice :) */ + char str[7]; + u16 i, j, y=20, x=20; + struct kbrep *k; while(1) { - // just to get sure we are still in this loop - //_CPU_ISR_Enable() // don't know why this is needed... - //udelay(100000); - //printf("x"); + memset(str, '\0', 8); + j=0; + k = usb_hidkb_getChars(); + for(i=0; k->keys[i]>0; i++) { + if(x>650) { + x = 20; + y += 15; + } + if(y>440) { + y=20; + } + if((k->keys[i] >= 4) && k->keys[i] <= 4+'z'-'a') { + str[j] = k->keys[i] - 4 + 'a'; + } + else if (k->keys[i] == 0x28) { + y += 15; + x = 20; + } + j++; + } + if(j > 0) { + print_str_noscroll(x, y, str); + printf("y: %d\n", y); + } + while(j--) { + x += 13; + } } return 0;