This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GateMP which uses Sempahore

Other Parts Discussed in Thread: TMS320DM8148

Hi,

I am using GateMP with local and remote protection enabled. The problem is that GateMP is based on mutex, so only 1 can enter the gate.

How can I change GateMP to be semaphore based (allows N enters)?

I am using bios_6_32_05_54 and ipc_1_23_05_40 on target TMS320DM8148.

  • Hi Yousf,

    Gates, by definition, are to provide mutual exclusion. Any gate (GateMP, GateSemaphore, GateHwi, etc.) only allow 1 entity to be entered into the gate. They are not designed to provide resource management of N items.

    If you need this, you need to write your own module. I expect it would have a counter in shared memory. You'd use GateMP to protect the reading and writing of that counter.

    Todd 

  • I will try this shared memory sempahore.

    But  does the current GateMP provides a function similar to (It checked the doxygen documentation and there is nothing like this):

    bool isGateEntered();

    ?

    So if a gate was entered by someone else, I would do something else and try it later.

  • No, there is not isGateEntered function. Once a gate is entered, it should perform its actions as fast as possible and leave. We did not do a isGateEntered type function for the following reasons

    1. The time should be short that someone is in the gate

    2. For some gates, you can only tell if the gate is in use by trying to get the gate (e.g. certain HW IPC mechanisms)

    3. If the isGateEntered returns FALSE, you could still be blocked out when you call enter because someone else entered in between your isGateEntered and Enter calls.

    If you do the shared memory approach to implement a semaphore, remember to be careful with cache coherency and alignment.