#define KBD_BUFFER_LEN 0x20 /* size of the keyboardbuffer */
+#ifdef CONFIG_MPC5xxx
+int ps2ser_check(void);
+#endif
+
static volatile char kbd_buffer[KBD_BUFFER_LEN];
static volatile int in_pointer = 0;
static volatile int out_pointer = 0;
/* test if a character is in the queue */
static int kbd_testc(void)
{
+#ifdef CONFIG_MPC5xxx
+ /* no ISR is used, so received chars must be polled */
+ ps2ser_check();
+#endif
if(in_pointer==out_pointer)
return(0); /* no data */
else
static int kbd_getc(void)
{
char c;
- while(in_pointer==out_pointer);
+ while(in_pointer==out_pointer) {
+#ifdef CONFIG_MPC5xxx
+ /* no ISR is used, so received chars must be polled */
+ ps2ser_check();
+#endif
+ ;}
if((out_pointer+1)==KBD_BUFFER_LEN)
out_pointer=0;
else
case 0xBA: /* caps lock released */
return; /* just swallow */
}
+#if 1
if((scancode&0x80)==0x80) /* key released */
return;
+#else
+ if((scancode&0x80)==0x00) /* key pressed */
+ return;
+ scancode &= ~0x80;
+#endif
/* now, decide which table we need */
if(scancode > (sizeof(kbd_plain_xlate)/sizeof(kbd_plain_xlate[0]))) { /* scancode not in list */
PRINTF("unkown scancode %X\n",scancode);
#ifdef CFG_CONSOLE_OVERWRITE_ROUTINE
extern int overwrite_console (void);
+#define OVERWRITE_CONSOLE overwrite_console ()
#else
-int overwrite_console (void)
-{
- return (0);
-}
-#endif
+#define OVERWRITE_CONSOLE 0
+#endif /* CFG_CONSOLE_OVERWRITE_ROUTINE */
int kbd_init (void)
{
/* check if this is the standard input device */
if(strcmp(stdinname,DEVNAME)==0) {
/* reassign the console */
- if(overwrite_console()) {
+ if(OVERWRITE_CONSOLE) {
return 1;
}
error=console_assign(stdin,DEVNAME);