Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers utest_shim.h Source File

utest_shim.h

00001 
00002 /** \addtogroup frameworks */
00003 /** @{*/
00004 /****************************************************************************
00005  * Copyright (c) 2016, ARM Limited, All Rights Reserved
00006  * SPDX-License-Identifier: Apache-2.0
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00009  * not use this file except in compliance with the License.
00010  * You may obtain a copy of the License at
00011  *
00012  * http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  * Unless required by applicable law or agreed to in writing, software
00015  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00016  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017  * See the License for the specific language governing permissions and
00018  * limitations under the License.
00019  ****************************************************************************
00020  */
00021 
00022 #ifndef UTEST_SHIM_H
00023 #define UTEST_SHIM_H
00024 
00025 #include <stdint.h>
00026 #include <stdbool.h>
00027 #include <stdio.h>
00028 #include "utest/utest_scheduler.h"
00029 
00030 #ifdef YOTTA_CFG
00031 #   include "compiler-polyfill/attributes.h"
00032 #else
00033 #   ifndef __deprecated_message
00034 #       if defined(__CC_ARM)
00035 #           define __deprecated_message(msg) __attribute__((deprecated))
00036 #       elif defined (__ICCARM__)
00037 #           define __deprecated_message(msg)
00038 #       else
00039 #           define __deprecated_message(msg) __attribute__((deprecated(msg)))
00040 #       endif
00041 #   endif
00042 #endif
00043 
00044 #ifdef YOTTA_CORE_UTIL_VERSION_STRING
00045 #   include "core-util/CriticalSectionLock.h"
00046 #   define UTEST_ENTER_CRITICAL_SECTION mbed::util::CriticalSectionLock lock
00047 #   define UTEST_LEAVE_CRITICAL_SECTION
00048 #else
00049 #   ifndef UTEST_ENTER_CRITICAL_SECTION
00050 #       define UTEST_ENTER_CRITICAL_SECTION utest_v1_enter_critical_section()
00051 #   endif
00052 #   ifndef UTEST_LEAVE_CRITICAL_SECTION
00053 #       define UTEST_LEAVE_CRITICAL_SECTION utest_v1_leave_critical_section()
00054 #   endif
00055 #endif
00056 
00057 #ifndef YOTTA_CFG_UTEST_USE_CUSTOM_SCHEDULER
00058 #   ifdef YOTTA_MINAR_VERSION_STRING
00059 #       define UTEST_MINAR_AVAILABLE 1
00060 #   else
00061 #       define UTEST_MINAR_AVAILABLE 0
00062 #   endif
00063 #   ifndef UTEST_SHIM_SCHEDULER_USE_MINAR
00064 #       define UTEST_SHIM_SCHEDULER_USE_MINAR UTEST_MINAR_AVAILABLE
00065 #   endif
00066 #   ifndef UTEST_SHIM_SCHEDULER_USE_US_TICKER
00067 #       ifdef __MBED__
00068 #           define UTEST_SHIM_SCHEDULER_USE_US_TICKER 1
00069 #       else
00070 #           define UTEST_SHIM_SCHEDULER_USE_US_TICKER 0
00071 #       endif
00072 #   endif
00073 #endif  // YOTTA_CFG_UTEST_USE_CUSTOM_SCHEDULER
00074 
00075 #ifdef __cplusplus
00076 extern "C" {
00077 #endif
00078 
00079 /// must be implemented by the port
00080 void utest_v1_enter_critical_section(void);
00081 void utest_v1_leave_critical_section(void);
00082 
00083 /// This is the default scheduler implementation used by the harness.
00084 utest_v1_scheduler_t utest_v1_get_scheduler(void);
00085 
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089 
00090 #endif // UTEST_SHIM_H
00091 
00092 /** @}*/