Dylan Saada / Mbed 2 deprecated telemetre2

Dependencies:   mbed

Committer:
dylancachan
Date:
Wed Apr 15 06:23:18 2015 +0000
Revision:
0:6ce9c65992e5
telemetre

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dylancachan 0:6ce9c65992e5 1 /* mbed Microcontroller Library
dylancachan 0:6ce9c65992e5 2 * Copyright (c) 2006-2012 ARM Limited
dylancachan 0:6ce9c65992e5 3 *
dylancachan 0:6ce9c65992e5 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
dylancachan 0:6ce9c65992e5 5 * of this software and associated documentation files (the "Software"), to deal
dylancachan 0:6ce9c65992e5 6 * in the Software without restriction, including without limitation the rights
dylancachan 0:6ce9c65992e5 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
dylancachan 0:6ce9c65992e5 8 * copies of the Software, and to permit persons to whom the Software is
dylancachan 0:6ce9c65992e5 9 * furnished to do so, subject to the following conditions:
dylancachan 0:6ce9c65992e5 10 *
dylancachan 0:6ce9c65992e5 11 * The above copyright notice and this permission notice shall be included in
dylancachan 0:6ce9c65992e5 12 * all copies or substantial portions of the Software.
dylancachan 0:6ce9c65992e5 13 *
dylancachan 0:6ce9c65992e5 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dylancachan 0:6ce9c65992e5 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dylancachan 0:6ce9c65992e5 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dylancachan 0:6ce9c65992e5 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dylancachan 0:6ce9c65992e5 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
dylancachan 0:6ce9c65992e5 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
dylancachan 0:6ce9c65992e5 20 * SOFTWARE.
dylancachan 0:6ce9c65992e5 21 */
dylancachan 0:6ce9c65992e5 22 #ifndef SEMAPHORE_H
dylancachan 0:6ce9c65992e5 23 #define SEMAPHORE_H
dylancachan 0:6ce9c65992e5 24
dylancachan 0:6ce9c65992e5 25 #include <stdint.h>
dylancachan 0:6ce9c65992e5 26 #include "cmsis_os.h"
dylancachan 0:6ce9c65992e5 27
dylancachan 0:6ce9c65992e5 28 namespace rtos {
dylancachan 0:6ce9c65992e5 29
dylancachan 0:6ce9c65992e5 30 /** The Semaphore class is used to manage and protect access to a set of shared resources. */
dylancachan 0:6ce9c65992e5 31 class Semaphore {
dylancachan 0:6ce9c65992e5 32 public:
dylancachan 0:6ce9c65992e5 33 /** Create and Initialize a Semaphore object used for managing resources.
dylancachan 0:6ce9c65992e5 34 @param number of available resources; maximum index value is (count-1).
dylancachan 0:6ce9c65992e5 35 */
dylancachan 0:6ce9c65992e5 36 Semaphore(int32_t count);
dylancachan 0:6ce9c65992e5 37
dylancachan 0:6ce9c65992e5 38 /** Wait until a Semaphore resource becomes available.
dylancachan 0:6ce9c65992e5 39 @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).
dylancachan 0:6ce9c65992e5 40 @return number of available tokens, or -1 in case of incorrect parameters
dylancachan 0:6ce9c65992e5 41 */
dylancachan 0:6ce9c65992e5 42 int32_t wait(uint32_t millisec=osWaitForever);
dylancachan 0:6ce9c65992e5 43
dylancachan 0:6ce9c65992e5 44 /** Release a Semaphore resource that was obtain with Semaphore::wait.
dylancachan 0:6ce9c65992e5 45 @return status code that indicates the execution status of the function.
dylancachan 0:6ce9c65992e5 46 */
dylancachan 0:6ce9c65992e5 47 osStatus release(void);
dylancachan 0:6ce9c65992e5 48
dylancachan 0:6ce9c65992e5 49 ~Semaphore();
dylancachan 0:6ce9c65992e5 50
dylancachan 0:6ce9c65992e5 51 private:
dylancachan 0:6ce9c65992e5 52 osSemaphoreId _osSemaphoreId;
dylancachan 0:6ce9c65992e5 53 osSemaphoreDef_t _osSemaphoreDef;
dylancachan 0:6ce9c65992e5 54 #ifdef CMSIS_OS_RTX
dylancachan 0:6ce9c65992e5 55 uint32_t _semaphore_data[2];
dylancachan 0:6ce9c65992e5 56 #endif
dylancachan 0:6ce9c65992e5 57 };
dylancachan 0:6ce9c65992e5 58
dylancachan 0:6ce9c65992e5 59 }
dylancachan 0:6ce9c65992e5 60 #endif