Aseba  1.5.5
Classes | Macros | Enumerations | Functions | Variables
vm.h File Reference

Definition of Aseba Virtual Machine. More...

#include "../common/types.h"

Go to the source code of this file.

Classes

struct  AsebaVMState
 This structure contains the state of the Aseba VM. More...
 

Macros

#define AsebaMaskSet(v, m)   ((v) |= (m))
 Set the part masked by m of v to 1.
 
#define AsebaMaskClear(v, m)   ((v) &= (~(m)))
 Set the part masked by m of v to 0.
 
#define AsebaMaskIsSet(v, m)   (((v) & (m)) != 0)
 Returns true if the part masked by m of v is 1.
 
#define AsebaMaskIsClear(v, m)   (((v) & (m)) == 0)
 Returns true if the part masked by m of v is 0.
 
#define AsebaSendMessageWords(vm, type, data, size)   AsebaSendMessage(vm,type,data,(size)*2)
 

Enumerations

enum  { ASEBA_MAX_BREAKPOINTS = 16 }
 
enum  AsebaAssertReason {
  ASEBA_ASSERT_UNKNOWN = 0, ASEBA_ASSERT_UNKNOWN_UNARY_OPERATOR, ASEBA_ASSERT_UNKNOWN_BINARY_OPERATOR, ASEBA_ASSERT_UNKNOWN_BYTECODE,
  ASEBA_ASSERT_STACK_OVERFLOW, ASEBA_ASSERT_STACK_UNDERFLOW, ASEBA_ASSERT_OUT_OF_VARIABLES_BOUNDS, ASEBA_ASSERT_OUT_OF_BYTECODE_BOUNDS,
  ASEBA_ASSERT_STEP_OUT_OF_RUN, ASEBA_ASSERT_BREAKPOINT_OUT_OF_BYTECODE_BOUNDS, ASEBA_ASSERT_EMIT_BUFFER_TOO_LONG
}
 Possible causes of AsebaAssert.
 

Functions

void AsebaVMInit (AsebaVMState *vm)
 Setup the execution status of the VM. More...
 
uint16 AsebaVMGetEventAddress (AsebaVMState *vm, uint16 event)
 Return the starting address of an event, or 0 if the event is not handled. More...
 
uint16 AsebaVMSetupEvent (AsebaVMState *vm, uint16 event)
 Setup VM to execute an event. More...
 
uint16 AsebaVMRun (AsebaVMState *vm, uint16 stepsLimit)
 Run the VM depending on the current execution mode. More...
 
void AsebaVMDebugMessage (AsebaVMState *vm, uint16 id, uint16 *data, uint16 dataLength)
 Execute a debug action from a debug message. More...
 
void AsebaVMEmitNodeSpecificError (AsebaVMState *vm, const char *message)
 Can be called by glue code (including native functions), to stop vm and emit a node specific error.
 
uint16 AsebaVMShouldDropPacket (AsebaVMState *vm, uint16 source, const uint8 *data)
 Return non-zero if VM will ignore the packet, 0 otherwise.
 
void AsebaSendMessage (AsebaVMState *vm, uint16 id, const void *data, uint16 size)
 Called by AsebaStep if there is a message (not an user event) to send. More...
 
void AsebaSendVariables (AsebaVMState *vm, uint16 start, uint16 length)
 Called by AsebaVMDebugMessage when some variables must be sent efficiently.
 
void AsebaSendDescription (AsebaVMState *vm)
 Called by AsebaVMDebugMessage when VM must send its description on the network. More...
 
void AsebaNativeFunction (AsebaVMState *vm, uint16 id)
 Called by AsebaStep to perform a native function call. More...
 
void AsebaWriteBytecode (AsebaVMState *vm)
 Called by AsebaVMDebugMessage when VM must write its bytecode to flash, write an empty function to leave feature unsupported.
 
void AsebaResetIntoBootloader (AsebaVMState *vm)
 Called by AsebaVMDebugMessage when VM must restart the node and enter to the bootloader, write an empty function to leave feature unsupported.
 
void AsebaPutVmToSleep (AsebaVMState *vm)
 Called by AsebaVMDebugMessage when VM must put to node in deep sleep. More...
 
void __attribute__ ((weak)) AsebaVMRunCB(AsebaVMState *vm)
 Called by AsebaVMDebugMessage when VM is going to be run. More...
 
void AsebaAssert (AsebaVMState *vm, AsebaAssertReason reason)
 If ASEBA_ASSERT is defined, this function is called when an error arise.
 

Variables

void const char * message
 

Detailed Description

Definition of Aseba Virtual Machine.