Add enough stubs to allow drivers/* to compile.

pull/11797/head
Seppo Takalo 2019-10-30 14:21:32 +02:00
parent 82045b040d
commit 376bbfc853
9 changed files with 215 additions and 6 deletions

View File

@ -40,8 +40,13 @@ typedef enum {
PullDefault = PullUp
} PinMode;
typedef enum {
PortA = 0,
} PortName;
#ifdef __cplusplus
}
#endif
#include "pinmap.h"
#endif

View File

@ -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.

View File

@ -19,5 +19,6 @@
#define MBED_DEVICE_H
#include "objects.h"
#include "PinNames.h"
#endif

View File

@ -27,6 +27,7 @@ extern "C" {
#endif
typedef struct {
int unused;
} gpio_t;
#ifdef __cplusplus

View File

@ -34,11 +34,41 @@ struct serial_s {
int x;
};
struct pwmout_s {
int pwm_name;
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"

View File

@ -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 T>
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__*/

View File

@ -24,7 +24,7 @@
extern void mock_system_reset();
MBED_NORETURN static inline void system_reset(void)
static inline void system_reset(void)
{
mock_system_reset();
}

View File

@ -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 <stdint.h>
#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

View File

@ -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 <stdint.h>
#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<void()> 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