Local¶
- group Local_thread
thread locals
lorem
Macros¶
- group Macros_thread
Variables¶
- group Variables_thread
API’s¶
- group Apis_thread_c
Getters¶
- group Getters_thread_c
Setters¶
- group Setters_thread_c
General¶
- group General_thread_c
Functions
-
CosmOS_SleepStateType thread_sleepMsInternal(BitWidthType entityId, CosmOS_CoreConfigurationType *core, BitWidthType tickCount)¶
Set thread to sleep internal for x milliseconds. This function cannot be called from the unprivileged context directly. DEMO.
The implementation contains obtaining of the schedulable variable in execution is obtained by the core_getCoreSchedulableInExecution function. From the schedulable variable is then extracted the alarm id by calling schedulable_getAlarmId function, this id is then used to get alarm variable by calling function scheduler_getAlarmCfg. After this point is schedulable variable state set to the SCHEDULABLE_STATE_ENUM__SLEEP by calling function schedulable_setState. Subsequently the alarm needs to be configured, therefore the alarm_setAlarmTickCount function is called with tickCount argument to set internal timer of the alarm and also alarm state is set to ALARM_STATE_ENUM__ACTIVATED by calling function alarm_setAlarmState to let the scheduler know that this alarm needs to be updated from now. Sleep state is set to the SLEEP_STATE_ENUM__OK and after calling the function for triggering scheduler algorithm CILinterrupt_contextSwitchRoutineTrigger is returned from the function.
- Parameters
entityId – [in] is used during the system call dispatching
core – [in] configuration pointer
tickCount – [in] number of ticks to put thread into sleep for
- Returns
CosmOS_SleepStateType
-
CosmOS_SleepStateType thread_sleepMs(BitWidthType delayMs)¶
Set thread to sleep for x milliseconds. DEMO.
The implementation contains if condition that checks if delayMs is non-zero value otherwise it returns sleepStateReturn SLEEP_STATE_ENUM__ERROR_MIN. Then the core configuration is obtained by calling core_getCoreCfg function and then the msToTicks is obtained by calling core_getMsToTicks with core configuration argument. After this point is necessary to know if the schedulable variable obtained by core_getCoreSchedulableInExecution function is SCHEDULABLE_INSTANCE_ENUM__THREAD therefore the schedulable type is obtained by calling schedulable_getInstanceType and then check in the if condition, otherwise the sleepStateReturn is set to the SLEEP_STATE_ENUM__ERROR_ONLY_THREADS_CAN_SLEEP and returned. After this point the __MUL_OVERFLOW function as macro is called to check if required tickCount wont overflow otherwise the sleepStateReturn is set to SLEEP_STATE_ENUM__ERROR_EXCEEDING_MAX and returned. Additionally the tickCount has to be incremented by 1 calling the __ADD_OVERFLOW function and check in the if condition if overflow wont happen otherwise the sleepStateReturn is set to SLEEP_STATE_ENUM__ERROR_EXCEEDING_MAX and returned. If there is no overflow the CosmOS internal API cosmosApiInternal_thread_sleepMsInternal is called.
- Parameters
delayMs – [in] number of milliseconds to put thread into sleep for
- Returns
CosmOS_SleepStateType
-
CosmOS_SleepStateType thread_sleepMsInternal(BitWidthType entityId, CosmOS_CoreConfigurationType *core, BitWidthType tickCount)¶