mbed library sources. Supersedes mbed-src.

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

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
188:bcfe06ba3d64
mbed library release version 165

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