OSAL:FreeRTOS: Fix isues with getThreadType API
authorDon Dominic <a0486429@ti.com>
Thu, 8 Apr 2021 14:37:49 +0000 (20:07 +0530)
committerDon Dominic <a0486429@ti.com>
Thu, 8 Apr 2021 14:37:49 +0000 (20:07 +0530)
- Osal_getThreadType was returing "Osal_ThreadType_Task" if its not HWI
- Check for Schedular started or not was missing.
- Added check for the same and return "Osal_ThreadType_Main" if Schedular is not yet started

Signed-off-by: Don Dominic <a0486429@ti.com>
packages/ti/osal/src/freertos/Utils_freertos.c

index 13f913ff8af6c8617cdc9ba78189ad348af56538..c5c9e264aafaad712bb09e5d8c5b67267ffb6796 100644 (file)
@@ -41,6 +41,7 @@
 #include <ti/osal/TaskP.h>
 
 #include <FreeRTOS.h>
+#include <task.h>
 
 /* External Clock should be defined under osal_soc.h
  * if SOC is not supporting it, set to -1
@@ -121,6 +122,10 @@ Osal_ThreadType Osal_getThreadType(void)
     {
         osalThreadType = Osal_ThreadType_Hwi;
     }
+    else if(taskSCHEDULER_NOT_STARTED == xTaskGetSchedulerState())
+    {
+        osalThreadType = Osal_ThreadType_Main;
+    }
     else
     {
         osalThreadType = Osal_ThreadType_Task;