Hi.
If I call the osMutexWait() function before the RTX osKernelInitialize() function is executed, an error is returned naturally. After that, I call the osKernelInitialize() function. Is there any adverse effect of reading the osMutexWait() function?What kind of scene is, the two devices (EEPROM and ADC) accessed by SPI I/F are exclusively controlled by MUTEX, but it is necessary to read the EEPROM before starting the thread when the power is turned on.Thank you.
jun
Thank you for your answer. I know that the mutex call returns with an error. Please tell me whether the function that I return with an error and then the initialize function will be initialized normally. The first call to the mutex does not have to have exclusive control.
zunda said:The first call to the mutex does not have to have exclusive control
So why call the mutex at all, then?
As ChenTang said, you can call osKernelGetState - and that will tell you whether the Kernel is initialised or not
Thank you for your reply.I'm sorry it's hard to understand.Because it shares the function. This is because we want to use the function used when exclusive control is required in the same way even when exclusive control is not required. Also, because the function is used deep inside the nest, it is difficult to separate it with or without MUTEX.Probably, there is no problem if the MUTEX function gives an error (osErrorParameter) before OS initialization, and there is no problem if OS initialization is performed after that (because it is initialized), but the OS initialization process What about the content?
Maybe this example is easier for you to understand:
you are trying to get into a construction site, where the building is still not yet being built. At the entrance, you see a warning sign "Enter at your own risk!". But you still want to build and use your own room at this empty construction site right now. What do you expect to happen?
The warning sign might have already told you what will happen...
Thank you for your reply.
OK. I want to be at my own risk, follow the specifications, or do it in a risk-free manner. (It is wise to follow the specifications)I apologize for the trouble.Have a good day!
Hi,
if you know that the mutex is not required when the Kernal is not running, but you want to use the same function, you could
use osKernelGetState. If Kernel is not running, do not use the mutex
if Kernel is running use the mutex
Thank you for your reply. Well, that kind of usage is supposed. OK. Thank you very much.
there's an echo in here!