Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
NyLPC_cSemaphore.h
00001 /********************************************************************************* 00002 * PROJECT: MiMic 00003 * -------------------------------------------------------------------------------- 00004 * 00005 * This file is part of MiMic 00006 * Copyright (C)2011 Ryo Iizuka 00007 * 00008 * MiMic is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published 00010 * by the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 * For further information please contact. 00022 * http://nyatla.jp/ 00023 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp> 00024 * 00025 *********************************************************************************/ 00026 #ifndef NYLPC_CSEMAPHORE_H_ 00027 #define NYLPC_CSEMAPHORE_H_ 00028 //////////////////////////////////////////////////////////////////////////////// 00029 // Include 00030 //////////////////////////////////////////////////////////////////////////////// 00031 #include "NyLPC_stdlib.h" 00032 #if NyLPC_ARCH==NyLPC_ARCH_FREERTOS 00033 #include "FreeRTOS.h" 00034 #include "queue.h" 00035 #include "semphr.h" 00036 #elif NyLPC_ARCH==NyLPC_ARCH_MBEDRTOS 00037 #elif NyLPC_ARCH==NyLPC_ARCH_WIN32 00038 //not work! 00039 #else 00040 #error Bad NyLPC_ARCH! 00041 #endif 00042 00043 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif /* __cplusplus */ 00047 00048 /********************************************************************** 00049 * 00050 * NyLPC_cSemaphore class 00051 * 00052 **********************************************************************/ 00053 typedef struct NyLPC_TcSemaphore NyLPC_TcSemaphore_t; 00054 00055 #if NyLPC_ARCH==NyLPC_ARCH_FREERTOS 00056 00057 struct NyLPC_TcSemaphore 00058 { 00059 xSemaphoreHandle _handle; 00060 }; 00061 #elif NyLPC_ARCH==NyLPC_ARCH_MBEDRTOS 00062 struct NyLPC_TcSemaphore 00063 { 00064 void* _handle;//Semaphore* 00065 }; 00066 #elif NyLPC_ARCH==NyLPC_ARCH_WIN32 00067 //dumy definition! 00068 struct NyLPC_TcSemaphore 00069 { 00070 int dummy; 00071 }; 00072 #else 00073 #error Bad NyLPC_ARCH! 00074 #endif 00075 00076 00077 void NyLPC_cSemaphore_initialize(NyLPC_TcSemaphore_t* i_inst); 00078 #define NyLPC_cSemaphore_finalize(i) 00079 void NyLPC_cSemaphore_giveFromISR(const NyLPC_TcSemaphore_t* i_inst); 00080 void NyLPC_cSemaphore_take(const NyLPC_TcSemaphore_t* i_inst,NyLPC_TUInt32 i_timeout); 00081 00082 #ifdef __cplusplus 00083 } 00084 #endif /* __cplusplus */ 00085 00086 #endif /* NYLPC_CSEMAPHORE_H_ */ 00087 00088 00089
Generated on Tue Jul 12 2022 16:22:59 by
