Просмотр исходного кода

update:尽量使用第三方代码的原生API,减少对第三方代码的修改

alienwalker 3 лет назад
Родитель
Сommit
e03cda2592
2 измененных файлов с 3 добавлено и 9 удалено
  1. 3 6
      bsp/common/src/bsp_common.c
  2. 0 3
      os/FreeRTOS_v10/src/tasks.c

+ 3 - 6
bsp/common/src/bsp_common.c

@@ -137,14 +137,11 @@ void OS_ResumeTask(HANDLE taskHandle)
 static uint8_t prvOSRunFlag;
 extern const uint32_t __os_heap_start;
 extern const uint32_t __ram_end;
-__attribute__((weak)) void OS_SetStartFlag(void)
-{
-	prvOSRunFlag = 1;
-}
+
 __attribute__((weak)) uint32_t OS_EnterCritical(void)
 {
 #ifdef __BUILD_OS__
-	if (prvOSRunFlag)
+	if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
 	{
 		if (__get_IPSR())
 		{
@@ -166,7 +163,7 @@ __attribute__((weak)) uint32_t OS_EnterCritical(void)
 __attribute__((weak)) void OS_ExitCritical(uint32_t Critical)
 {
 #ifdef __BUILD_OS__
-	if (prvOSRunFlag)
+	if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
 	{
 		if (__get_IPSR())
 		{

+ 0 - 3
os/FreeRTOS_v10/src/tasks.c

@@ -2091,9 +2091,6 @@ void vTaskStartScheduler( void )
         portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();
 
         traceTASK_SWITCHED_IN();
-#ifdef __BUILD_OS__
-        OS_SetStartFlag();
-#endif
         /* Setting up the timer tick is hardware specific and thus in the
          * portable interface. */
         if( xPortStartScheduler() != pdFALSE )