$search
00001 /* 00002 Aseba - an event-based framework for distributed robot control 00003 Copyright (C) 2007--2012: 00004 Stephane Magnenat <stephane at magnenat dot net> 00005 (http://stephane.magnenat.net) 00006 and other contributors, see authors.txt for details 00007 00008 This program 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, version 3 of the License. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef __ASEBA_CONSTS_H 00022 #define __ASEBA_CONSTS_H 00023 00028 00030 #define ASEBA_VERSION "1.2.1" 00031 00033 #define ASEBA_VERSION_INT 10201 00034 00036 #define ASEBA_PROTOCOL_VERSION 4 00037 00039 #define ASEBA_DEFAULT_LISTEN_TARGET "tcpin:33333" 00040 00042 #define ASEBA_DEFAULT_TARGET "tcp:localhost;33333" 00043 00045 #define ASEBA_DEFAULT_HOST "localhost" 00046 00048 #define ASEBA_DEFAULT_PORT 33333 00049 00050 00052 typedef enum 00053 { 00054 ASEBA_BYTECODE_STOP = 0x0, 00055 ASEBA_BYTECODE_SMALL_IMMEDIATE = 0x1, 00056 ASEBA_BYTECODE_LARGE_IMMEDIATE = 0x2, 00057 ASEBA_BYTECODE_LOAD = 0x3, 00058 ASEBA_BYTECODE_STORE = 0x4, 00059 ASEBA_BYTECODE_LOAD_INDIRECT = 0x5, 00060 ASEBA_BYTECODE_STORE_INDIRECT = 0x6, 00061 ASEBA_BYTECODE_UNARY_ARITHMETIC = 0x7, 00062 ASEBA_BYTECODE_BINARY_ARITHMETIC = 0x8, 00063 ASEBA_BYTECODE_JUMP = 0x9, 00064 ASEBA_BYTECODE_CONDITIONAL_BRANCH = 0xA, 00065 ASEBA_BYTECODE_EMIT = 0xB, 00066 ASEBA_BYTECODE_NATIVE_CALL = 0xC, 00067 ASEBA_BYTECODE_SUB_CALL = 0xD, 00068 ASEBA_BYTECODE_SUB_RET = 0xE 00069 } AsebaBytecodeId; 00070 00072 typedef enum 00073 { 00074 // arithmetic 00075 ASEBA_OP_SHIFT_LEFT = 0x0, 00076 ASEBA_OP_SHIFT_RIGHT, 00077 ASEBA_OP_ADD, 00078 ASEBA_OP_SUB, 00079 ASEBA_OP_MULT, 00080 ASEBA_OP_DIV, 00081 ASEBA_OP_MOD, 00082 // binary arithmetic 00083 ASEBA_OP_BIT_OR, 00084 ASEBA_OP_BIT_XOR, 00085 ASEBA_OP_BIT_AND, 00086 // comparison 00087 ASEBA_OP_EQUAL, 00088 ASEBA_OP_NOT_EQUAL, 00089 ASEBA_OP_BIGGER_THAN, 00090 ASEBA_OP_BIGGER_EQUAL_THAN, 00091 ASEBA_OP_SMALLER_THAN, 00092 ASEBA_OP_SMALLER_EQUAL_THAN, 00093 // logic 00094 ASEBA_OP_OR, 00095 ASEBA_OP_AND 00096 } AsebaBinaryOperator; 00097 00099 #define ASEBA_BINARY_OPERATOR_MASK 0xff 00100 00102 typedef enum 00103 { 00104 ASEBA_UNARY_OP_SUB = 0x0, 00105 ASEBA_UNARY_OP_ABS, 00106 ASEBA_UNARY_OP_BIT_NOT, 00107 ASEBA_UNARY_OP_NOT // < not used for the VM, only for parsing, reduced by compiler using de Morgan and comparison inversion 00108 } AsebaUnaryOperator; 00109 00111 #define ASEBA_UNARY_OPERATOR_MASK 0xff 00112 00114 #define ASEBA_IF_IS_WHEN_BIT 8 00115 00116 #define ASEBA_IF_WAS_TRUE_BIT 9 00117 00119 typedef enum 00120 { 00122 ASEBA_VM_EVENT_ACTIVE_MASK = 0x1, 00124 ASEBA_VM_STEP_BY_STEP_MASK = 0x2, 00126 ASEBA_VM_EVENT_RUNNING_MASK = 0x4 00127 } AsebaExecutionStates; 00128 00130 typedef enum 00131 { 00132 ASEBA_EVENT_INIT = 0xFFFF, 00133 ASEBA_EVENT_LOCAL_EVENTS_START = 0xFFFE, 00134 } AsebaSpecialEventId; 00135 00137 #define AsebaBytecodeFromId(id) ((id) << 12) 00138 00140 typedef enum 00141 { 00142 /* from bootloader control program to a specific node */ 00143 ASEBA_MESSAGE_BOOTLOADER_RESET = 0x8000, 00144 ASEBA_MESSAGE_BOOTLOADER_READ_PAGE, 00145 ASEBA_MESSAGE_BOOTLOADER_WRITE_PAGE, 00146 ASEBA_MESSAGE_BOOTLOADER_PAGE_DATA_WRITE, 00147 00148 /* from node to bootloader control program */ 00149 ASEBA_MESSAGE_BOOTLOADER_DESCRIPTION, 00150 ASEBA_MESSAGE_BOOTLOADER_PAGE_DATA_READ, 00151 ASEBA_MESSAGE_BOOTLOADER_ACK, 00152 00153 /* from a specific node */ 00154 ASEBA_MESSAGE_DESCRIPTION = 0x9000, 00155 ASEBA_MESSAGE_NAMED_VARIABLE_DESCRIPTION, 00156 ASEBA_MESSAGE_LOCAL_EVENT_DESCRIPTION, 00157 ASEBA_MESSAGE_NATIVE_FUNCTION_DESCRIPTION, 00158 ASEBA_MESSAGE_DISCONNECTED, 00159 ASEBA_MESSAGE_VARIABLES, 00160 ASEBA_MESSAGE_ARRAY_ACCESS_OUT_OF_BOUNDS, 00161 ASEBA_MESSAGE_DIVISION_BY_ZERO, 00162 ASEBA_MESSAGE_EVENT_EXECUTION_KILLED, 00163 ASEBA_MESSAGE_NODE_SPECIFIC_ERROR, 00164 ASEBA_MESSAGE_EXECUTION_STATE_CHANGED, 00165 ASEBA_MESSAGE_BREAKPOINT_SET_RESULT, 00166 00167 /* from IDE to all nodes */ 00168 ASEBA_MESSAGE_GET_DESCRIPTION = 0xA000, 00169 00170 /* from IDE to a specific node */ 00171 ASEBA_MESSAGE_SET_BYTECODE, 00172 ASEBA_MESSAGE_RESET, 00173 ASEBA_MESSAGE_RUN, 00174 ASEBA_MESSAGE_PAUSE, 00175 ASEBA_MESSAGE_STEP, 00176 ASEBA_MESSAGE_STOP, 00177 ASEBA_MESSAGE_GET_EXECUTION_STATE, 00178 ASEBA_MESSAGE_BREAKPOINT_SET, 00179 ASEBA_MESSAGE_BREAKPOINT_CLEAR, 00180 ASEBA_MESSAGE_BREAKPOINT_CLEAR_ALL, 00181 ASEBA_MESSAGE_GET_VARIABLES, 00182 ASEBA_MESSAGE_SET_VARIABLES, 00183 ASEBA_MESSAGE_WRITE_BYTECODE, 00184 ASEBA_MESSAGE_REBOOT, 00185 ASEBA_MESSAGE_SUSPEND_TO_RAM, 00186 00187 ASEBA_MESSAGE_INVALID = 0xFFFF 00188 } AsebaSystemMessagesTypes; 00189 00191 typedef enum 00192 { 00193 ASEBA_DEST_DEBUG = 0, 00194 ASEBA_DEST_INVALID = 0xFFFF 00195 } AsebaMessagesDests; 00196 00198 typedef enum 00199 { 00200 ASEBA_MAX_EVENT_ARG_COUNT = 258, 00201 } AsebaLimits; 00202 00204 #define ASEBA_MAX_EVENT_ARG_SIZE (ASEBA_MAX_EVENT_ARG_COUNT*2) 00205 00207 #define ASEBA_MAX_INNER_PACKET_SIZE (ASEBA_MAX_EVENT_ARG_SIZE+2) 00208 00210 #define ASEBA_MAX_OUTER_PACKET_SIZE (ASEBA_MAX_INNER_PACKET_SIZE+4) 00211 00213 #define ASEBA_MAX_PACKET_SIZE ASEBA_MAX_INNER_PACKET_SIZE 00214 00217 #endif