1 /* 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. 3 * Copyright 2016-2020 NXP 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 #if !defined(__FSL_OS_ABSTRACTION_BM_H__) 8 #define __FSL_OS_ABSTRACTION_BM_H__ 9 10 /*! 11 * @addtogroup os_abstraction_bm 12 * @{ 13 */ 14 15 /******************************************************************************* 16 * Declarations 17 ******************************************************************************/ 18 /*! @brief Bare Metal does not use timer. */ 19 #ifndef FSL_OSA_BM_TIMER_NONE 20 #define FSL_OSA_BM_TIMER_NONE 0U 21 #endif 22 23 /*! @brief Bare Metal uses SYSTICK as timer. */ 24 #ifndef FSL_OSA_BM_TIMER_SYSTICK 25 #define FSL_OSA_BM_TIMER_SYSTICK 1U 26 #endif 27 28 /*! @brief Configure what timer is used in Bare Metal. */ 29 #ifndef FSL_OSA_BM_TIMER_CONFIG 30 #define FSL_OSA_BM_TIMER_CONFIG FSL_OSA_BM_TIMER_NONE 31 #endif 32 33 /*! @brief Type for task parameter */ 34 typedef void *task_param_t; 35 36 /*! @brief Type for an event flags group, bit 32 is reserved */ 37 typedef uint32_t event_flags_t; 38 39 /*! @brief Constant to pass as timeout value in order to wait indefinitely. */ 40 #define OSA_WAIT_FOREVER 0xFFFFFFFFU 41 42 /*! @brief How many tasks can the bare metal support. */ 43 #ifndef TASK_MAX_NUM 44 #define TASK_MAX_NUM 7 45 #endif 46 47 /*! @brief OSA's time range in millisecond, OSA time wraps if exceeds this value. */ 48 #define FSL_OSA_TIME_RANGE 0xFFFFFFFFU 49 50 /*! @brief The default interrupt handler installed in vector table. */ 51 #define OSA_DEFAULT_INT_HANDLER ((osa_int_handler_t)(&DefaultISR)) 52 53 /*! @brief The default interrupt handler installed in vector table. */ 54 extern void DefaultISR(void); 55 56 /*! 57 * @brief Process OSA tasks 58 * 59 * This function is used to process registered tasks. 60 * 61 * Example below shows how to use this API in baremetal. 62 * 63 * @code 64 * while(1) { 65 * OSA_ProcessTasks(); 66 * } 67 * @endcode 68 */ 69 void OSA_ProcessTasks(void); 70 71 /*! 72 * @brief Check OSA Task Should Yield 73 * 74 * This function is used to check task should yield, When this function returns 1, an OSA task has to run. 75 * This function is typically used with Interrupt disabled before executing WFI instruction. 76 * 77 */ 78 uint8_t OSA_TaskShouldYield(void); 79 /*! 80 * @name Thread management 81 * @{ 82 */ 83 84 /*! 85 * @brief To provide unified priority for upper layer, OSA layer makes conversation. 86 */ 87 #define PRIORITY_OSA_TO_RTOS(osa_prio) (osa_prio) 88 #define PRIORITY_RTOS_TO_OSA(rtos_prio) (rtos_prio) 89 90 /*! @}*/ 91 /*! @}*/ 92 #endif /* __FSL_OS_ABSTRACTION_BM_H__ */ 93 /******************************************************************************* 94 * EOF 95 ******************************************************************************/ 96