This is a question about reentrant functions in RTX51 Tiny System. AS follows articles I found in http://www.keil.com/support/man/docs/tr51/tr51_reentrant.htm: " You should disable Round-Robin Task Switching if you wish to invoke reentrant or non-reentrant function from more than one task or interrupt. "
If I want to invoke either reentrant functions or non-reentrant functions in RTX51 Tiny system, and they will be called in one more tasks, I should DISABLE Round-Robin Task Switching in CONF_TNY.A51.
Is it right?
Another question is that: addition, subtraction, multiplication, division in C51 library, are they all reentrant functions? Any I should be careful when I use them in one more tasks of RTX51 Tiny system?
http://www.keil.com/support/docs/1861.htm says:
"If we create a function that only uses registers (and no fixed memory locations for variables), then we can rely on the ISR to save and restore the registers used. And, the function will be reentrant." (my emphasis)
So the function itself is not inherently reentrant - it is only reentrant when called via an interrupt that saves the registers
Does the same apply when calling from different RTX-51 tasks?
"As long as an interrupt saves these registers, this function may be reentered."
Does this hold if the ISR specifies the 'using' keyword...?
"Register banks are useful when processing interrupts or when using a real-time operating system because the MCU can switch to a different register bank for a task or interrupt rather than saving all 8 registers on the stack." http://www.keil.com/support/man/docs/c51/c51_le_regbankspec.htm
See also: http://www.keil.com/forum/docs/thread8128.asp
Yes it is also valid for RTX51 or RTX51 Tiny tasks.