Create dedicated file for PlatformMutex

Move the PlatformMutex class into a dedicated file to reduce the
number of unnecessary includes.
pull/2302/head
Russ Butler 2016-07-28 14:04:21 -05:00
parent 36468c9acb
commit 4047ff9576
18 changed files with 62 additions and 32 deletions

View File

@ -22,6 +22,7 @@
#include "analogin_api.h"
#include "SingletonPtr.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -21,6 +21,7 @@
#if DEVICE_ANALOGOUT
#include "analogout_api.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -18,6 +18,7 @@
#include "platform.h"
#include "DigitalIn.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -17,6 +17,7 @@
#define MBED_BUSINOUT_H
#include "DigitalInOut.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -17,6 +17,7 @@
#define MBED_BUSOUT_H
#include "DigitalOut.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -23,6 +23,7 @@
#include "can_api.h"
#include "can_helper.h"
#include "Callback.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -42,6 +42,7 @@ typedef long off_t;
#include "platform.h"
#include "SingletonPtr.h"
#include "PlatformMutex.h"
namespace mbed {

View File

@ -22,6 +22,7 @@
#include "i2c_api.h"
#include "SingletonPtr.h"
#include "PlatformMutex.h"
#if DEVICE_I2C_ASYNCH
#include "CThunk.h"

View File

@ -1,10 +1,9 @@
#ifndef MBED_INTERRUPTMANAGER_H
#define MBED_INTERRUPTMANAGER_H
#include "platform.h"
#include "cmsis.h"
#include "CallChain.h"
#include "PlatformMutex.h"
#include <string.h>
namespace mbed {

View File

@ -21,6 +21,7 @@
#if DEVICE_LOCALFILESYSTEM
#include "FileSystemLike.h"
#include "PlatformMutex.h"
namespace mbed {

46
hal/api/PlatformMutex.h Normal file
View File

@ -0,0 +1,46 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* 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 PLATFORM_MUTEX_H
#define PLATFORM_MUTEX_H
#ifdef MBED_CONF_RTOS_PRESENT
#include "Mutex.h"
typedef rtos::Mutex PlatformMutex;
#else
/** A stub mutex for when an RTOS is not present
*/
class PlatformMutex {
public:
PlatformMutex() {
// Stub
}
~PlatformMutex() {
// Stub
}
void lock() {
// Do nothing
}
void unlock() {
// Do nothing
}
};
#endif
#endif

View File

@ -20,6 +20,7 @@
#if DEVICE_SPI
#include "PlatformMutex.h"
#include "spi_api.h"
#if DEVICE_SPI_ASYNCH

View File

@ -22,6 +22,7 @@
#include "Stream.h"
#include "SerialBase.h"
#include "PlatformMutex.h"
#include "serial_api.h"
namespace mbed {

View File

@ -25,31 +25,4 @@
#include <cstdio>
#include <cstring>
#ifdef MBED_CONF_RTOS_PRESENT
#include "Mutex.h"
typedef rtos::Mutex PlatformMutex;
#else
/** A stub mutex for when an RTOS is not present
*/
class PlatformMutex {
public:
PlatformMutex() {
// Stub
}
~PlatformMutex() {
// Stub
}
void lock() {
// Do nothing
}
void unlock() {
// Do nothing
}
};
#endif
#endif

View File

@ -22,6 +22,7 @@
#include "semihost_api.h"
#include "mbed_interface.h"
#include "SingletonPtr.h"
#include "PlatformMutex.h"
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif

View File

@ -23,7 +23,7 @@
#define MBED_FATDIRHANDLE_H
#include "DirHandle.h"
#include "platform.h"
#include "PlatformMutex.h"
using namespace mbed;

View File

@ -23,7 +23,7 @@
#define MBED_FATFILEHANDLE_H
#include "FileHandle.h"
#include "platform.h"
#include "PlatformMutex.h"
using namespace mbed;

View File

@ -26,7 +26,7 @@
#include "FileHandle.h"
#include "ff.h"
#include <stdint.h>
#include "platform.h"
#include "PlatformMutex.h"
using namespace mbed;