Page 1 of 1

Cyclic timers

PostPosted: Mon Aug 26, 2002 1:48 am
by aek
Hello.

quote:
If OSCALL_OSSIGNALEVENT is configured as OSFROM_ANYWHERE in a source build which is using event flags and message queues, do OSProtect/OSUnprotect need to be applied only to only OSSetEFlag? I.e., is OSReadEFlag safe without protect calls?
The short answer is all services that can be called from the foreground / ISR level must be protected in the background / task / mainline level. O/wise you end up with corrupted arguments, etc.

quote:
In this configuration, if
OSSignalMsgQ is called only from mainline code, can it be safely called without protect calls?
Technically, yes, but it doesn't cost you much to protect it, and you'll be very unhappy down the line if you start calling OSSignalMsgQ() from an ISR and you forgot to protect it in the mainline code ... so we definitely don't recommend it.

quote:
On a related note, the Hi-Tech PICC18 linker forces a call to OSSignalMsgQ in this configuration. I just do an "if (0) OSSignalMsgQ(...);" to get around it. Strangely, the compiler correctly generates no code for the above expression, but the linker still sees OSSignalMsgQ in the ISR's call tree.
Yes, isn't that odd :-)

Regards,

------------------


Re: Cyclic timers

PostPosted: Mon Aug 26, 2002 11:42 am
by jtemples
If OSCALL_OSSIGNALEVENT is configured as OSFROM_ANYWHERE in a source build which is using event flags and message queues, do OSProtect/OSUnprotect need to be applied only to only OSSetEFlag? I.e., is OSReadEFlag safe without protect calls?

In this configuration, if
OSSignalMsgQ is called only from mainline code, can it be safely called without protect calls?

On a related note, the Hi-Tech PICC18 linker forces a call to OSSignalMsgQ in this configuration. I just do an "if (0) OSSignalMsgQ(...);" to get around it. Strangely, the compiler correctly generates no code for the above expression, but the linker still sees OSSignalMsgQ in the ISR's call tree.