View topic - Resource Manager Question

Resource Manager Question

anything that doesn't fit to other groups.

Resource Manager Question

Postby krishb » Mon Jan 05, 2004 5:53 pm

Hello,
I am writing a resource manager to communicate with a USB device.
I have two communication pipes, one for HOST to DEVICE communication and nother for DEVICE to HOST.

This resource manager has two clients {threads}, one utilizes this device as write only and other as read only. My idea here is "read only" thread should be blocked until it really got data through USB device. "Write only" should have access to write data at any time. If "read only" thread is blocked for data, "write only" thread will not be given chance to run?

Do I need to create this resource manager with multiple threads?

Thanks in advance.

Regards,
Krishb
krishb
New Member
 
Posts: 1
Joined: Mon Jan 05, 2004 5:19 pm

Postby rick » Tue Jan 06, 2004 3:12 am

First I guess a couple of questions. Are you aware there is a usb ddk for talking to usb devices and is this what you are using?

Second, although you are using the term resource manager, this has a particular meaning in QNX and I am not sure that is how you are using it. There is quite a section in the help viewer on resource managers. Generally the clients they service are the applications which use their resources, not the hardware they are talking to.

There is nothing wrong with your ideas, the description doesn't necessarily fit into our expectations. Perhaps if you describe what device you are trying to talk to and someone can give you ideason what the best approach is (in QNX) to write the driver/resource manager. :-)
rick
QNX Master
 
Posts: 500
Joined: Wed Nov 13, 2002 3:59 am

Postby guenny » Mon Jan 26, 2004 3:43 pm

Hello,
I guess I've the same problem as krishb. Perhaps I can specify it: I've writen a recouce manager like the one in 'writing a resource manager - mulithreaded RM' from qnx. I also added devctl() operations and my Interrupt handler works in his own thread. My RM is for communication directly with a Controller (sja1000 for CAN).
Wenn a read- operation is given to the RM (like cat /dev/can or by devctl()) and there's no message available, the reading thread waits by a semaphore. This semaphore is post by the interrupt handler. Evry writing to the path isn't possible now.
Wenn I look to the pidin I see 5 threads: one is waiting on SEM (this shoud be the reading thread), on waits for INTR (the interrupt handler), one for CONDVAR (i guess the writing thread) and 2 others are in RECEIVE-status. Why does the writing thread waits for a condition variable, although i didn't declaired any?? Is there a possibility to let a thread write to the device while a other thead is waiting for a semaphore?

I hope, i didn't interfered to mutch, but I guess it's the same problem like krishb's.

thanks in advance,
guenny
guenny
New Member
 
Posts: 2
Joined: Mon Jan 26, 2004 2:40 pm

Postby cdm » Mon Jan 26, 2004 4:10 pm

When your callbacks are invoked the attr for the device is locked. If you are going to block on another syncronization object and you want to allow other I/O operations to occur, you have to unlock it.

iofunc_attr_unlock()

That is the call you need to make. When you are signaled by the interrupt thread you will have to re-lock the attribute.
cdm
QNX Master
 
Posts: 789
Joined: Fri Jul 05, 2002 9:38 am

Postby guenny » Mon Jan 26, 2004 4:54 pm

thx a lot for the quick and successful answer!!!

guenny
guenny
New Member
 
Posts: 2
Joined: Mon Jan 26, 2004 2:40 pm


Return to General Programming

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests