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_cMiMicVM.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_CMIMICVM_H_ 00027 #define NYLPC_CMIMICVM_H_ 00028 00029 #include "NyLPC_stdlib.h" 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif /* __cplusplus */ 00034 00035 typedef struct NyLPC_TcMiMicVM NyLPC_TcMiMicVM_t; 00036 struct NyLPC_TcMiMicVM_TEvent; 00037 00038 #define NyLPC_cMiMicVM_RESULT_OK 0x00000000 00039 #define NyLPC_cMiMicVM_RESULT_NG 0x80000000 00040 #define NyLPC_cMiMicVM_RESULT_RUNTIME_NG (NyLPC_cMiMicVM_RESULT_NG|0x00010000) 00041 #define NyLPC_cMiMicVM_RESULT_RUNTIME_NG_UNKNOWN_CALL (NyLPC_cMiMicVM_RESULT_RUNTIME_NG|0x00000021) 00042 #define NyLPC_cMiMicVM_RESULT_RUNTIME_NG_CALL (NyLPC_cMiMicVM_RESULT_RUNTIME_NG|0x00000022) 00043 #define NyLPC_cMiMicVM_RESULT_isOK(v) ((v&0x80000000)==0x00000000) 00044 00045 /** 00046 * MiMicVMのワークメモリの個数 00047 */ 00048 #define NyLPC_TcMiMicVM_NUMBER_OF_WM 8 00049 00050 typedef NyLPC_TUInt8 NyLPC_TcMiMicVM_OP_TYPE; 00051 typedef NyLPC_TUInt8 NyLPC_TcMiMicVM_OPR_TYPE; 00052 00053 typedef NyLPC_TBool (*NyLPC_TcMiMicVM_putStream)(struct NyLPC_TcMiMicVM_TEvent* i_evh,NyLPC_TUInt32 i_val); 00054 typedef NyLPC_TBool (*NyLPC_TcMiMicVM_getStream)(struct NyLPC_TcMiMicVM_TEvent* i_evh,NyLPC_TUInt32* o_val); 00055 /** 00056 * MiMicVMのCALL命令ハンドラ。 00057 * i_idに関数IDを指定する。 00058 * @param i_id 00059 * CALL命令のパラメタ 00060 * @param i_vm 00061 * VMのインスタンス。 00062 * @return 00063 * MiMicVMのエラーコード。 00064 * 関数コールが成功したら、NyLPC_cMiMicVM_RESULT_OKを返すこと。エラーの場合はNyLPC_cMiMicVM_RESULT_NG又はカスタムエラーコードを返すこと。 00065 */ 00066 typedef NyLPC_TUInt32 (*NyLPC_TcMiMicVM_nativeCall)(struct NyLPC_TcMiMicVM_TEvent* i_evh,NyLPC_TUInt32 i_id,NyLPC_TcMiMicVM_t* i_vm); 00067 typedef void (*NyLPC_TcMiMicVM_sleep)(struct NyLPC_TcMiMicVM_TEvent* i_evh,NyLPC_TUInt32 i_sleep_in_msec); 00068 struct NyLPC_TcMiMicVM_TEvent 00069 { 00070 NyLPC_TcMiMicVM_putStream put_stream; 00071 NyLPC_TcMiMicVM_getStream get_stream; 00072 NyLPC_TcMiMicVM_sleep sleep; 00073 NyLPC_TcMiMicVM_nativeCall native_call; 00074 }; 00075 00076 00077 struct NyLPC_TcMiMicVM 00078 { 00079 struct NyLPC_TcMiMicVM_TEvent* _event_handler; 00080 NyLPC_TUInt32 wm[NyLPC_TcMiMicVM_NUMBER_OF_WM]; 00081 }; 00082 void NyLPC_cMiMicVM_initialize(NyLPC_TcMiMicVM_t* i_inst,struct NyLPC_TcMiMicVM_TEvent* i_handler); 00083 #define NyLPC_cMiMicVM_finalize(i); 00084 NyLPC_TUInt32 NyLPC_cMiMicVM_run(NyLPC_TcMiMicVM_t* i_inst,const NyLPC_TUInt32* i_instruction,const NyLPC_TUInt16 i_size_of_instruction); 00085 NyLPC_TBool NyLPC_cMiMicVM_sput(NyLPC_TcMiMicVM_t* i_inst,NyLPC_TUInt32 i_val); 00086 NyLPC_TBool NyLPC_cMiMicVM_sget(NyLPC_TcMiMicVM_t* i_inst,NyLPC_TUInt32* o_val); 00087 00088 #ifdef __cplusplus 00089 } 00090 #endif /* __cplusplus */ 00091 00092 #endif /* NYLPC_CMIMICVM_H_ */
Generated on Tue Jul 12 2022 16:22:58 by
1.7.2
