[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] keyboard




hi,

The code for the keyboard driver is

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tqueue.h>
#include <linux/init.h>
#include <linux/kbd_kern.h>
#include <asm/irq.h>
#include <asm/io.h>

#ifdef CONFIG_MICROBLAZE
#include <asm/mbvanilla.h>
#include <asm/microblaze_gpio.h>
#include <asm/xparameters.h>
#endif
static void got_char(void *scancode)
{
printk("Scan Code %x %s.\n",
            (int) *((char *) scancode) & 0x7F,
              *((char *) scancode) & 0x80 ? "Released" : "Pressed");
}
void ps2irq_handler(int irq, void *dev_id, struct pt_regs *regs)
{

   static unsigned char scancode;
   static struct tq_struct task = {NULL, 0, got_char, &scancode};
   unsigned char status;

   microblaze_gpio_write(MICROBLAZE_GPIO_BASE_ADDR,0x06);
   microblaze_gpio_write(MICROBLAZE_GPIO_BASE_ADDR,0x00);
   microblaze_gpio_write(MICROBLAZE_GPIO_BASE_ADDR,0x06);

   /* Read keyboard status */
   status = inb(XPAR_MY_PS2_BASEADDR+0x08);
   scancode = inb(XPAR_MY_PS2_BASEADDR+0x00);

   /* Schedule bottom half to run */
   queue_task(&task, &tq_immediate);
   mark_bh(IMMEDIATE_BH);
}


int __init ps2kbd_init(void)
{
        int irq;
        irq = request_irq (4, ps2irq_handler, SA_INTERRUPT, "keyboard", NULL);
        if (irq)
                printk("Keyboard irq not registered.  Error: %d\n", irq);
        printk("keyboard initialised on IRQ 4 successfully\n");
        return 0;
}

This is the code I added in linux-2.4.x/arch/microblaze/kernel.What's wrong with the code.Why I am not getting print statement.But my code is getting compiled. 

In the linux-2.4.x/drivers/char/keyboard.c they used pm_register instead of register_chrdev.
What makes the difference.

Thanks in advance.

Regards
devi


___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/