joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers utest_shim.h Source File

utest_shim.h

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