mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Thu Nov 08 11:46:34 2018 +0000
Revision:
188:bcfe06ba3d64
Parent:
187:0387e8f68319
Child:
189:f392fc9709a3
mbed-dev library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /* mbed Microcontroller Library
<> 149:156823d33999 2 * Copyright (c) 2006-2013 ARM Limited
<> 149:156823d33999 3 *
<> 149:156823d33999 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 5 * you may not use this file except in compliance with the License.
<> 149:156823d33999 6 * You may obtain a copy of the License at
<> 149:156823d33999 7 *
<> 149:156823d33999 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 9 *
<> 149:156823d33999 10 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 13 * See the License for the specific language governing permissions and
<> 149:156823d33999 14 * limitations under the License.
<> 149:156823d33999 15 */
<> 149:156823d33999 16 #ifndef PLATFORM_MUTEX_H
<> 149:156823d33999 17 #define PLATFORM_MUTEX_H
<> 149:156823d33999 18
AnnaBridge 168:9672193075cf 19 #include "platform/NonCopyable.h"
AnnaBridge 168:9672193075cf 20
AnnaBridge 188:bcfe06ba3d64 21 /** \addtogroup platform
AnnaBridge 188:bcfe06ba3d64 22 * @{
AnnaBridge 188:bcfe06ba3d64 23 */
AnnaBridge 188:bcfe06ba3d64 24
AnnaBridge 188:bcfe06ba3d64 25 /** \defgroup platform_PlatformMutex PlatformMutex class
AnnaBridge 188:bcfe06ba3d64 26 * @{
AnnaBridge 188:bcfe06ba3d64 27 */
AnnaBridge 188:bcfe06ba3d64 28
AnnaBridge 188:bcfe06ba3d64 29 /** The PlatformMutex class is used to synchronize the execution of threads.
AnnaBridge 188:bcfe06ba3d64 30 *
AnnaBridge 188:bcfe06ba3d64 31 * Mbed drivers use the PlatformMutex class instead of rtos::Mutex.
AnnaBridge 188:bcfe06ba3d64 32 * This enables the use of drivers when the Mbed OS is compiled without the RTOS.
AnnaBridge 188:bcfe06ba3d64 33 *
AnnaBridge 188:bcfe06ba3d64 34 * @note
AnnaBridge 188:bcfe06ba3d64 35 * - When the RTOS is present, the PlatformMutex becomes a typedef for rtos::Mutex.
AnnaBridge 188:bcfe06ba3d64 36 * - When the RTOS is absent, all methods are defined as noop.
AnnaBridge 188:bcfe06ba3d64 37 */
AnnaBridge 188:bcfe06ba3d64 38
<> 149:156823d33999 39 #ifdef MBED_CONF_RTOS_PRESENT
AnnaBridge 188:bcfe06ba3d64 40
<> 149:156823d33999 41 #include "rtos/Mutex.h"
<> 149:156823d33999 42 typedef rtos::Mutex PlatformMutex;
AnnaBridge 188:bcfe06ba3d64 43
<> 149:156823d33999 44 #else
AnnaBridge 188:bcfe06ba3d64 45
AnnaBridge 188:bcfe06ba3d64 46 class PlatformMutex: private mbed::NonCopyable<PlatformMutex> {
<> 149:156823d33999 47 public:
AnnaBridge 188:bcfe06ba3d64 48 /** Create a PlatformMutex object.
AnnaBridge 188:bcfe06ba3d64 49 *
AnnaBridge 188:bcfe06ba3d64 50 * @note When the RTOS is present, this is an alias for rtos::Mutex::Mutex().
AnnaBridge 188:bcfe06ba3d64 51 */
AnnaBridge 187:0387e8f68319 52 PlatformMutex()
AnnaBridge 187:0387e8f68319 53 {
AnnaBridge 188:bcfe06ba3d64 54 }
<> 149:156823d33999 55
AnnaBridge 188:bcfe06ba3d64 56 /** PlatformMutex destructor.
AnnaBridge 188:bcfe06ba3d64 57 *
AnnaBridge 188:bcfe06ba3d64 58 * @note When the RTOS is present, this is an alias for rtos::Mutex::~Mutex().
AnnaBridge 188:bcfe06ba3d64 59 */
AnnaBridge 187:0387e8f68319 60 ~PlatformMutex()
AnnaBridge 187:0387e8f68319 61 {
<> 149:156823d33999 62 }
<> 149:156823d33999 63
AnnaBridge 188:bcfe06ba3d64 64 /** Wait until a PlatformMutex becomes available.
AnnaBridge 188:bcfe06ba3d64 65 *
AnnaBridge 188:bcfe06ba3d64 66 * @note
AnnaBridge 188:bcfe06ba3d64 67 * - When the RTOS is present, this is an alias for rtos::Mutex::lock().
AnnaBridge 188:bcfe06ba3d64 68 * - When the RTOS is absent, this is a noop.
AnnaBridge 188:bcfe06ba3d64 69 */
AnnaBridge 187:0387e8f68319 70 void lock()
AnnaBridge 187:0387e8f68319 71 {
<> 149:156823d33999 72 }
<> 149:156823d33999 73
AnnaBridge 188:bcfe06ba3d64 74 /** Unlock a PlatformMutex that the same thread has previously locked.
AnnaBridge 188:bcfe06ba3d64 75 *
AnnaBridge 188:bcfe06ba3d64 76 * @note
AnnaBridge 188:bcfe06ba3d64 77 * - When the RTOS is present, this is an alias for rtos::Mutex::unlock().
AnnaBridge 188:bcfe06ba3d64 78 * - When the RTOS is absent, this is a noop.
AnnaBridge 188:bcfe06ba3d64 79 */
AnnaBridge 187:0387e8f68319 80 void unlock()
AnnaBridge 187:0387e8f68319 81 {
<> 149:156823d33999 82 }
<> 149:156823d33999 83 };
<> 149:156823d33999 84
<> 149:156823d33999 85 #endif
<> 149:156823d33999 86
<> 149:156823d33999 87 #endif
<> 149:156823d33999 88
AnnaBridge 178:79309dc6340a 89 /**@}*/
AnnaBridge 178:79309dc6340a 90
AnnaBridge 178:79309dc6340a 91 /**@}*/