diff --git a/UNITTESTS/target_h/PinNames.h b/UNITTESTS/target_h/PinNames.h index 243c64fd14..132c5ab585 100644 --- a/UNITTESTS/target_h/PinNames.h +++ b/UNITTESTS/target_h/PinNames.h @@ -36,8 +36,13 @@ typedef enum { typedef enum { } PinMode; +typedef enum { + PortA = 0, +} PortName; + #ifdef __cplusplus } #endif +#include "pinmap.h" #endif diff --git a/UNITTESTS/target_h/cmsis_os2.h b/UNITTESTS/target_h/cmsis_os2.h index bb05b7dc99..6c7d6d3059 100644 --- a/UNITTESTS/target_h/cmsis_os2.h +++ b/UNITTESTS/target_h/cmsis_os2.h @@ -64,6 +64,7 @@ typedef void *osEventFlagsId_t; /// Attributes structure for thread. typedef struct { + int unused; } osThreadAttr_t; #define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value. diff --git a/UNITTESTS/target_h/device.h b/UNITTESTS/target_h/device.h index 80d55afd91..c052aa04bd 100644 --- a/UNITTESTS/target_h/device.h +++ b/UNITTESTS/target_h/device.h @@ -19,5 +19,6 @@ #define MBED_DEVICE_H #include "objects.h" +#include "PinNames.h" #endif diff --git a/UNITTESTS/target_h/gpio_object.h b/UNITTESTS/target_h/gpio_object.h index a344bb316b..f25919eebe 100644 --- a/UNITTESTS/target_h/gpio_object.h +++ b/UNITTESTS/target_h/gpio_object.h @@ -27,6 +27,7 @@ extern "C" { #endif typedef struct { + int unused; } gpio_t; #ifdef __cplusplus diff --git a/UNITTESTS/target_h/objects.h b/UNITTESTS/target_h/objects.h index 5753bbdcd4..f10a11ca02 100644 --- a/UNITTESTS/target_h/objects.h +++ b/UNITTESTS/target_h/objects.h @@ -33,6 +33,42 @@ struct serial_s { int x; }; +struct dac_s { + int unused; +}; + +struct i2c_s { + int unused; +}; + +struct qspi_s { + int unused; +}; + +struct spi_s { + int unused; +}; + +struct analogin_s { + int unused; +}; + +struct port_s { + int unused; +}; + +struct pwmout_s { + int unused; +}; + +struct flash_s { + int unused; +}; + +struct can_s { + int unused; +}; + #include "gpio_object.h" #ifdef __cplusplus diff --git a/UNITTESTS/target_h/platform/CThunk.h b/UNITTESTS/target_h/platform/CThunk.h new file mode 100644 index 0000000000..79e19aa72e --- /dev/null +++ b/UNITTESTS/target_h/platform/CThunk.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CTHUNK_H__ +#define __CTHUNK_H__ + +/** + * Class for created a pointer with data bound to it + * + * @note Synchronization level: Not protected + */ +template +class CThunk { +public: + typedef void (T::*CCallbackSimple)(void); + typedef void (T::*CCallback)(void *context); + CThunk() + {} + CThunk(T *instance) + {} + CThunk(T &instance) + {} + void callback(CCallback callback) + {} + + void callback(CCallbackSimple callback) + { + } + uint32_t entry(void) + { + + return 0; + } +}; + + +#endif/*__CTHUNK_H__*/ + + diff --git a/UNITTESTS/target_h/platform/mbed_power_mgmt.h b/UNITTESTS/target_h/platform/mbed_power_mgmt.h index d0475a10d7..dfeaaa4f87 100644 --- a/UNITTESTS/target_h/platform/mbed_power_mgmt.h +++ b/UNITTESTS/target_h/platform/mbed_power_mgmt.h @@ -23,7 +23,7 @@ #define MBED_POWER_MGMT_H extern void mock_system_reset(); -MBED_NORETURN static inline void system_reset(void) +static inline void system_reset(void) { mock_system_reset(); } diff --git a/UNITTESTS/target_h/rtos/Semaphore.h b/UNITTESTS/target_h/rtos/Semaphore.h index 34e472dea6..e0051f2b0e 100644 --- a/UNITTESTS/target_h/rtos/Semaphore.h +++ b/UNITTESTS/target_h/rtos/Semaphore.h @@ -1,5 +1,4 @@ -/* - * Copyright (c) , Arm Limited and affiliates. +/* Copyright (c) 2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,4 +14,23 @@ * limitations under the License. */ -typedef void *Semaphore; +#ifndef SEMAPHORE_H +#define SEMAPHORE_H + +#include +#include "cmsis_os2.h" + +namespace rtos { +class Semaphore { +public: + Semaphore(int32_t count = 0) {}; + Semaphore(int32_t count, uint16_t max_count) {}; + void acquire() {}; + bool try_acquire() { return false; }; + bool try_acquire_for(uint32_t millisec) { return false; }; + bool try_acquire_until(uint64_t millisec) { return false; }; + osStatus release(void) {return 0;}; +}; +} + +#endif diff --git a/UNITTESTS/target_h/rtos/Thread.h b/UNITTESTS/target_h/rtos/Thread.h new file mode 100644 index 0000000000..c0e3ba9d74 --- /dev/null +++ b/UNITTESTS/target_h/rtos/Thread.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2019 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef THREAD_H +#define THREAD_H + +#include +#include "cmsis_os.h" + +namespace rtos { + +class Thread { +public: + + Thread(osPriority priority = osPriorityNormal, + uint32_t stack_size = OS_STACK_SIZE, + unsigned char *stack_mem = nullptr, const char *name = nullptr) + { + } + + Thread(uint32_t tz_module, osPriority priority = osPriorityNormal, + uint32_t stack_size = OS_STACK_SIZE, + unsigned char *stack_mem = nullptr, const char *name = nullptr) + { + } + + osStatus start(mbed::Callback task) { + return 0; + } + + osStatus join() {return 0;}; + osStatus terminate(){return 0;}; + osStatus set_priority(osPriority priority){return 0;}; + osPriority get_priority() const{return osPriorityNormal;}; + uint32_t flags_set(uint32_t flags){return 0;}; + + /** State of the Thread */ + enum State { + Inactive, /**< NOT USED */ + Ready, /**< Ready to run */ + Running, /**< Running */ + WaitingDelay, /**< Waiting for a delay to occur */ + WaitingJoin, /**< Waiting for thread to join. Only happens when using RTX directly. */ + WaitingThreadFlag, /**< Waiting for a thread flag to be set */ + WaitingEventFlag, /**< Waiting for a event flag to be set */ + WaitingMutex, /**< Waiting for a mutex event to occur */ + WaitingSemaphore, /**< Waiting for a semaphore event to occur */ + WaitingMemoryPool, /**< Waiting for a memory pool */ + WaitingMessageGet, /**< Waiting for message to arrive */ + WaitingMessagePut, /**< Waiting for message to be send */ + WaitingInterval, /**< NOT USED */ + WaitingOr, /**< NOT USED */ + WaitingAnd, /**< NOT USED */ + WaitingMailbox, /**< NOT USED (Mail is implemented as MemoryPool and Queue) */ + + /* Not in sync with RTX below here */ + Deleted, /**< The task has been deleted or not started */ + }; + + State get_state() const { + return Ready; + }; + uint32_t stack_size() const { + return 0; + }; + uint32_t free_stack() const { + return 0; + }; + uint32_t used_stack() const { + return 0; + }; + uint32_t max_stack() const { + return 0; + }; + const char *get_name() const { + return ""; + }; + osThreadId_t get_id() const { + return 0; + }; +}; +} +#endif