Modified to run on Renesas GR Peach board
Dependencies: EthernetInterface HTTP-Server Webpage mbed-rpc mbed-src
Fork of HTTPServer_echoback by
mbed-rtos/rtos/Semaphore.cpp@16:5d102be2566c, 2015-10-07 (annotated)
- Committer:
- webOnBoard
- Date:
- Wed Oct 07 20:42:51 2015 +0000
- Revision:
- 16:5d102be2566c
web based AHRS demo Renesas GR Peach board; Using HTTP Server/RPC Adafruit 10DOF
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
webOnBoard | 16:5d102be2566c | 1 | /* mbed Microcontroller Library |
webOnBoard | 16:5d102be2566c | 2 | * Copyright (c) 2006-2012 ARM Limited |
webOnBoard | 16:5d102be2566c | 3 | * |
webOnBoard | 16:5d102be2566c | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
webOnBoard | 16:5d102be2566c | 5 | * of this software and associated documentation files (the "Software"), to deal |
webOnBoard | 16:5d102be2566c | 6 | * in the Software without restriction, including without limitation the rights |
webOnBoard | 16:5d102be2566c | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
webOnBoard | 16:5d102be2566c | 8 | * copies of the Software, and to permit persons to whom the Software is |
webOnBoard | 16:5d102be2566c | 9 | * furnished to do so, subject to the following conditions: |
webOnBoard | 16:5d102be2566c | 10 | * |
webOnBoard | 16:5d102be2566c | 11 | * The above copyright notice and this permission notice shall be included in |
webOnBoard | 16:5d102be2566c | 12 | * all copies or substantial portions of the Software. |
webOnBoard | 16:5d102be2566c | 13 | * |
webOnBoard | 16:5d102be2566c | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
webOnBoard | 16:5d102be2566c | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
webOnBoard | 16:5d102be2566c | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
webOnBoard | 16:5d102be2566c | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
webOnBoard | 16:5d102be2566c | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
webOnBoard | 16:5d102be2566c | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
webOnBoard | 16:5d102be2566c | 20 | * SOFTWARE. |
webOnBoard | 16:5d102be2566c | 21 | */ |
webOnBoard | 16:5d102be2566c | 22 | #include "Semaphore.h" |
webOnBoard | 16:5d102be2566c | 23 | |
webOnBoard | 16:5d102be2566c | 24 | #include <string.h> |
webOnBoard | 16:5d102be2566c | 25 | |
webOnBoard | 16:5d102be2566c | 26 | namespace rtos { |
webOnBoard | 16:5d102be2566c | 27 | |
webOnBoard | 16:5d102be2566c | 28 | Semaphore::Semaphore(int32_t count) { |
webOnBoard | 16:5d102be2566c | 29 | #ifdef CMSIS_OS_RTX |
webOnBoard | 16:5d102be2566c | 30 | memset(_semaphore_data, 0, sizeof(_semaphore_data)); |
webOnBoard | 16:5d102be2566c | 31 | _osSemaphoreDef.semaphore = _semaphore_data; |
webOnBoard | 16:5d102be2566c | 32 | #endif |
webOnBoard | 16:5d102be2566c | 33 | _osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count); |
webOnBoard | 16:5d102be2566c | 34 | } |
webOnBoard | 16:5d102be2566c | 35 | |
webOnBoard | 16:5d102be2566c | 36 | int32_t Semaphore::wait(uint32_t millisec) { |
webOnBoard | 16:5d102be2566c | 37 | return osSemaphoreWait(_osSemaphoreId, millisec); |
webOnBoard | 16:5d102be2566c | 38 | } |
webOnBoard | 16:5d102be2566c | 39 | |
webOnBoard | 16:5d102be2566c | 40 | osStatus Semaphore::release(void) { |
webOnBoard | 16:5d102be2566c | 41 | return osSemaphoreRelease(_osSemaphoreId); |
webOnBoard | 16:5d102be2566c | 42 | } |
webOnBoard | 16:5d102be2566c | 43 | |
webOnBoard | 16:5d102be2566c | 44 | Semaphore::~Semaphore() { |
webOnBoard | 16:5d102be2566c | 45 | osSemaphoreDelete(_osSemaphoreId); |
webOnBoard | 16:5d102be2566c | 46 | } |
webOnBoard | 16:5d102be2566c | 47 | |
webOnBoard | 16:5d102be2566c | 48 | } |