Re: CE6 porting a CE5 BSP - SC_CreateMutex



Correct me if I am wrong but I thought critical section objects will
only work for different threads in one process.
If I want to access the resource (the i2c device) from a driver and the
OAL surely these will be running in processes?
Nope, the OAL code is in the kernel process so you can use a critical
section in the OAL just fine. You don't need a Mutex in the OAL. The biggest
reason people tried using them before, other than misunderstanding it wasn't
needed, was to have the OAL and a FULL driver access the same physical
device (often i2c controllers) directly. Thus they synchronized the access
via a mutex and nothing else in common. The thinking generally goes that
it's more "efficient" to do it that way since you aren't calling into the
OAL from your driver to do anything with the bus. Trouble is, that's not
really valid, as the Mutex synch calls cause a transition into the kernel,
just like calling the OAL so in the end there is, at best, no difference and
at worst worse performance because you may acquire and release the mutex
multiple times in the process of moving data out. Putting all the bus code
into the OAL you actually only get the hit once.


--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com


.



Relevant Pages

  • Re: [PATCH RFD] alternative kobject release wait mechanism
    ... The next idea is that a driver needs to synchronize its removemethod ... the suspend() method needs to block while readis running. ... First of all I think that I would merge pm and unbind mutex into one - ... thereby preventing autosuspend. ...
    (Linux-Kernel)
  • Re: Fwd: Removing Giant from a driver
    ... pass that mutex instead of Giant... ... I doubt this driver is using a fast interrupt handler... ... A fast interrupt handler doesn't context switch, ... don't understand what Giant is good for. ...
    (freebsd-hackers)
  • Re: Fwd: Removing Giant from a driver
    ... pass that mutex instead of Giant... ... I doubt this driver is using a fast interrupt handler... ... - hauppauge firmware is needed ...
    (freebsd-hackers)
  • RE: Mutex
    ... "mirage2k2" wrote: ... I normally wait on event objects - the signaled state is changed using ... I have also used fast mutex, they are easy you just call ... I try to use Mutex in my driver program and it does not work as i expect. ...
    (microsoft.public.development.device.drivers)
  • Re: Puzzled about the use of static var/function in C++
    ... I'm safeguarding my driver against multi- ... Since I want the mutex to be initialised only once and also that all ... definition doesn't actually declare the static members. ... actually declaring the variable's storage. ...
    (comp.programming.threads)