Last active
April 29, 2025 06:11
-
-
Save kenmux/cef4e3c5e1223050495dc62e1be086c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. | |
| * Copyright 2016-2020 NXP | |
| * | |
| * SPDX-License-Identifier: BSD-3-Clause | |
| */ | |
| #if !defined(__FSL_OS_ABSTRACTION_CMSIS_RTOS2_H__) | |
| #define __FSL_OS_ABSTRACTION_CMSIS_RTOS2_H__ | |
| #if defined(__IAR_SYSTEMS_ICC__) | |
| /** | |
| * Workaround to disable MISRA C message suppress warnings for IAR compiler. | |
| */ | |
| /* http://supp.iar.com/Support/?note=24725 */ | |
| #define MISRAC_DISABLE \ | |
| _Pragma( \ | |
| "diag_suppress= \ | |
| Pm001,Pm002,Pm003,Pm004,Pm005,Pm006,Pm007,Pm008,Pm009,Pm010,Pm011,\ | |
| Pm012,Pm013,Pm014,Pm015,Pm016,Pm017,Pm018,Pm019,Pm020,Pm021,Pm022,\ | |
| Pm023,Pm024,Pm025,Pm026,Pm027,Pm028,Pm029,Pm030,Pm031,Pm032,Pm033,\ | |
| Pm034,Pm035,Pm036,Pm037,Pm038,Pm039,Pm040,Pm041,Pm042,Pm043,Pm044,\ | |
| Pm045,Pm046,Pm047,Pm048,Pm049,Pm050,Pm051,Pm052,Pm053,Pm054,Pm055,\ | |
| Pm056,Pm057,Pm058,Pm059,Pm060,Pm061,Pm062,Pm063,Pm064,Pm065,Pm066,\ | |
| Pm067,Pm068,Pm069,Pm070,Pm071,Pm072,Pm073,Pm074,Pm075,Pm076,Pm077,\ | |
| Pm078,Pm079,Pm080,Pm081,Pm082,Pm083,Pm084,Pm085,Pm086,Pm087,Pm088,\ | |
| Pm089,Pm090,Pm091,Pm092,Pm093,Pm094,Pm095,Pm096,Pm097,Pm098,Pm099,\ | |
| Pm100,Pm101,Pm102,Pm103,Pm104,Pm105,Pm106,Pm107,Pm108,Pm109,Pm110,\ | |
| Pm111,Pm112,Pm113,Pm114,Pm115,Pm116,Pm117,Pm118,Pm119,Pm120,Pm121,\ | |
| Pm122,Pm123,Pm124,Pm125,Pm126,Pm127,Pm128,Pm129,Pm130,Pm131,Pm132,\ | |
| Pm133,Pm134,Pm135,Pm136,Pm137,Pm138,Pm139,Pm140,Pm141,Pm142,Pm143,\ | |
| Pm144,Pm145,Pm146,Pm147,Pm148,Pm149,Pm150,Pm151,Pm152,Pm153,Pm154,\ | |
| Pm155") | |
| #define MISRAC_ENABLE \ | |
| _Pragma( \ | |
| "diag_default= \ | |
| Pm001,Pm002,Pm003,Pm004,Pm005,Pm006,Pm007,Pm008,Pm009,Pm010,Pm011,\ | |
| Pm012,Pm013,Pm014,Pm015,Pm016,Pm017,Pm018,Pm019,Pm020,Pm021,Pm022,\ | |
| Pm023,Pm024,Pm025,Pm026,Pm027,Pm028,Pm029,Pm030,Pm031,Pm032,Pm033,\ | |
| Pm034,Pm035,Pm036,Pm037,Pm038,Pm039,Pm040,Pm041,Pm042,Pm043,Pm044,\ | |
| Pm045,Pm046,Pm047,Pm048,Pm049,Pm050,Pm051,Pm052,Pm053,Pm054,Pm055,\ | |
| Pm056,Pm057,Pm058,Pm059,Pm060,Pm061,Pm062,Pm063,Pm064,Pm065,Pm066,\ | |
| Pm067,Pm068,Pm069,Pm070,Pm071,Pm072,Pm073,Pm074,Pm075,Pm076,Pm077,\ | |
| Pm078,Pm079,Pm080,Pm081,Pm082,Pm083,Pm084,Pm085,Pm086,Pm087,Pm088,\ | |
| Pm089,Pm090,Pm091,Pm092,Pm093,Pm094,Pm095,Pm096,Pm097,Pm098,Pm099,\ | |
| Pm100,Pm101,Pm102,Pm103,Pm104,Pm105,Pm106,Pm107,Pm108,Pm109,Pm110,\ | |
| Pm111,Pm112,Pm113,Pm114,Pm115,Pm116,Pm117,Pm118,Pm119,Pm120,Pm121,\ | |
| Pm122,Pm123,Pm124,Pm125,Pm126,Pm127,Pm128,Pm129,Pm130,Pm131,Pm132,\ | |
| Pm133,Pm134,Pm135,Pm136,Pm137,Pm138,Pm139,Pm140,Pm141,Pm142,Pm143,\ | |
| Pm144,Pm145,Pm146,Pm147,Pm148,Pm149,Pm150,Pm151,Pm152,Pm153,Pm154,\ | |
| Pm155") | |
| #else | |
| /* Empty MISRA C macros for other toolchains. */ | |
| #define MISRAC_DISABLE | |
| #define MISRAC_ENABLE | |
| #endif | |
| MISRAC_DISABLE | |
| #include "cmsis_os2.h" | |
| MISRAC_ENABLE | |
| /*! | |
| * @addtogroup os_abstraction_cmsis_rtos2_rtx5 | |
| * @{ | |
| */ | |
| /******************************************************************************* | |
| * Declarations | |
| ******************************************************************************/ | |
| /*! @brief Type for a task handler, returned by the OSA_TaskCreate function. */ | |
| typedef osThreadId_t task_handler_t; | |
| /*! @brief Type for a task stack.*/ | |
| typedef uint32_t task_stack_t; | |
| /*! @brief Type for task parameter */ | |
| typedef void *task_param_t; | |
| /*! @brief Type for an event flags object.*/ | |
| typedef uint32_t event_flags_t; | |
| /*! @brief Constant to pass as timeout value in order to wait indefinitely. */ | |
| #define OSA_WAIT_FOREVER osWaitForever | |
| /*! @brief OSA's time range in millisecond, OSA time wraps if exceeds this value. */ | |
| #define FSL_OSA_TIME_RANGE 0xFFFFFFFFU | |
| /*! @brief The default interrupt handler installed in vector table. */ | |
| #define OSA_DEFAULT_INT_HANDLER ((osa_int_handler_t)(&DefaultISR)) | |
| extern void DefaultISR(void); | |
| /*! @brief The minimum value of priorities available to the application tasks. */ | |
| #define OSA_TASK_PRIORITY_MIN (osPriorityLow) | |
| /*! @brief The maximum value of priorities available to the application tasks. */ | |
| #define OSA_TASK_PRIORITY_MAX (osPriorityISR) | |
| /*! @brief Type for a signed base type. */ | |
| typedef int32_t base_type_t; | |
| /*! @brief Type for an unsigned base type. */ | |
| typedef uint32_t ubase_type_t; | |
| /*! @brief Do nothing for critical section management. */ | |
| #define osEnterCritical(...) | |
| #define osExitCritical(...) | |
| /*! | |
| * @name Thread management | |
| * @{ | |
| */ | |
| /*! | |
| * @brief To provide unified task piority for upper layer, OSA layer makes conversion. | |
| */ | |
| #define PRIORITY_OSA_TO_RTOS(osa_prio) \ | |
| ((osPriority_t)(((ubase_type_t)OSA_TASK_PRIORITY_MAX - 1U) * (OSA_TASK_PRIORITY_MIN - osa_prio) / OSA_TASK_PRIORITY_MIN)) | |
| #define PRIORITY_RTOS_TO_OSA(rtos_prio) \ | |
| ((ubase_type_t)(OSA_TASK_PRIORITY_MIN * (((ubase_type_t)OSA_TASK_PRIORITY_MAX - 1U) - rtos_prio) / \ | |
| ((ubase_type_t)OSA_TASK_PRIORITY_MAX - 1U))) | |
| /*! @} */ | |
| /*! | |
| * @name Message queues | |
| * @{ | |
| */ | |
| /*! | |
| * @brief This macro statically reserves the memory required for the queue. | |
| * | |
| * @param name Identifier for the memory region. | |
| * @param number Number of elements in the queue. | |
| * @param size Size of every elements in words. | |
| */ | |
| #define MSG_QUEUE_DECLARE(name, number, size) msg_queue_t *name = NULL | |
| /*! @} */ | |
| /*! @}*/ | |
| /*! @}*/ | |
| /*! @}*/ | |
| #endif /* __FSL_OS_ABSTRACTION_CMSIS_RTOS2_H__ */ | |
| /******************************************************************************* | |
| * EOF | |
| ******************************************************************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment