Trouble porting linux driver to DDE Kit

Sebastian Sumpf Sebastian.Sumpf at ...1...
Wed Oct 24 10:36:16 CEST 2012


Hi Alexander,

On 10/23/2012 12:16 PM, Alexander Tarasikov wrote:

> Another interesting thing I've noticed is that if we disable LX_VERBOSE_DEBUG,
> usb fails to work at all due to timeouts. Turns out, some functions that
> are called around endpoint setup at gadget registration, cause usb to break
> if we disable debugging. The weird thing is that if we insert an mdelay or 
> a printk, it still does not work, but if the dde_kit_printf is used with color escape
> sequences, that makes it work.


This may have something to do with
https://github.com/genodelabs/genode/issues/332 which is still not
completely fixed, there is a race between the interrupt thread creation
in dde-kit and the driver. Can you try if the attached patch changes
anything?

Greeting,

Sebastian



-- 
Sebastian Sumpf
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth



-------------- next part --------------
diff --git a/os/src/lib/dde_kit/interrupt.cc b/os/src/lib/dde_kit/interrupt.cc
index b36f2e4..18fa5aa 100644
--- a/os/src/lib/dde_kit/interrupt.cc
+++ b/os/src/lib/dde_kit/interrupt.cc
@@ -68,8 +68,13 @@ class Irq_handler : Dde_kit::Thread, public Avl_node<Irq_handler>
 		:
 			Dde_kit::Thread(_compose_thread_name(irq)), _irq_number(irq),
 			_irq(irq), _handler(handler), _init(init), _priv(priv),
-			_shared(shared), _handle_irq(1)
-		{ start(); }
+			_shared(shared), _handle_irq(1), _lock(Lock::LOCKED)
+		{
+			start();
+
+			/* wait until thread is started */
+			Lock::Guard guard(_lock);
+		}
 
 		/** Enable IRQ handling */
 		void enable()
@@ -93,6 +98,9 @@ class Irq_handler : Dde_kit::Thread, public Avl_node<Irq_handler>
 			/* call user init function before doing anything else here */
 			if (_init) _init(_priv);
 
+			/* unblock creating thread */
+			_lock.unlock();
+
 			while (1) {
 				_irq.wait_for_irq();
 


More information about the users mailing list