Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Problem with IRQs. Linux freezing.

Hello i've made a design consisting of a CPU, SDRAM, PHY and etc.

Then i made a character device driver to recieve IRQs from a VHDL block i've made, my VHDL block generates a high signal at a 60hz frequency.

However my Linux freezes after a certain time (like 1minute), why is that?

If i comment the line in my device driver that register the IRQ everything works fine and the linux never freezes!

My device driver implementation is the follow:

Read function:

ssize_t shmem_read(struct file *filep ,char *buff, size_t count, loff_t *offp)
{
  int retval;
  int temp = 0;
  interruptible_sleep_on(&readw);
  retval = copy_to_user(buff, &current_cycle, sizeof(raw_cycle_t));
  if (retval != 0) {
    printk(KERN_ERR "Kernel to userspace copy failed!\n" );
    return retval;
  }
  return count;
}

IRQ handler


static irqreturn_t io_irq_handler(int irq, void *dev_id)
{
  wake_up_interruptible(&readw);
  outl(0xf, &pio_in->np_pioedgecapture);
  return IRQ_HANDLED;
}

INIT_IRQ


 /* IRQ PIO INPUT INIT */
  io_irq = PIO_IRQ;
  enable_irq(io_irq);
  ret = request_irq(io_irq, &io_irq_handler, 0, DRIVER_NAME, &io_irq);
  if (ret) {
    printk(KERN_ERR __FILE__ ": Error while requesting IRQ, during %s\n", __FUNCTION__);
    return ret;
  }

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I guess i was having a deadlock.. when i run it with realtime process priority i have no problems.

    EDIT:

    NVM just had the same problem after a longer time..