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.

EALLOW resource locking

In C2000, certain registers are protected by EALLOW.  Doesn't code that uses EALLOW require resource locking?  If there is no resource locking, it seems like EALLOW-protected register writes could fail in the following scenario where there are two threads that each perform EALLOW, EALLOW-protected register write, then EDIS, but are ordered as follow:

1) thread 1 EALLOW

2) thread 2 EALLOW,

3) thread 2 EALLOW-protected register write

4) thread 2 EDIS

5) thread 1 EALLOW-protected register write

6) thread 1 EDIS would cause the thread 1 EALLOW-protected register write to fail.

In this scenario, #5 thread 1 EALLOW-protected register write would fail because EALLOW was disabled by #4 thread 2 EDIS.  Resource locking would prevent this scenario.  However, I have not encountered EALLOW resource locking in sample/library code or mentioned in documentation.

-Joseph

  • Hi Joseph,

    We do not have multiple thread running on CPU. Are you seeing any issue like this?

    Regards,
    Vivek Singh
  • Hi Vivek,

    Vivek Singh said:
    We do not have multiple thread running on CPU.

    Perhaps "thread" was the wrong term to use and "context" is better as I was thinking of an interrupt could switch the context from non-interrupt code.  However, after further reading, the TMS320C28x CPU and Instruction Set Reference Guide spru430f pg. 42 states that EALLOW is saved before servicing the interrupt, then restored after servicing.

    Vivek Singh said:
    Are you seeing any issue like this?

    I am seeing the opposite of this case, where a EALLOW-protected register is successfully written to when EALLOW was not enabled which I posted about here.  I'm assuming that the cause is that another thread enabled EALLOW.  Since EALLOW is saved/restored for interrupt, perhaps this is a TI-RTOS issue?  I wasn't sure if other processors supported by TI-RTOS had EALLOW, so I thought it might be C2000 specific.

    Best Regards,

    Joseph

  • Joseph,

    I saw the other post. I think it works after debugger reset because in CCS Gel file we have a function CLA_Clock_Enable() which enables the CLA clock and this function is called every time there is debug reset. This would not work for watchdog reset though because in that case this function is not called and your code did not have EALLOW enabled.

    Hope this helps.

    Regards,

    Vivek Singh
  • Thanks Vivek,

    That makes sense.

    Best Regards,
    Joseph