LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
lms2012.h File Reference
#include <asm/types.h>
#include "lmstypes.h"
#include "bytecodes.h"

Go to the source code of this file.

Data Structures

struct  OBJ
 
struct  BRKP
 
struct  PRG
 
struct  TYPES
 
struct  DEVCON
 
struct  UARTCTL
 
struct  IICCTL
 
struct  IICDAT
 
struct  IICSTR
 
struct  TSTPIN
 
struct  TSTUART
 
struct  MOTORDATA
 
struct  STEPPOWER
 
struct  TIMEPOWER
 
struct  STEPSPEED
 
struct  TIMESPEED
 
struct  STEPSYNC
 
struct  TIMESYNC
 
struct  GLOBALS
 

Macros

#define DEBUG_RECHARGEABLE
 
#define LMS2012_H_
 
#define EP2   4
 Schematics revision D. More...
 
#define FINALB   3
 Schematics revision B and C. More...
 
#define FINAL   2
 Final prototype. More...
 
#define SIMULATION   0
 LEGO digital simulation. More...
 
#define PLATFORM_START   FINAL
 Oldest supported hardware (older versions will use this) More...
 
#define PLATFORM_END   EP2
 Newest supported hardware (newer versions will use this) More...
 
#define A4   -1
 
#define EVALBOARD   -2
 
#define ONE2ONE   1
 First real size prototype. More...
 
#define HARDWARE   FINAL
 Actual hardware platform (must be one of above) More...
 
#define UART1_FAKE_INTERRUPT
 Don't use real interrupt on UART1 (linux prompt) More...
 
#define DISABLE_PREEMPTED_VM
 Don't run VM as preempted. More...
 
#define DISABLE_USBSTICK_SUPPORT
 Don't use USB stick. More...
 
#define TESTDEVICE   3
 
#define OUTPUTS   vmOUTPUTS
 Number of output ports in the system. More...
 
#define INPUTS   vmINPUTS
 Number of input ports in the system. More...
 
#define BUTTONS   vmBUTTONS
 Number of buttons in the system. More...
 
#define LEDS   vmLEDS
 Number of LEDs in the system. More...
 
#define LCD_WIDTH   vmLCD_WIDTH
 LCD horizontal pixels. More...
 
#define LCD_HEIGHT   vmLCD_HEIGHT
 LCD vertical pixels. More...
 
#define TOPLINE_HEIGHT   vmTOPLINE_HEIGHT
 Top line vertical pixels. More...
 
#define LCD_STORE_LEVELS   vmLCD_STORE_LEVELS
 Store levels. More...
 
#define FG_COLOR   vmFG_COLOR
 Foreground color. More...
 
#define BG_COLOR   vmBG_COLOR
 Background color. More...
 
#define CHAIN_DEPT   vmCHAIN_DEPT
 Number of bricks in the USB daisy chain (master + slaves) More...
 
#define EVENT_BT_PIN   vmEVENT_BT_PIN
 
#define MEMORY_FOLDER   vmMEMORY_FOLDER
 
#define PROGRAM_FOLDER   vmPROGRAM_FOLDER
 
#define DATALOG_FOLDER   vmDATALOG_FOLDER
 
#define SDCARD_FOLDER   vmSDCARD_FOLDER
 
#define USBSTICK_FOLDER   vmUSBSTICK_FOLDER
 
#define DETAILS_FILE   vmDETAILS_FILE
 File containing firmware version. More...
 
#define EXT_SOUND   vmEXT_SOUND
 Rudolf sound file. More...
 
#define EXT_GRAPHICS   vmEXT_GRAPHICS
 Rudolf graphics file. More...
 
#define EXT_BYTECODE   vmEXT_BYTECODE
 Rudolf byte code file. More...
 
#define EXT_TEXT   vmEXT_TEXT
 Rudolf text file. More...
 
#define EXT_DATALOG   vmEXT_DATALOG
 Rudolf datalog file. More...
 
#define EXT_PROGRAM   vmEXT_PROGRAM
 Rudolf program byte code file. More...
 
#define EXT_CONFIG   vmEXT_CONFIG
 rudolf configuration file More...
 
#define UPDATE_TIME1   2
 Update repeat time1 [mS]. More...
 
#define UPDATE_TIME2   10
 Update repeat time2 [mS]. More...
 
#define UPDATE_MEMORY   200
 Update memory size [mS]. More...
 
#define UPDATE_SDCARD   500
 Update sdcard size [mS]. More...
 
#define UPDATE_USBSTICK   500
 Update usbstick size [mS]. More...
 
#define MAX_SOUND_DATA_SIZE   250
 
#define SOUND_CHUNK   250
 
#define SOUND_ADPCM_CHUNK   125
 
#define SOUND_MASTER_CLOCK   132000000
 
#define SOUND_TONE_MASTER_CLOCK   1031250
 
#define SOUND_MIN_FRQ   250
 
#define SOUND_MAX_FRQ   10000
 
#define SOUND_MAX_LEVEL   8
 
#define SOUND_FILE_BUFFER_SIZE   SOUND_CHUNK + 2
 
#define SOUND_BUFFER_COUNT   3
 
#define SOUND_FILE_FORMAT_NORMAL   0x0100
 
#define SOUND_FILE_FORMAT_COMPRESSED   0x0101
 
#define VtoC(V)   ((UWORD)((V * ADC_RES) / ADC_REF))
 
#define CtoV(C)   ((UWORD)((C * ADC_REF) / ADC_RES))
 
#define MtoV(M)   ((UWORD)((M * ADC_REF * 100) / (ADC_RES * 52)))
 
#define KB   1024
 
#define TYPE_NAME_LENGTH   11
 
#define SYMBOL_LENGTH   4
 Symbol leng th (not including zero) More...
 
#define TYPE_PARAMETERS   19
 Number of members in the structure above. More...
 
#define MAX_DEVICE_INFOLENGTH   54
 Number of bytes in the structure above (can not be changed) More...
 
#define ERR_STRING_SIZE   vmERR_STRING_SIZE
 
#define COLORS   4
 
#define CALPOINTS   3
 
#define UART_PORT_CHANGED   0x01
 Input port changed. More...
 
#define UART_DATA_READY   0x08
 Data is ready. More...
 
#define UART_WRITE_REQUEST   0x10
 Write request. More...
 
#define UART_SET_CONN   _IOWR('u',0,DEVCON)
 
#define UART_READ_MODE_INFO   _IOWR('u',1,UARTCTL)
 
#define UART_NACK_MODE_INFO   _IOWR('u',2,UARTCTL)
 
#define UART_CLEAR_CHANGED   _IOWR('u',3,UARTCTL)
 
#define IIC_PORT_CHANGED   0x01
 Input port changed. More...
 
#define IIC_DATA_READY   0x08
 Data is ready. More...
 
#define IIC_WRITE_REQUEST   0x10
 Write request. More...
 
#define IIC_SET_CONN   _IOWR('i',2,DEVCON)
 
#define IIC_READ_TYPE_INFO   _IOWR('i',3,IICCTL)
 
#define IIC_SETUP   _IOWR('i',5,IICDAT)
 
#define IIC_SET   _IOWR('i',6,IICSTR)
 
#define TST_PIN_LENGTH   8
 
#define TST_PIN_ON   _IOWR('t',1,TSTPIN)
 
#define TST_PIN_OFF   _IOWR('t',2,TSTPIN)
 
#define TST_PIN_READ   _IOWR('t',3,TSTPIN)
 
#define TST_PIN_WRITE   _IOWR('t',4,TSTPIN)
 
#define TST_UART_LENGTH   UART_BUFFER_SIZE
 
#define TST_UART_ON   _IOWR('t',5,TSTUART)
 
#define TST_UART_OFF   _IOWR('t',6,TSTUART)
 
#define TST_UART_EN   _IOWR('t',7,TSTUART)
 
#define TST_UART_DIS   _IOWR('t',8,TSTUART)
 
#define TST_UART_READ   _IOWR('t',9,TSTUART)
 
#define TST_UART_WRITE   _IOWR('t',10,TSTUART)
 
#define LCD_BUFFER_SIZE   (((LCD_WIDTH + 7) / 8) * LCD_HEIGHT)
 
#define LCD_TOPLINE_SIZE   (((LCD_WIDTH + 7) / 8) * (TOPLINE_HEIGHT + 1))
 
#define PRINTBUFFERSIZE   160
 

Typedefs

typedef void(* PRIM )(void)
 Prototype for all byte codes. More...
 

Enumerations

enum  { FALSE = 0, TRUE = 1 }
 
enum  TYPE {
  TYPE_NXT_TOUCH = 1, TYPE_NXT_LIGHT = 2, TYPE_NXT_SOUND = 3, TYPE_NXT_COLOR = 4,
  TYPE_TACHO = 7, TYPE_MINITACHO = 8, TYPE_NEWTACHO = 9, TYPE_THIRD_PARTY_START = 50,
  TYPE_THIRD_PARTY_END = 99, TYPE_IIC_UNKNOWN = 100, TYPE_NXT_TEST = 101, TYPE_NXT_IIC = 123,
  TYPE_TERMINAL = 124, TYPE_UNKNOWN = 125, TYPE_NONE = 126, TYPE_ERROR = 127
}
 
enum  DSPSTAT {
  NOBREAK = 0x0100, STOPBREAK = 0x0200, SLEEPBREAK = 0x0400, INSTRBREAK = 0x0800,
  BUSYBREAK = 0x1000, PRGBREAK = 0x2000, USERBREAK = 0x4000, FAILBREAK = 0x8000
}
 
enum  ERR {
  TOO_MANY_ERRORS_TO_BUFFER, TYPEDATA_TABEL_FULL, TYPEDATA_FILE_NOT_FOUND, ANALOG_DEVICE_FILE_NOT_FOUND,
  ANALOG_SHARED_MEMORY, UART_DEVICE_FILE_NOT_FOUND, UART_SHARED_MEMORY, IIC_DEVICE_FILE_NOT_FOUND,
  IIC_SHARED_MEMORY, DISPLAY_SHARED_MEMORY, UI_SHARED_MEMORY, UI_DEVICE_FILE_NOT_FOUND,
  LCD_DEVICE_FILE_NOT_FOUND, OUTPUT_SHARED_MEMORY, COM_COULD_NOT_OPEN_FILE, COM_NAME_TOO_SHORT,
  COM_NAME_TOO_LONG, COM_INTERNAL, VM_INTERNAL, VM_PROGRAM_VALIDATION,
  VM_PROGRAM_NOT_STARTED, VM_PROGRAM_FAIL_BREAK, VM_PROGRAM_INSTRUCTION_BREAK, VM_PROGRAM_NOT_FOUND,
  SOUND_DEVICE_FILE_NOT_FOUND, SOUND_SHARED_MEMORY, FILE_OPEN_ERROR, FILE_READ_ERROR,
  FILE_WRITE_ERROR, FILE_CLOSE_ERROR, FILE_GET_HANDLE_ERROR, FILE_NAME_ERROR,
  USB_SHARED_MEMORY, OUT_OF_MEMORY, ERRORS
}
 

Functions

void PrimParAdvance (void)
 Skip next encoded parameter from byte code stream. More...
 
void * PrimParPointer (void)
 Get next encoded parameter from byte code stream. More...
 
IP GetImageStart (void)
 Get pointer to actual start of byte code image. More...
 
void SetDispatchStatus (DSPSTAT Status)
 Set object (dispatch) status. More...
 
void SetInstructions (ULONG Instructions)
 Set instructions. More...
 
PRGID CurrentProgramId (void)
 Get current program id. More...
 
OBJSTAT ProgramStatus (PRGID PrgId)
 Get program status. More...
 
OBJSTAT ProgramStatusChange (PRGID PrgId)
 Get program status change. More...
 
void ProgramEnd (PRGID PrgId)
 Exit program nicely (freeing up memory) More...
 
OBJID CallingObjectId (void)
 Get calling object id. More...
 
void AdjustObjectIp (IMOFFS Value)
 Adjust current instruction pointer. More...
 
IP GetObjectIp (void)
 Get current instruction pointer. More...
 
void SetObjectIp (IP Ip)
 Set current instruction pointer. More...
 
ULONG GetTimeUS (void)
 
ULONG GetTimeMS (void)
 
ULONG GetTime (void)
 
ULONG CurrentObjectIp (void)
 
void VmPrint (char *pString)
 
void SetTerminalEnable (DATA8 Value)
 
DATA8 GetTerminalEnable (void)
 
void GetResourcePath (char *pString, DATA8 MaxLength)
 
void * VmMemoryResize (HANDLER Handle, DATA32 Elements)
 
void SetVolumePercent (DATA8 Volume)
 
DATA8 GetVolumePercent (void)
 
void SetSleepMinutes (DATA8 Minutes)
 
DATA8 GetSleepMinutes (void)
 
DSPSTAT ExecuteByteCode (IP pByteCode, GP pGlobals, LP pLocals)
 Execute byte code stream (C-call) More...
 
DATA8 CheckSdcard (DATA8 *pChanged, DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
 
DATA8 CheckUsbstick (DATA8 *pChanged, DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
 
void SetUiUpdate (void)
 
RESULT ValidateChar (DATA8 *pChar, DATA8 Set)
 
RESULT ValidateString (DATA8 *pString, DATA8 Set)
 
ERR LogErrorGet (void)
 
void LogErrorNumber (ERR Error)
 
DATA8 LogErrorNumberExists (ERR Error)
 

Variables

GLOBALS VMInstance
 

Macro Definition Documentation

#define A4   -1

Definition at line 108 of file lms2012.h.

#define BG_COLOR   vmBG_COLOR

Background color.

Definition at line 204 of file lms2012.h.

#define BUTTONS   vmBUTTONS

Number of buttons in the system.

Definition at line 193 of file lms2012.h.

#define CALPOINTS   3

Definition at line 930 of file lms2012.h.

#define CHAIN_DEPT   vmCHAIN_DEPT

Number of bricks in the USB daisy chain (master + slaves)

Definition at line 206 of file lms2012.h.

#define COLORS   4

Definition at line 929 of file lms2012.h.

#define CtoV (   C)    ((UWORD)((C * ADC_REF) / ADC_RES))

Definition at line 550 of file lms2012.h.

#define DATALOG_FOLDER   vmDATALOG_FOLDER

Definition at line 214 of file lms2012.h.

#define DEBUG_RECHARGEABLE

Definition at line 90 of file lms2012.h.

#define DETAILS_FILE   vmDETAILS_FILE

File containing firmware version.

Definition at line 219 of file lms2012.h.

#define DISABLE_PREEMPTED_VM

Don't run VM as preempted.

Definition at line 160 of file lms2012.h.

#define DISABLE_USBSTICK_SUPPORT

Don't use USB stick.

Definition at line 162 of file lms2012.h.

#define EP2   4

Schematics revision D.

Definition at line 99 of file lms2012.h.

#define ERR_STRING_SIZE   vmERR_STRING_SIZE

Definition at line 921 of file lms2012.h.

#define EVALBOARD   -2

Definition at line 109 of file lms2012.h.

#define EVENT_BT_PIN   vmEVENT_BT_PIN

Definition at line 208 of file lms2012.h.

#define EXT_BYTECODE   vmEXT_BYTECODE

Rudolf byte code file.

Definition at line 225 of file lms2012.h.

#define EXT_CONFIG   vmEXT_CONFIG

rudolf configuration file

Definition at line 229 of file lms2012.h.

#define EXT_DATALOG   vmEXT_DATALOG

Rudolf datalog file.

Definition at line 227 of file lms2012.h.

#define EXT_GRAPHICS   vmEXT_GRAPHICS

Rudolf graphics file.

Definition at line 224 of file lms2012.h.

#define EXT_PROGRAM   vmEXT_PROGRAM

Rudolf program byte code file.

Definition at line 228 of file lms2012.h.

#define EXT_SOUND   vmEXT_SOUND

Rudolf sound file.

Definition at line 223 of file lms2012.h.

#define EXT_TEXT   vmEXT_TEXT

Rudolf text file.

Definition at line 226 of file lms2012.h.

#define FG_COLOR   vmFG_COLOR

Foreground color.

Definition at line 203 of file lms2012.h.

#define FINAL   2

Final prototype.

Definition at line 101 of file lms2012.h.

#define FINALB   3

Schematics revision B and C.

Definition at line 100 of file lms2012.h.

#define HARDWARE   FINAL

Actual hardware platform (must be one of above)

Definition at line 118 of file lms2012.h.

#define IIC_DATA_READY   0x08

Data is ready.

Definition at line 1122 of file lms2012.h.

#define IIC_PORT_CHANGED   0x01

Input port changed.

Definition at line 1121 of file lms2012.h.

#define IIC_READ_TYPE_INFO   _IOWR('i',3,IICCTL)

Definition at line 1167 of file lms2012.h.

#define IIC_SET   _IOWR('i',6,IICSTR)

Definition at line 1169 of file lms2012.h.

#define IIC_SET_CONN   _IOWR('i',2,DEVCON)

Definition at line 1166 of file lms2012.h.

#define IIC_SETUP   _IOWR('i',5,IICDAT)

Definition at line 1168 of file lms2012.h.

#define IIC_WRITE_REQUEST   0x10

Write request.

Definition at line 1123 of file lms2012.h.

#define INPUTS   vmINPUTS

Number of input ports in the system.

Definition at line 192 of file lms2012.h.

#define KB   1024

Definition at line 553 of file lms2012.h.

#define LCD_BUFFER_SIZE   (((LCD_WIDTH + 7) / 8) * LCD_HEIGHT)

Definition at line 1237 of file lms2012.h.

#define LCD_HEIGHT   vmLCD_HEIGHT

LCD vertical pixels.

Definition at line 197 of file lms2012.h.

#define LCD_STORE_LEVELS   vmLCD_STORE_LEVELS

Store levels.

Definition at line 199 of file lms2012.h.

#define LCD_TOPLINE_SIZE   (((LCD_WIDTH + 7) / 8) * (TOPLINE_HEIGHT + 1))

Definition at line 1238 of file lms2012.h.

#define LCD_WIDTH   vmLCD_WIDTH

LCD horizontal pixels.

Definition at line 196 of file lms2012.h.

#define LEDS   vmLEDS

Number of LEDs in the system.

Definition at line 194 of file lms2012.h.

#define LMS2012_H_

Definition at line 95 of file lms2012.h.

#define MAX_DEVICE_INFOLENGTH   54

Number of bytes in the structure above (can not be changed)

Definition at line 800 of file lms2012.h.

#define MAX_SOUND_DATA_SIZE   250

Definition at line 528 of file lms2012.h.

#define MEMORY_FOLDER   vmMEMORY_FOLDER

Definition at line 212 of file lms2012.h.

#define MtoV (   M)    ((UWORD)((M * ADC_REF * 100) / (ADC_RES * 52)))

Definition at line 551 of file lms2012.h.

#define ONE2ONE   1

First real size prototype.

Definition at line 110 of file lms2012.h.

#define OUTPUTS   vmOUTPUTS

Number of output ports in the system.

Definition at line 191 of file lms2012.h.

#define PLATFORM_END   EP2

Newest supported hardware (newer versions will use this)

Definition at line 105 of file lms2012.h.

#define PLATFORM_START   FINAL

Oldest supported hardware (older versions will use this)

Definition at line 104 of file lms2012.h.

#define PRINTBUFFERSIZE   160

Definition at line 1419 of file lms2012.h.

#define PROGRAM_FOLDER   vmPROGRAM_FOLDER

Definition at line 213 of file lms2012.h.

#define SDCARD_FOLDER   vmSDCARD_FOLDER

Definition at line 215 of file lms2012.h.

#define SIMULATION   0

LEGO digital simulation.

Definition at line 102 of file lms2012.h.

#define SOUND_ADPCM_CHUNK   125

Definition at line 530 of file lms2012.h.

#define SOUND_BUFFER_COUNT   3

Definition at line 537 of file lms2012.h.

#define SOUND_CHUNK   250

Definition at line 529 of file lms2012.h.

#define SOUND_FILE_BUFFER_SIZE   SOUND_CHUNK + 2

Definition at line 536 of file lms2012.h.

#define SOUND_FILE_FORMAT_COMPRESSED   0x0101

Definition at line 539 of file lms2012.h.

#define SOUND_FILE_FORMAT_NORMAL   0x0100

Definition at line 538 of file lms2012.h.

#define SOUND_MASTER_CLOCK   132000000

Definition at line 531 of file lms2012.h.

#define SOUND_MAX_FRQ   10000

Definition at line 534 of file lms2012.h.

#define SOUND_MAX_LEVEL   8

Definition at line 535 of file lms2012.h.

#define SOUND_MIN_FRQ   250

Definition at line 533 of file lms2012.h.

#define SOUND_TONE_MASTER_CLOCK   1031250

Definition at line 532 of file lms2012.h.

#define SYMBOL_LENGTH   4

Symbol leng th (not including zero)

Definition at line 769 of file lms2012.h.

#define TESTDEVICE   3

Definition at line 175 of file lms2012.h.

#define TOPLINE_HEIGHT   vmTOPLINE_HEIGHT

Top line vertical pixels.

Definition at line 198 of file lms2012.h.

#define TST_PIN_LENGTH   8

Definition at line 1174 of file lms2012.h.

#define TST_PIN_OFF   _IOWR('t',2,TSTPIN)

Definition at line 1185 of file lms2012.h.

#define TST_PIN_ON   _IOWR('t',1,TSTPIN)

Definition at line 1184 of file lms2012.h.

#define TST_PIN_READ   _IOWR('t',3,TSTPIN)

Definition at line 1186 of file lms2012.h.

#define TST_PIN_WRITE   _IOWR('t',4,TSTPIN)

Definition at line 1187 of file lms2012.h.

#define TST_UART_DIS   _IOWR('t',8,TSTUART)

Definition at line 1206 of file lms2012.h.

#define TST_UART_EN   _IOWR('t',7,TSTUART)

Definition at line 1205 of file lms2012.h.

#define TST_UART_LENGTH   UART_BUFFER_SIZE

Definition at line 1192 of file lms2012.h.

#define TST_UART_OFF   _IOWR('t',6,TSTUART)

Definition at line 1204 of file lms2012.h.

#define TST_UART_ON   _IOWR('t',5,TSTUART)

Definition at line 1203 of file lms2012.h.

#define TST_UART_READ   _IOWR('t',9,TSTUART)

Definition at line 1207 of file lms2012.h.

#define TST_UART_WRITE   _IOWR('t',10,TSTUART)

Definition at line 1208 of file lms2012.h.

#define TYPE_NAME_LENGTH   11

Definition at line 768 of file lms2012.h.

#define TYPE_PARAMETERS   19

Number of members in the structure above.

Definition at line 799 of file lms2012.h.

#define UART1_FAKE_INTERRUPT

Don't use real interrupt on UART1 (linux prompt)

Definition at line 155 of file lms2012.h.

#define UART_CLEAR_CHANGED   _IOWR('u',3,UARTCTL)

Definition at line 1078 of file lms2012.h.

#define UART_DATA_READY   0x08

Data is ready.

Definition at line 1054 of file lms2012.h.

#define UART_NACK_MODE_INFO   _IOWR('u',2,UARTCTL)

Definition at line 1077 of file lms2012.h.

#define UART_PORT_CHANGED   0x01

Input port changed.

Definition at line 1053 of file lms2012.h.

#define UART_READ_MODE_INFO   _IOWR('u',1,UARTCTL)

Definition at line 1076 of file lms2012.h.

#define UART_SET_CONN   _IOWR('u',0,DEVCON)

Definition at line 1075 of file lms2012.h.

#define UART_WRITE_REQUEST   0x10

Write request.

Definition at line 1055 of file lms2012.h.

#define UPDATE_MEMORY   200

Update memory size [mS].

Definition at line 522 of file lms2012.h.

#define UPDATE_SDCARD   500

Update sdcard size [mS].

Definition at line 523 of file lms2012.h.

#define UPDATE_TIME1   2

Update repeat time1 [mS].

Definition at line 520 of file lms2012.h.

#define UPDATE_TIME2   10

Update repeat time2 [mS].

Definition at line 521 of file lms2012.h.

#define UPDATE_USBSTICK   500

Update usbstick size [mS].

Definition at line 524 of file lms2012.h.

#define USBSTICK_FOLDER   vmUSBSTICK_FOLDER

Definition at line 216 of file lms2012.h.

#define VtoC (   V)    ((UWORD)((V * ADC_RES) / ADC_REF))


Definition at line 549 of file lms2012.h.

Typedef Documentation

typedef void(* PRIM)(void)

Prototype for all byte codes.

Definition at line 678 of file lms2012.h.

Enumeration Type Documentation

anonymous enum
Enumerator
FALSE 
TRUE 

Definition at line 555 of file lms2012.h.

enum DSPSTAT

Dispatch status values

Enumerator
NOBREAK 

Dispatcher running (looping)

STOPBREAK 

Break because of program stop.

SLEEPBREAK 

Break because of sleeping.

INSTRBREAK 

Break because of opcode break.

BUSYBREAK 

Break because of waiting for completion.

PRGBREAK 

Break because of program break.

USERBREAK 

Break because of user decision.

FAILBREAK 

Break because of fail.

Definition at line 665 of file lms2012.h.

enum ERR

Describes error numbers

Enumerator
TOO_MANY_ERRORS_TO_BUFFER 
TYPEDATA_TABEL_FULL 
TYPEDATA_FILE_NOT_FOUND 
ANALOG_DEVICE_FILE_NOT_FOUND 
ANALOG_SHARED_MEMORY 
UART_DEVICE_FILE_NOT_FOUND 
UART_SHARED_MEMORY 
IIC_DEVICE_FILE_NOT_FOUND 
IIC_SHARED_MEMORY 
DISPLAY_SHARED_MEMORY 
UI_SHARED_MEMORY 
UI_DEVICE_FILE_NOT_FOUND 
LCD_DEVICE_FILE_NOT_FOUND 
OUTPUT_SHARED_MEMORY 
COM_COULD_NOT_OPEN_FILE 
COM_NAME_TOO_SHORT 
COM_NAME_TOO_LONG 
COM_INTERNAL 
VM_INTERNAL 
VM_PROGRAM_VALIDATION 
VM_PROGRAM_NOT_STARTED 
VM_PROGRAM_FAIL_BREAK 
VM_PROGRAM_INSTRUCTION_BREAK 
VM_PROGRAM_NOT_FOUND 
SOUND_DEVICE_FILE_NOT_FOUND 
SOUND_SHARED_MEMORY 
FILE_OPEN_ERROR 
FILE_READ_ERROR 
FILE_WRITE_ERROR 
FILE_CLOSE_ERROR 
FILE_GET_HANDLE_ERROR 
FILE_NAME_ERROR 
USB_SHARED_MEMORY 
OUT_OF_MEMORY 
ERRORS 

Definition at line 807 of file lms2012.h.

enum TYPE
Enumerator
TYPE_NXT_TOUCH 

Device is NXT touch sensor.

TYPE_NXT_LIGHT 

Device is NXT light sensor.

TYPE_NXT_SOUND 

Device is NXT sound sensor.

TYPE_NXT_COLOR 

Device is NXT color sensor.

TYPE_TACHO 

Device is a tacho motor.

TYPE_MINITACHO 

Device is a mini tacho motor.

TYPE_NEWTACHO 

Device is a new tacho motor.

TYPE_THIRD_PARTY_START 
TYPE_THIRD_PARTY_END 
TYPE_IIC_UNKNOWN 
TYPE_NXT_TEST 

Device is a NXT ADC test sensor.

TYPE_NXT_IIC 

Device is NXT IIC sensor.

TYPE_TERMINAL 

Port is connected to a terminal.

TYPE_UNKNOWN 

Port not empty but type has not been determined.

TYPE_NONE 

Port empty or not available.

TYPE_ERROR 

Port not empty and type is invalid.

Definition at line 563 of file lms2012.h.

Function Documentation

void AdjustObjectIp ( IMOFFS  Value)

Adjust current instruction pointer.

Parameters
ValueSigned offset to add

Definition at line 287 of file lms2012.c.

OBJID CallingObjectId ( void  )

Get calling object id.

Returns
OBJID Current object id

Definition at line 196 of file lms2012.c.

DATA8 CheckSdcard ( DATA8 pChanged,
DATA32 pTotal,
DATA32 pFree,
DATA8  Force 
)

Definition at line 1855 of file lms2012.c.

DATA8 CheckUsbstick ( DATA8 pChanged,
DATA32 pTotal,
DATA32 pFree,
DATA8  Force 
)

Definition at line 1959 of file lms2012.c.

ULONG CurrentObjectIp ( void  )

Definition at line 333 of file lms2012.c.

PRGID CurrentProgramId ( void  )

Get current program id.

Returns
PRGID Current program id

Definition at line 207 of file lms2012.c.

DSPSTAT ExecuteByteCode ( IP  pByteCode,
GP  pGlobals,
LP  pLocals 
)

Execute byte code stream (C-call)

This call is able to execute up to "C_PRIORITY" byte codes instructions (no header necessary)

Parameters
(IP)Pointer to byte code stream (last byte code must be "opOBJECT_END")
(GP)Pointer to global variables to use (if none -> NULL)
(LP)Pointer to Local variables to use (if none -> NULL)
Returns
(DSPSTAT) Dispatch status

Example:

IMGDATA BC1[] = { opUI_WRITE,PUT_STRING,LCS,'L','E','G','O','','
',0,opUI_WRITE,WRITE_FLUSH,opOBJECT_END }; ExecuteByteCode(BC1,NULL,NULL);

Definition at line 535 of file lms2012.c.

IP GetImageStart ( void  )

Get pointer to actual start of byte code image.

Returns
IP Pointer to image

Definition at line 245 of file lms2012.c.

IP GetObjectIp ( void  )

Get current instruction pointer.

Returns
Current instruction pointer

Definition at line 298 of file lms2012.c.

void GetResourcePath ( char *  pString,
DATA8  MaxLength 
)

Definition at line 360 of file lms2012.c.

DATA8 GetSleepMinutes ( void  )

Definition at line 390 of file lms2012.c.

DATA8 GetTerminalEnable ( void  )

Definition at line 354 of file lms2012.c.

ULONG GetTime ( void  )

Definition at line 315 of file lms2012.c.

ULONG GetTimeMS ( void  )

Definition at line 321 of file lms2012.c.

ULONG GetTimeUS ( void  )

Definition at line 327 of file lms2012.c.

DATA8 GetVolumePercent ( void  )

Definition at line 378 of file lms2012.c.

ERR LogErrorGet ( void  )

Definition at line 495 of file lms2012.c.

void LogErrorNumber ( ERR  Error)

Definition at line 445 of file lms2012.c.

DATA8 LogErrorNumberExists ( ERR  Error)

Definition at line 470 of file lms2012.c.

void PrimParAdvance ( void  )

Skip next encoded parameter from byte code stream.

Definition at line 870 of file lms2012.c.

void* PrimParPointer ( void  )

Get next encoded parameter from byte code stream.

Returns
void Pointer to value

Definition at line 694 of file lms2012.c.

void ProgramEnd ( PRGID  PrgId)

Exit program nicely (freeing up memory)

Parameters
PrgIdProgram id (index)

Definition at line 1555 of file lms2012.c.

OBJSTAT ProgramStatus ( PRGID  PrgId)

Get program status.

Returns
OBJSTAT Program status

Definition at line 218 of file lms2012.c.

OBJSTAT ProgramStatusChange ( PRGID  PrgId)

Get program status change.

Returns
OBJSTAT Program status change

Definition at line 229 of file lms2012.c.

void SetDispatchStatus ( DSPSTAT  DspStat)

Set object (dispatch) status.

Parameters
DspStatNew dispatch status

Definition at line 256 of file lms2012.c.

void SetInstructions ( ULONG  Instructions)

Set instructions.

Parameters
ULONGInstructions

Definition at line 273 of file lms2012.c.

void SetObjectIp ( IP  Ip)

Set current instruction pointer.

Parameters
IpNew instruction pointer value

Definition at line 309 of file lms2012.c.

void SetSleepMinutes ( DATA8  Minutes)

Definition at line 384 of file lms2012.c.

void SetTerminalEnable ( DATA8  Value)

Definition at line 348 of file lms2012.c.

void SetUiUpdate ( void  )

Definition at line 396 of file lms2012.c.

void SetVolumePercent ( DATA8  Volume)

Definition at line 372 of file lms2012.c.

RESULT ValidateChar ( DATA8 pChar,
DATA8  Set 
)

Definition at line 5680 of file lms2012.c.

RESULT ValidateString ( DATA8 pString,
DATA8  Set 
)

Definition at line 5694 of file lms2012.c.

void* VmMemoryResize ( HANDLER  Handle,
DATA32  Elements 
)

Definition at line 366 of file lms2012.c.

void VmPrint ( char *  pString)

Definition at line 339 of file lms2012.c.

Variable Documentation

GLOBALS VMInstance

Definition at line 131 of file lms2012.c.