2323#include <string.h>
2424
2525#include "RTE_Components.h" // Component selection
26- #include CMSIS_device_header
2726
2827#include "cmsis_os2.h" // ::CMSIS:RTOS2
2928#include "cmsis_compiler.h"
3433#include "semphr.h" // ARM.FreeRTOS::RTOS:Core
3534
3635/*---------------------------------------------------------------------------*/
36+ #ifndef __ARM_ARCH_6M__
37+ #define __ARM_ARCH_6M__ 0
38+ #endif
39+ #ifndef __ARM_ARCH_7M__
40+ #define __ARM_ARCH_7M__ 0
41+ #endif
42+ #ifndef __ARM_ARCH_7EM__
43+ #define __ARM_ARCH_7EM__ 0
44+ #endif
45+ #ifndef __ARM_ARCH_8M_MAIN__
46+ #define __ARM_ARCH_8M_MAIN__ 0
47+ #endif
48+ #ifndef __ARM_ARCH_7A__
49+ #define __ARM_ARCH_7A__ 0
50+ #endif
3751
3852#if ((__ARM_ARCH_7M__ == 1U ) || \
3953 (__ARM_ARCH_7EM__ == 1U ) || \
4054 (__ARM_ARCH_8M_MAIN__ == 1U ))
4155#define IS_IRQ_MASKED () ((__get_PRIMASK() != 0U) || ((KernelState == osKernelRunning) && (__get_BASEPRI() != 0U)))
56+ #elif (__ARM_ARCH_6M__ == 1U )
57+ #define IS_IRQ_MASKED () ((__get_PRIMASK() != 0U) && (KernelState == osKernelRunning))
4258#else
43- #define IS_IRQ_MASKED () (__get_PRIMASK() != 0U)
59+ #define IS_IRQ_MASKED () (__get_PRIMASK() != 0U)
4460#endif
4561
4662#if (__ARM_ARCH_7A__ == 1U )
@@ -261,9 +277,11 @@ int32_t osKernelRestoreLock (int32_t lock) {
261277 if (lock != 0 ) {
262278 lock = (int32_t )osError ;
263279 }
264- else if (xTaskResumeAll () != pdTRUE ) {
265- if (xTaskGetSchedulerState () != taskSCHEDULER_RUNNING ) {
266- lock = (int32_t )osError ;
280+ else {
281+ if (xTaskResumeAll () != pdTRUE ) {
282+ if (xTaskGetSchedulerState () != taskSCHEDULER_RUNNING ) {
283+ lock = (int32_t )osError ;
284+ }
267285 }
268286 }
269287 }
@@ -283,7 +301,7 @@ uint64_t osKernelGetTickCount (void) {
283301 TickType_t ticks ;
284302
285303 if (IS_IRQ ()) {
286- ticks = xTaskGetTickCountFromISR () ;
304+ ticks = 0U ;
287305 } else {
288306 ticks = xTaskGetTickCount ();
289307 }
@@ -384,7 +402,7 @@ osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAtt
384402 }
385403 else {
386404 if (mem == 0 ) {
387- if (xTaskCreate ((TaskFunction_t )func , name , stack , argument , prio , & h ) != pdPASS ) {
405+ if (xTaskCreate ((TaskFunction_t )func , name , ( uint16_t ) stack , argument , prio , & h ) != pdPASS ) {
388406 h = NULL ;
389407 }
390408 }
@@ -897,7 +915,7 @@ uint32_t osTimerIsRunning (osTimerId_t timer_id) {
897915 if (IS_IRQ () || (timer_id == NULL )) {
898916 running = 0U ;
899917 } else {
900- running = xTimerIsTimerActive ((TimerHandle_t )timer_id );
918+ running = ( uint32_t ) xTimerIsTimerActive ((TimerHandle_t )timer_id );
901919 }
902920
903921 return (running );
0 commit comments