#define KBD_BUFFER_LEN 0x20 /* size of the keyboardbuffer */
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC85xx)
+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)
{
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC85xx)
+ /* 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) {
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC85xx)
+ /* 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 0
+#if 1
if((scancode&0x80)==0x80) /* key released */
return;
#else
#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);