From: "Terry Fryar" Date: Thu, 5 Jan 2012 16:12:15 -0600 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000C_01CCCBC4.CC0DB260" Subject: [Xenomai-help] RTDM and spi List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org This is a multi-part message in MIME format. ------=_NextPart_000_000C_01CCCBC4.CC0DB260 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Using the RTDM api with Xen 2.6 to develop a linux driver. =20 =20 Basically have an ISR registered using rtdm_irq_request() that is = triggered from a gpio pin. ISR works fine. Inside ISR, the only thing done is a rtdm_event_signal() on an event. =20 Then, I have a task created using rtdm_task_init() that is waiting on = the event using rtdm_event_timedwait(). =20 So far, so good...all works. But, in the task I am making an SPI call = after the event is signaled using spi_message_add_tail() and spi_sync() and = that's where I get this: =20 BUG: sleeping function called from invalid context at kernel/mutex.c:278 [ 98.449178] in_atomic(): 1, irqs_disabled(): 0, pid: -555875760, = name: v=FF=FF=FD=FF=BF=B7=BD=FF=A7=FF=FF=F5>=FF=FF=FDw=BF@=DE=DEP=DE=DE [ 98.458686] INFO: lockdep is turned off. [ 98.462811] [] (unwind_backtrace+0x0/0xe0) from = [] (mutex_lock_nested+0x24/0x384) [ 98.472501] [] (mutex_lock_nested+0x24/0x384) from = [] (__spi_sync+0x88/0xd8) [ 98.481730] [] (__spi_sync+0x88/0xd8) from [] (irqdrv_task+0x44/0xd4 [irqdrv]) [ 98.491149] [] (irqdrv_task+0x44/0xd4 [irqdrv]) from [] (xnarch_thread_trampoline+0x20/0x2c) [ 98.501845] [] (xnarch_thread_trampoline+0x20/0x2c) from [] (__xnpod_schedule+0x5cc/0xa54) [ 98.512355] [] (__xnpod_schedule+0x5cc/0xa54) from = [] (0xfff7febf) [ 98.520674] Xenomai: suspending kernel thread bf008180 ('irqdrvTask') = at 0xc00a92f8 after exception #0x0 I have tried this inside a kthread and it works fine. I can also try = the spi stuff without being triggered by an IRQ, and I get the same error. = I know this is something simple??? ------=_NextPart_000_000C_01CCCBC4.CC0DB260 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Using = the RTDM api=20 with Xen 2.6 to develop a linux driver. 
 
Basically have an=20 ISR registered using rtdm_irq_request() that is = triggered from a gpio=20 pin.  ISR works fine.  Inside ISR, the only thing done is a = rtdm_event_signal() on an=20 event.
 
Then, I have a task created using rtdm_task_init() that is = waiting on the=20 event using rtdm_event_timedwait().
 
So far, so good...all works.  But, in = the task I=20 am making an SPI call after the event is signaled using = spi_message_add_tail()=20 and spi_sync() and that's where I get this:
 
BUG: = sleeping=20 function called from invalid context at = kernel/mutex.c:278
[  =20 98.449178] in_atomic(): 1, irqs_disabled(): 0, pid: -555875760, name:=20 v=FF=FF=FD=FF=BF=B7=BD=FF=A7=FF=FF=F5>=FF=FF=FDw=BF@=DE=DEP=DE=DE
[=    98.458686] INFO: lockdep is turned=20 off.
[   98.462811] [<c00572ac>] = (unwind_backtrace+0x0/0xe0)=20 from [<c04639bc>] (mutex_lock_nested+0x24/0x384)
[  =20 98.472501] [<c04639bc>] (mutex_lock_nested+0x24/0x384) from=20 [<c033ca48>] (__spi_sync+0x88/0xd8)
[   98.481730]=20 [<c033ca48>] (__spi_sync+0x88/0xd8) from [<bf007180>]=20 (irqdrv_task+0x44/0xd4 [irqdrv])
[   98.491149] = [<bf007180>]=20 (irqdrv_task+0x44/0xd4 [irqdrv]) from [<c00e93d0>]=20 (xnarch_thread_trampoline+0x20/0x2c)
[   98.501845]=20 [<c00e93d0>] (xnarch_thread_trampoline+0x20/0x2c) from = [<c00e5adc>]=20 (__xnpod_schedule+0x5cc/0xa54)
[   98.512355] = [<c00e5adc>]=20 (__xnpod_schedule+0x5cc/0xa54) from [<fff7febf>]=20 (0xfff7febf)
[   98.520674] Xenomai: suspending kernel = thread=20 bf008180 ('irqdrvTask') at 0xc00a92f8 after exception=20 #0x0
I have = tried this=20 inside a kthread and it works fine.  I can also try the spi stuff = without=20 being triggered by an IRQ, and I get the same error.  I know this = is=20 something simple???
------=_NextPart_000_000C_01CCCBC4.CC0DB260--