ソースの整理中ですが、利用はできます。

Dependencies:   EthernetInterface HttpServer TextLCD mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
yueee_yt
Date:
Wed Mar 12 04:39:15 2014 +0000
Revision:
2:14b689a85306
Parent:
0:7766f6712673
bug fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yueee_yt 0:7766f6712673 1 /* mbed Microcontroller Library
yueee_yt 0:7766f6712673 2 * Copyright (c) 2006-2012 ARM Limited
yueee_yt 0:7766f6712673 3 *
yueee_yt 0:7766f6712673 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
yueee_yt 0:7766f6712673 5 * of this software and associated documentation files (the "Software"), to deal
yueee_yt 0:7766f6712673 6 * in the Software without restriction, including without limitation the rights
yueee_yt 0:7766f6712673 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
yueee_yt 0:7766f6712673 8 * copies of the Software, and to permit persons to whom the Software is
yueee_yt 0:7766f6712673 9 * furnished to do so, subject to the following conditions:
yueee_yt 0:7766f6712673 10 *
yueee_yt 0:7766f6712673 11 * The above copyright notice and this permission notice shall be included in
yueee_yt 0:7766f6712673 12 * all copies or substantial portions of the Software.
yueee_yt 0:7766f6712673 13 *
yueee_yt 0:7766f6712673 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
yueee_yt 0:7766f6712673 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
yueee_yt 0:7766f6712673 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
yueee_yt 0:7766f6712673 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
yueee_yt 0:7766f6712673 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
yueee_yt 0:7766f6712673 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
yueee_yt 0:7766f6712673 20 * SOFTWARE.
yueee_yt 0:7766f6712673 21 */
yueee_yt 0:7766f6712673 22 #include "Semaphore.h"
yueee_yt 0:7766f6712673 23
yueee_yt 0:7766f6712673 24 #include <string.h>
yueee_yt 0:7766f6712673 25 #include "error.h"
yueee_yt 0:7766f6712673 26
yueee_yt 0:7766f6712673 27 namespace rtos {
yueee_yt 0:7766f6712673 28
yueee_yt 0:7766f6712673 29 Semaphore::Semaphore(int32_t count) {
yueee_yt 0:7766f6712673 30 #ifdef CMSIS_OS_RTX
yueee_yt 0:7766f6712673 31 memset(_semaphore_data, 0, sizeof(_semaphore_data));
yueee_yt 0:7766f6712673 32 _osSemaphoreDef.semaphore = _semaphore_data;
yueee_yt 0:7766f6712673 33 #endif
yueee_yt 0:7766f6712673 34 _osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count);
yueee_yt 0:7766f6712673 35 }
yueee_yt 0:7766f6712673 36
yueee_yt 0:7766f6712673 37 int32_t Semaphore::wait(uint32_t millisec) {
yueee_yt 0:7766f6712673 38 return osSemaphoreWait(_osSemaphoreId, millisec);
yueee_yt 0:7766f6712673 39 }
yueee_yt 0:7766f6712673 40
yueee_yt 0:7766f6712673 41 osStatus Semaphore::release(void) {
yueee_yt 0:7766f6712673 42 return osSemaphoreRelease(_osSemaphoreId);
yueee_yt 0:7766f6712673 43 }
yueee_yt 0:7766f6712673 44
yueee_yt 0:7766f6712673 45 Semaphore::~Semaphore() {
yueee_yt 0:7766f6712673 46 osSemaphoreDelete(_osSemaphoreId);
yueee_yt 0:7766f6712673 47 }
yueee_yt 0:7766f6712673 48
yueee_yt 0:7766f6712673 49 }