Part Number: TMS320C6654
Hi Team,
My customer is transitioning from using the C28 in their older model to C66 now.
They used to use the Read-Modify-Write (RMW) macro as below, and want to use it in the C66.
#define BIT_ON(m_data,bit_pos) ((m_data) |= (1 << bit_pos)) #define BIT_OFF(m_data,bit_pos) ((m_data) &= (~(1 << bit_pos))) #define BIT_ORM(m_data,bit_dat) ((m_data) |= (bit_dat)) #define BIT_ANDM(m_data,bit_dat) ((m_data) &= ~(bit_dat))
However, they believe that the C28 was able to execute the above macros in one command, whereas with the C66 it requires a load, execute, and store (3 commands) and therefore is not atomic anymore.
It seems that in the C28, AND and OR operations directly accessed memory. However with the C66, it is not the same.
It also says in the TMS320C6000 Optimizing Compiler v8.2.x User's Guide (Rev. B), p150 that during RMW, they cannot guarantee locks as below.
'It is not guaranteed that the memory system will lock that memory location for the duration of the instruction'
They want to confirm two things:
- Is their current understanding (above) correct?
- It says in the document above that to execute RMW instructions from multiple interrupt levels to the same global memory, locks should be used. However, if you lock memory, which is a low-priority interrupt, and then try to access the same memory with a high-priority interrupt that occurred before the lock release, the lock is not released, no matter how long you wait. Is there a typical good way to implement locks? Or is there a solution other than locking? (They believe there is a solution, such as a combination of allowing and not allowing interrupts, or there is an implementation that does not do RMW into the same memory in the first place.)
Best regards,
Mari Tsunoda