Loading ...
Sorry, an error occurred while loading the content.

Interrrupt handling in device Driver

Expand Messages
  • anish_iyer
    hello BLUG buddies.. ive been facing some problem with interrupt Handling for a Network Device Driver Program that im writing. The3 kernel gives a OOOPs
    Message 1 of 3 , Aug 1, 2002
    • 0 Attachment
      hello BLUG buddies..
      ive been facing some problem with interrupt Handling for a Network
      Device Driver Program that im writing. The3 kernel gives a OOOPs
      message saying Kernel Panic Not Syncing Interrupt and hangs. The code
      is for Realtek 8139 ethernet card..
      the except of the Interrupt handling code is given below...
      It would be really nice if someone could help me with the problem in
      the peice of code..



      void anich_interrupt_handler(int irq,void *dev_id,struct pt_regs
      *regs)
      {
      struct net_device *dev = (struct net_device *)(dev_id);
      struct anich_priv *temp_priv;
      struct sk_buff *temp_buff = temp_priv->anich_skbuff;
      unsigned interrupt_value;
      long ioaddr = dev->base_addr;
      if(dev==NULL) /* idf device is null the interrupt
      cant be handled so return */
      return;
      temp_priv = (struct anich_priv *) dev->priv;
      spin_lock(& temp_priv->lock); /* lock the device */

      interrupt_value = Inb(ioaddr + ANICH_ISR);
      if(interrupt_value & 0x0002) /* 2nd bit
      set indicates transmission ok*/

      {temp_buff= temp_buff->next; /* moving to
      next node when previous packet

      was recieved successfully*/
      anich_tx(temp_priv->anich_skbuff, dev);
      }

      if(interrupt_value & 0x0004) /* 3rd bit set
      indicates transmission error */
      anich_tx(temp_priv->anich_skbuff, dev);


      if(interrupt_value & 0x0001) /* 0th bit set
      indicates receive OK */

      anich_rx(dev, temp_priv->rx_packetlen,(char *) temp_priv-
      >anich_skbuff); /*????????*/
      Outb(0x00,ioaddr + ANICH_ISR);

      return;

      }

      ANICH_ISR is defined to the corresponding ioport region offset
      address as indicated by the device data sheets

      thanking you
      Anish
    • Damarugendra M
      Message 2 of 3 , Aug 2, 2002
      • 0 Attachment
        comment the following line:

        > spin_lock(& temp_priv->lock); /* lock the device */
      • Madhu Illam
        The OOPS message indicates An invalid dereferencing of a pointer has been done in the interrupt handler and the kernel panics without syncing the filesystem
        Message 3 of 3 , Aug 2, 2002
        • 0 Attachment
          The OOPS message indicates "An invalid dereferencing of a pointer has been
          done" in the interrupt handler and
          the kernel panics without syncing the filesystem buffers to the secondary
          storage. In the code, temp_buff is initialized from uninitialized pointer
          temp_priv...Could be the reason for panic..

          Madhu

          >void anich_interrupt_handler(int irq,void *dev_id,struct pt_regs
          > *regs)
          >

          > struct net_device *dev = (struct net_device *)(dev_id);
          > struct anich_priv *temp_priv;
          > struct sk_buff *temp_buff = temp_priv->anich_skbuff;



          ----- Original Message -----
          From: anish_iyer <anish_iyer@...>
          To: <linux-bangalore-programming@yahoogroups.com>
          Sent: Thursday, August 01, 2002 7:47 PM
          Subject: [blug-prog] Interrrupt handling in device Driver


          > hello BLUG buddies..
          > ive been facing some problem with interrupt Handling for a Network
          > Device Driver Program that im writing. The3 kernel gives a OOOPs
          > message saying Kernel Panic Not Syncing Interrupt and hangs. The code
          > is for Realtek 8139 ethernet card..
          > the except of the Interrupt handling code is given below...
          > It would be really nice if someone could help me with the problem in
          > the peice of code..
          >
          >
          >
          > void anich_interrupt_handler(int irq,void *dev_id,struct pt_regs
          > *regs)
          >

          > struct net_device *dev = (struct net_device *)(dev_id);
          > struct anich_priv *temp_priv;
          > struct sk_buff *temp_buff = temp_priv->anich_skbuff;
          > unsigned interrupt_value;
          > long ioaddr = dev->base_addr;
          > if(dev==NULL) /* idf device is null the interrupt
          > cant be handled so return */
          > return;
          > temp_priv = (struct anich_priv *) dev->priv;
          > spin_lock(& temp_priv->lock); /* lock the device */
          >
          > interrupt_value = Inb(ioaddr + ANICH_ISR);
          > if(interrupt_value & 0x0002) /* 2nd bit
          > set indicates transmission ok*/
          >
          > {temp_buff= temp_buff->next; /* moving to
          > next node when previous packet
          >
          > was recieved successfully*/
          > anich_tx(temp_priv->anich_skbuff, dev);
          > }
          >
          > if(interrupt_value & 0x0004) /* 3rd bit set
          > indicates transmission error */
          > anich_tx(temp_priv->anich_skbuff, dev);
          >
          >
          > if(interrupt_value & 0x0001) /* 0th bit set
          > indicates receive OK */
          >
          > anich_rx(dev, temp_priv->rx_packetlen,(char *) temp_priv-
          > >anich_skbuff); /*????????*/
          > Outb(0x00,ioaddr + ANICH_ISR);
          >
          > return;
          >
          > }
          >
          > ANICH_ISR is defined to the corresponding ioport region offset
          > address as indicated by the device data sheets
          >
          > thanking you
          > Anish
          >
          >
          >
          >
          >
          >
          > ---------------------------------------------------------------
          > This is the programming list of the Bangalore Linux Users Group
          > ---------------------------------------------------------------
          > Go to http://linux-bangalore.org for more information
          > about us, as well as our other mailing lists
          >
          > Before you post to this list, please read
          > http://linux-bangalore.org/articles/smart-questions.php
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.