1 /*********************************************************************************
3 * --------------------------------------------------------------------------------
5 * This file is part of MiMic
6 * Copyright (C)2011 Ryo Iizuka
8 * MiMic is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published
10 * by the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * For further information please contact.
23 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
25 *********************************************************************************/
26 #include "../NyLPC_cSemaphore.h"
28 #if NyLPC_ARCH==NyLPC_ARCH_MBEDRTOS
32 void NyLPC_cSemaphore_initialize(NyLPC_TcSemaphore_t* i_inst)
34 i_inst->_handle=new Semaphore(1);
38 void NyLPC_cSemaphore_giveFromISR(const NyLPC_TcSemaphore_t* i_inst)
41 ((Semaphore*)(i_inst->_handle))->release();
47 void NyLPC_cSemaphore_take(const NyLPC_TcSemaphore_t* i_inst,NyLPC_TUInt32 i_timeout)
49 ((Semaphore*)(i_inst->_handle))->wait(i_timeout);