58 #include "HL_sys_core.h"
77 if (OS_ENABLE_CACHE ==
true) {
83 vTaskStartScheduler();
89 StaticTask_t **ppxIdleTaskTCBBuffer,
90 StackType_t **ppxIdleTaskStackBuffer,
91 uint32_t *pulIdleTaskStackSize) {
93 static StaticTask_t os_idleTask = {0};
95 static StackType_t os_stackSizeIdle[OS_IDLE_TASK_STACK_SIZE] = {0};
99 *ppxIdleTaskTCBBuffer = &os_idleTask;
100 *ppxIdleTaskStackBuffer = &os_stackSizeIdle[0];
101 *pulIdleTaskStackSize = OS_IDLE_TASK_STACK_SIZE;
104 #if (configUSE_TIMERS > 0) && (configSUPPORT_STATIC_ALLOCATION == 1)
105 void vApplicationGetTimerTaskMemory(
106 StaticTask_t **ppxTimerTaskTCBBuffer,
107 StackType_t **ppxTimerTaskStackBuffer,
108 uint32_t *pulTimerTaskStackSize) {
109 #if (configUSE_TIMERS > 0) && (configSUPPORT_STATIC_ALLOCATION == 1)
111 static StaticTask_t os_timerTask;
114 #if (configUSE_TIMERS > 0) && (configSUPPORT_STATIC_ALLOCATION == 1)
116 static StackType_t os_stackSizeTimer[OS_TIMER_TASK_STACK_SIZE];
118 *ppxTimerTaskTCBBuffer = &os_timerTask;
119 *ppxTimerTaskStackBuffer = &os_stackSizeTimer[0];
120 *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
128 #if (configCHECK_FOR_STACK_OVERFLOW > 0)
141 void vApplicationStackOverflowHook(TaskHandle_t xTask,
char *pcTaskName) {
151 taskENTER_CRITICAL();
159 return xTaskGetTickCount();
165 uint32_t ticks = (milliseconds / OS_TICK_RATE_MS);
166 if ((uint32_t)ticks < 1u) {
169 vTaskDelayUntil((TickType_t *)pPreviousWakeTime, (TickType_t)ticks);
184 BaseType_t xNotificationReceived = xTaskNotifyWait(UINT32_MAX, UINT32_MAX, pNotifiedValue, timeout);
186 if (xNotificationReceived == pdTRUE) {
189 return notificationReceived;
197 BaseType_t xHigherPriorityTaskWoken = pdFALSE;
199 BaseType_t xNotification =
200 xTaskNotifyFromISR(taskToNotify, notifiedValue, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
201 if (xNotification == pdTRUE) {
206 portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
211 uint32_t indexToWaitOn,
212 uint32_t *pNotifiedValue,
221 BaseType_t xNotificationReceived =
222 xTaskNotifyWaitIndexed(indexToWaitOn, UINT32_MAX, UINT32_MAX, pNotifiedValue, timeout);
224 if (xNotificationReceived == pdTRUE) {
227 return notificationReceived;
231 TaskHandle_t taskToNotify,
232 uint32_t indexToNotify,
233 uint32_t notifiedValue) {
238 BaseType_t xHigherPriorityTaskWoken = pdFALSE;
240 BaseType_t xNotification = xTaskNotifyIndexedFromISR(
241 taskToNotify, indexToNotify, notifiedValue, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
242 if (xNotification == pdTRUE) {
247 portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
256 BaseType_t xNotificationWasPending = xTaskNotifyStateClearIndexed(
NULL, indexToClear);
258 if (xNotificationWasPending == pdTRUE) {
261 return notificationWasPending;
269 BaseType_t xQueueReceiveSuccess = xQueueReceive(xQueue, pvBuffer, (TickType_t)ticksToWait);
271 if (xQueueReceiveSuccess == pdTRUE) {
274 return queueReceiveSuccessfully;
281 BaseType_t xQueueSendSuccess = xQueueSendToBack(xQueue, pvItemToQueue, (TickType_t)ticksToWait);
283 if (xQueueSendSuccess == pdTRUE) {
286 return queueSendSuccessfully;
291 const void *
const pvItemToQueue,
292 long *
const pxHigherPriorityTaskWoken) {
296 BaseType_t xQueueSendSuccess =
297 xQueueSendToBackFromISR(xQueue, pvItemToQueue, (BaseType_t *)pxHigherPriorityTaskWoken);
299 if (xQueueSendSuccess == pdTRUE) {
302 return queueSendSuccessfully;
306 long numberOfMessages = uxQueueMessagesWaiting(xQueue);
307 return (uint32_t)numberOfMessages;
311 #ifdef UNITY_UNIT_TEST
void CANTX_SendReasonsForFatalErrors(CANTX_FATAL_ERRORS_ACTIONS_e action)
Tries to send a CAN message in case of fatal error.
CAN Tx callback functions for transmitting information on fatal errors.
@ CANTX_FATAL_ERRORS_ACTIONS_STACK_OVERFLOW
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
#define NULL
NULL definition.
#define NULL_PTR
Null pointer.
Header of task driver implementation.
void FTSK_RunUserCodeIdle(void)
Idle task.
Declaration of the OS wrapper interface.
OS_STD_RETURN_e OS_NotifyFromIsr(TaskHandle_t taskToNotify, uint32_t notifiedValue)
Notify a task.
OS_STD_RETURN_e OS_WaitForNotification(uint32_t *pNotifiedValue, uint32_t timeout)
Wait for a notification.
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize)
OS_STD_RETURN_e OS_ClearNotificationIndexed(uint32_t indexToClear)
Clear pending notification of a task, with index.
OS_STD_RETURN_e OS_ReceiveFromQueue(OS_QUEUE xQueue, void *const pvBuffer, uint32_t ticksToWait)
Receive an item from a queue.
void OS_StartScheduler(void)
Starts the operating system scheduler.
void OS_DelayTaskUntil(uint32_t *pPreviousWakeTime, uint32_t milliseconds)
Delay a task until a specified time.
OS_STD_RETURN_e OS_SendToBackOfQueueFromIsr(OS_QUEUE xQueue, const void *const pvItemToQueue, long *const pxHigherPriorityTaskWoken)
Post an item to the back the provided queue during an ISR.
void OS_MarkTaskAsRequiringFpuContext(void)
Marks the current task as requiring FPU context.
uint32_t OS_GetNumberOfStoredMessagesInQueue(OS_QUEUE xQueue)
Check if messages are waiting for queue.
OS_STD_RETURN_e OS_WaitForNotificationIndexed(uint32_t indexToWaitOn, uint32_t *pNotifiedValue, uint32_t timeout)
Wait for a notification, with index.
OS_STD_RETURN_e OS_NotifyIndexedFromIsr(TaskHandle_t taskToNotify, uint32_t indexToNotify, uint32_t notifiedValue)
Notify a task, with index.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void vApplicationIdleHook(void)
Hook function for the idle task.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
OS_STD_RETURN_e OS_SendToBackOfQueue(OS_QUEUE xQueue, const void *const pvItemToQueue, uint32_t ticksToWait)
Post an item to the back the provided queue.
void OS_InitializeScheduler(void)
Initialization function for the scheduler.
uint32_t OS_GetTickCount(void)
Returns OS based system tick value.