RE: Interrupt problems

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

 



--------------------------------------------------------
This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments.  Please notify the sender immediately by reply e-mail and delete the e-mail from your system.


-----Original Message-----

From: Fawad Lateef [mailto:fawadlateef@xxxxxxxxx] 
Sent: Thursday, September 15, 2005 1:58 PM
To: Aggarwal, Vikas (OFT)
Cc: olaveth@xxxxxxxxx; kernelnewbies@xxxxxxxxxxxx
Subject: Re: Interrupt problems

Plzz do top-posting .......... 


On 9/15/05, Aggarwal, Vikas (OFT) <Vikas.Aggarwal@xxxxxxxxxxxxxxx>
wrote:
>  
> 
> QmsgSend called in ISR to insert in circular queue & QmsgWait called
in ur
> tasklet to pick(spin locked operation) from queue. 
> 
> Irqreturn_t InterruptServiceRoutine( ..............) 
> 
> { 
>    ............. 
> 
>     /*device handling */ 
>    .......... 
> 
>   QmsgSend(); 
> 
>    Return IRQ_HANDLED; 
> 
> } 
> 
>   
> #define QUEUE_DEPTH  XYZ       /* Should depend on ur device */ 
> 
> Int  queue[QUEUE_DEPTH]; 
> 
> Unsigned Q_head, Q_tail, Q_entries; 
> 
> #define QmsgSend() \ 
> 
>   If(Q_entries == QUEUE_DEPTH) \ 
> 
>       Panic(overflow); \ 
> 
>   Queue[Q_tail] =   "data from the device register"; \ 
> 
>   Q_tail = (Q_tail + 1) % QUEUE_DEPTH; \ 
> 
>   Q_entries ++; 
> 
>   Tasklet_schedule(&isr_tasklet) 
> 
>   
> 
> #define  QmsgWait(x) \ 
> 
>   Spin_lock_irqsave(&x, flags);        \ 
> 
>   If(!Q_entries){                                       \ 
> 
>           Spin_lock_irqsave(&x,flags); break;} \ 


I think the lock will be a unlock ..... spin_unlock_irqrestore
............ 
Right. Thanks for the correction!! 

> 
>   "data from device register" = queue[Q_head]; \ 
> 
>   Q_head = (Q_head + 1 ) %  QUEUE_DEPTH ;  \ 
> 
>   Q_entries --;  \ 
> 
>   Spin_unlock_irqsave(&x, flags); 
> 
>   

-- 
Fawad Lateef

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux