/******************************************************************************
 * APPLICATION VERSIONS
 *****************************************************************************/
/*! \page applicationversions Application Versions
 * 
 *  This section describes the relative changes from previous version
 *
 *
 *\version lms2012_v109D
 *
 *-# As v109H but telnet enabled with password "Just a bit off the block!"                    \n
 *
 *
 *\version lms2012_v109
 *
 *-# As v1081 but version changed to 1.09                                                     \n
 *
 *
 *\version lms2012_v1081
 *
 *-# Telnet disabled                                                                          \n
 *
 *
 *\version lms2012_v108
 *
 *-# Support for edimax added                                                                 \n
 *
 *
 *\version lms2012_v107
 *
 *-# As v1066 but version changed to 1.07                                                     \n
 *
 *
 *\version lms2012_v1066
 *
 *-# ISSUE 4330 - sub call aliases block local issue UN-fixed                                 \n
 *
 *
 *\version lms2012_v1065
 *
 *-# Bluetooth bundle changed to "BA9Q76VTQG" "com.lego.education.ev3"                        \n
 *
 *
 *\version lms2012_v1064
 *
 *-# Bluetooth bundle changed to "BA9Q76VTQG" "com.lego.edu.ev3"                              \n
 *
 *
 *\version lms2012_v1063
 *
 *-# Bluetooth bundle changed                                                                 \n
 *
 *
 *\version lms2012_v1062
 *
 *-# Bluetooth bundle changed for test                                                        \n
 *
 *
 *\version lms2012_v1061
 *
 *-# "Brick Name" app implemented                                                             \n
 *
 *
 *\version lms2012_v106_140502
 *
 *-# As v105a but version changed to 1.06                                                     \n
 *
 *
 *
 *\version lms2012_v105a_140327
 *
 *-# IIC issue with automatic update blocking access fixed in "d_iic.c"                       \n
 *-# UART protocol escape future issue fixed in "d_uart.c"                                    \n
 *
 *
 *
 *\version lms2012_v105H_140211
 *
 *-# As v104x but version changed to 1.05                                                     \n
 *
 *
 *
 *\version lms2012_v104x_140206
 *
 *-# ISSUE 4330 - sub call aliases block local issue fixed                                    \n
 *-# Number of memory handles rised from 250 to 500 (MAX_HANDLES = 500)                       \n
 *-# Color sensor mode 4 data checksum issue fixed                                            \n
 *
 *
 *\version lms2012_v104w_140110
 *
 *-# Test app "Sensors" changed to use "Modes" instead of "Views" in mode change limit        \n
 *-# opINPUT SETUP - IIC third party sensor read/write issue fixed                            \n
 *-# opINPUT READY_IIC implemented                                                            \n
 *-# More documentation about sensor reading (see \ref thirdpartydevicedesign "Third Party Device Design Guidelines ") \n
 *
 *
 *\version lms2012_v104v_131205
 *
 *-# Release of version 104u for testing                                                      \n
 *
 *
 *\version lms2012_v104u_131205
 *
 *-# Corrected issue when connecting to several devices using bluetooth (c_bt.c)              \n
 *-# opUI_DRAW VALUE bug fixed (negative figures)                                             \n
 *-# opUI_DRAW VIEW_UBIT bug fixed (negative figures)                                         \n
 *-# opINPUT_DEVICE INSERT_TYPE implemented                                                   \n
 *-# opINPUT_DEVICE SET_TYPEMODE implemented                                                  \n
 *-# Corrected issue if trying to search for BT devices and allready connected to 7 devices   \n
 *-# Corrected issue if get remote bluetooth name fails in a bluetooth search                 \n
 *-# Bluetooth connect is not called if create paired device fails                            \n
 *-# Bluetooth connection attempt actively rejected if user presses X on the UI               \n
 *
 *
 *\version lms2012_v104t_131108
 *
 *-# Corrected remote bluetooth name issue                                                    \n
 *-# Corrected brick crashing if number of motors diff from 2 in sync'ed motor cmds           \n
 *-# Corrected filetransfer between SD cards in bricks - Folder type issue                    \n
 *-# Corrected filetransfer between SD cards in bricks - Filehandle issue                     \n
 *-# opFILE CLOSE_LOG changed to free up handle when logging in memory                        \n
 *-# SD card back key bug fixed                                                               \n
 *-# ISSUE 2636 - "Brick Program" app - test for attached sensor                              \n
 *-# ISSUE 3226 - opMATH MOD8, MOD16, MOD32 zero bug fixed                                    \n
 *-# ISSUE 3492 - opUI_DRAW LINE and RECT hang bug fixed                                      \n
 *-# ISSUE 3565 - Brick Hang with 3rd party sensor bug fixed                                  \n
 *-# Added TIInit_6.6.15.bts to the filesystem to support 1325A version bluetooth             \n
 *-# Special exception text added to headers: "lmstypes.h", "lms2012.h" and "bytecodes.h"     \n
 *-# opINPUT_DEVICE INSERT_TYPE implemented for test									                        \n
 *-# IIC 3rd party hang and data instability issue fixed									                    \n
 *
 *\version lms2012_v104H_130531
 *
 *-# Bluetooth transfer folder error fixed in cComCreateBeginDL                               \n
 *-# First release for AFOL                                                                   \n
 *
 *
 *\version lms2012_v103H_130528
 *
 *-# Reduced tone levels                                                                      \n
 *-# Corrected kernel source error introduced in v102                                         \n
 *
 *
 *\version lms2012_v102H_130524
 *
 *-# Check on characters in filenames                                                         \n
 *-# opARRAY WRITE_CONTENT bug with DATA16, DATA32 and DATAF arrays fixed                     \n
 *-# Scheduling blocked non-reentrant subcalls changed                                        \n
 *-# 3th. party sensor scaling updated                                                        \n
 *-# "Brick Program" app stop motor issue fixed                                               \n
 *-# Power down screen when WiFi active issue fixed                                           \n
 *-# Power down LED color set to RED                                                          \n
 *-# opFILENAME GET_FOLDERNAME implemented (to execute "rbf" files anywhere)                  \n
 *-# opSYSTEM implemented (for test purpose only)                                             \n
 *-# opUI_READ GET_LBATT implemented (for motoring battery level in %)                        \n
 *-# opSTRINGS VALUE_FORMATTED implemented (for formatted value to string output)             \n
 *-# opSTRINGS NUMBER_FORMATTED implemented (for formatted number to string output)           \n
 *-# SI unit limit on UART sensors removed                                                    \n
 *-# opMATH TRUNC changed to round up                                                         \n
 *-# E-meter mode "ALL" scaling changed                                                       \n
 *-# Bluetooth hinted pairing - bluetooth address only valid once                             \n
 *-# Bluetooth pairing changed to use dbus call (to enable connecting to some phones)         \n
 *-# Fixed motor synced issue, when speed set to 0                                            \n
 *-# Several changes to wifi                                                                  \n
 *-# Sound tone level adjusted                                                                \n
 *
 *
 *\version lms2012_v101H_130204
 *
 *-# Live update on datalog is possible on PC when running up to 100 samples per second       \n
 *-# opINPUT_DEVICE CAL_MIN and CAL_MAX changes to accept SI units (in DATA32 format)         \n
 *-# opPROGRAM_INFO OBJ_START bug fixed                                                       \n
 *-# opOBJECT_START bug fixed                                                                 \n
 *-# Bluetoothd changed to comply with correct reply to SDP_ServiceSearchRequest              \n
 *-# l2test added to file system to comply with bluetooth testing                             \n
 *-# Output check for more that 2 synchronized motors at a time                               \n
 *-# Enabling bluetooth pscan after pairing only process                                      \n
 *
 *
 *\version lms2012_v100H_121220
 *
 *-# WIFI reconnect with TCP is now possible                                                  \n
 *
 *
 *\version lms2012_v069_121219
 *
 *-# Warnings in display after boot now looks fine                                            \n
 *-# READ_SIZE related to arrays have added NOBREAK                                           \n
 *-# Motor sync going straight backwards could not regulate down issue fixed                  \n
 *-# UI Browser issues related to download and deleting files fixed                           \n
 *-# Corrected make_ev3_os.sh to add CVS folder in all apps directories                       \n
 *
 *          
 *\version lms2012_v068_121214
 *
 *-# Shut down while user program running issue fixed                                         \n
 *-# Printouts on debug port when connecting/disconnecting USB removed in kernel              \n
 *-# SSID Name truncation issue fixed                                                         \n
 *-# Valid IP in WIFI changed                                                                 \n  
 *          
 *\version lms2012_v067_121207
 *
 *-# opARRAY READ_SIZE implemented                                                            \n
 *-# Daisy-chain, the motors on the lower layers are not stopped when the program ends - fixed\n
 *-# Daisy-chain, reset on the lower layers when program is started                           \n
 *-# WiFi shutdown bug fixed                                                                  \n
 *-# Filesystem inconsistence bug fied                                                        \n
 *-# Firmware updated only available through USB                                              \n
 *-# Motor - program end 100mS delay to float implemented                                     \n
 *-# cCom byte codes supports dynamic strings                                                 \n
 *-# LIST_FILE handles now allocated from original handle pool                                \n 
 *-# "IR Control" app updated (Sensor in wrong mode bug - fixed)                              \n
 *-# opARRAY RESIZE is now capable to down size arrays                                        \n
 *-# opARRAY COPY   is now capable to down size arrays                                        \n
 *-# BT status updated in UI if changed (by direct command or user program)                   \n
 *-# WIFI status updated in UI if changed (by direct command or user program)                 \n
 *-# Download sound issue fixed (waits for completion)                                        \n
 *-# Bumbed on unmounted touch sensor returns 0 (instead of nan)                              \n
 *-# Sys. command BLUETOOTHPIN can only be set by USB connection                              \n
 *-# Sys. command CONTINUE_DOWNLOAD returns END_OF_FILE when complete file has been received  \n
 *-# Spaces is allowed in WiFi SSID                                                           \n
 *-# Sound handle issue fixed (tight loop)                                                    \n
 *-# opFILENAME TOTALSIZE - parameter added                                                   \n
 *-# opFILE GET_ICON removed                                                                  \n
 *-# opFILE SET_LOG_SYNC_TIME and GET_LOG_SYNC_TIME implemented                               \n
 *-# On brick copy limited to folder with maximum 125 files                                   \n
 *          
 *\version lms2012_v066_121130
 *
 *-# Underscore enabled in paskeys and network names                                          \n
 *-# "Brick Program" app - 50mS delay after gyro reset to ensure correct zeroed data          \n
 *-# "Brick Datalog" app updated (missing NXT pictures on Color and US sensor)                \n
 *-# "Brick Datalog" app removed from UI (unlock code "opFILENAME(UNPACK,'../apps/Brick\ Datalog')")\n
 *-# "Debug" tool removed from UI (avaliable on SDCard)                                       \n
 *-# "Test" tool removed from UI (avaliable on SDCard)                                        \n
 *-# opFILE MOVE changed to remove destination if destination exist                           \n
 *-# Button implementation changed ("scroll" in all apps)                                     \n
 *-# File download error if insuficient room                                                  \n
 *-# Tacho reset if motor pluged/unpluged                                                     \n
 *-# Bluetooth visible can be changed when connected                                          \n
 *-# Bluetooth name can be changed when connected                                             \n
 *
 *          
 *\version lms2012_v0657_121123
 *
 *-# "Brick Datalog" and "Brick Program" app updated (keyboard layout aligned)                \n
 *-# "IR Control" app updated (graphics)                                                      \n
 *-# Stable time for connecting output devices changed to 350mS                               \n
 *-# File permissions changed                                                                 \n
 *-# Rechargeable levels around power management - changed                                    \n
 *-# "WiFi" app updated (on/off checked, no search when off)                                  \n
 *-# Four layer daisy chain implemented                                                       \n
 *-# "printf" bug in VM - fixed                                                               \n
 *
 *          
 *\version lms2012_v065_121116
 *
 *-# Kernel modules updated with zeroed shared memory                                         \n
 *-# Light around buttons numbering changed (back to V0.62)                                   \n
 *-# Virtual temperature rise shutdown implemented                                            \n
 *-# opARRAY READ_CONTENT and WRITE_CONTENT implemented                                       \n
 *-# Default sleep time changed to 30 minuttes                                                \n
 *-# "Brick Datalog" app updated (keep alive when logging)                                    \n
 *-# "Brick Program" app updated (default sensor color = black, back button skips canvas bug fixed)\n
 *-# SD card recognised also at boot time                                                     \n                                
 *
 *          
 *\version lms2012_v064_121106
 *
 *-# EnergyMeter mode change stabilized and change time lowered to 100mS                      \n
 *-# Datalogging, Same value is being saved for each logging - bug fixed                      \n
 *-# opINPUT_DEVICE SETUP - bug fixed (support for 3th. party IIC sensors)                    \n
 *-# UI update after download - fixed                                                         \n
 *-# opUI_DRAW BMPFILE clip bug fixed                                                         \n
 *-# Sleep power down shows now the power down screen                                         \n
 *-# Low voltage power down fixed                                                             \n
 *-# Unsupported files will not be shown in the UI                                            \n
 *-# Cannot Cancel on BT "Connect?" screen - bug - fixed                                      \n
 *-# Max number of files/folders per level rised to 128                                       \n
 *-# opUI_WRITE DOWNLOAD_END implemented (send from PC when download is completed)            \n
 *
 *          
 *\version lms2012_v063_121030
 *
 *-# Missing app icon bug fixed                                                               \n
 *-# Orange and red LED light swapped bug fixed                                               \n
 *-# Download of App DO NOT require adding an icon (default implemented)                      \n                                    
 *-# SD card size bug fixed                                                                   \n
 *-# Timing, running a program using time get corrupted after XX min - bug fixed              \n
 *-# IIC sensor bug fixed                                                                     \n
 *-# Support for EnergiMeter implemented (sensor type 99)                                     \n
 *-# Ram test byte code implemented                                                           \n
 *-# Bug fixing around motor commands                                                         \n
 *-# Mode 2 bug fixing                                                                        \n
 *-# Daisy chain sensor mode bug fixed                                                        \n
 *-# USB starving fixed                                                                       \n
 *-# Only fraction of file downloaded - bug - fixed                                           \n
 *-# Program validate accept nan/inf as floating point constants                              \n  
 *
 *          
 *\version lms2012_v062_121012
 *
 *-# Graphics updated                                                                         \n
 *-# opFILE OPEN_APPEND bug fixed                                                             \n
 *-# UART sensor detection changed                                                            \n
 *-# Gyro turntable test program implemented (time from calibrate to read value = 2.2 Second) \n
 *-# Light around buttons numbering changed                                                   \n
 *-# USB icon implemented                                                                     \n
 *-# 0.5 second delay at program end (to help stop motors)                                    \n
 *-# Long Filenames => Gives an error but creates a folder - bug fixed                        \n
 *-# Upper and lower numbering used for light around buttons - changed                        \n
 *-# SD_Card changed to use link                                                              \n
 *-# UART write changed                                                                       \n
 *-# Sound level 0 = silence                                                                  \n  
 *
 *          
 *\version lms2012_v061_120928
 *
 *-# UART sensor error reset implemented (sensors before EP2 may not function propperly)      \n
 *-# MAX_HANDLES to arrays in one program increased to 250                                    \n
 *-# Fast datalog file handle bug fixed                                                       \n
 *-# opFILE LOAD_PICTURE removed (use UI_DRAW BMPFILE as replacement)                         \n
 *-# opFILE GET_IMAGE removed                                                                 \n
 *-# opFILE UNLOAD removed                                                                    \n
 *-# opSTRINGS SUB implemented                                                                \n
 *-# opSTRINGS VALUE_TO_STRING changed to return maximal 4 dashes in case of "nan"            \n
 *-# Key click sound implemented                                                              \n
 *-# Startup and power down sounds implemented                                                \n
 *-# opMEMORY_USAGE changed to return memory total and memory free [KB]                       \n
 *-# Direct command reply bug fixed                                                           \n
 *-# EOF on datalog files implemented                                                         \n
 *-# Message box array support implemented                                                    \n
 *-# BT disconnect ingoing connection if outgoing connection is establissed                   \n
 *-# Running synced motors and interrupt with single motor command floats both motors before executing new command\n
 *-# Sound noise removed                                                                      \n
 *
 *          
 *\version lms2012_v060_120917
 *
 *-# Linux prompt bug fixed (no prompt when exitting debugger)                                \n
 *-# Display update limitted to 10 frames per second                                          \n
 *-# "Ui" updated (handles text files in browser)                                             \n
 *-# opINPUT_DEVICE CAL_MIN, CAL_MAX bug fixed (init min and max first time)                  \n
 *-# LED orange light when warning active - implemented (voltage, current, memory, busy)      \n
 *-# opUI_WRITE SET_BUSY implemented (1 makes LEDs orange and 0 makes LEDs normal again)      \n
 *-# "WiFi" app updated (busy makes LEDs orange)                                              \n
 *-# "Blutooth" app updated (busy makes LEDs orange)                                          \n
 *-# "Ui" updated (refreshes so it not always jumps to first folder)                          \n
 *-# opTST TST_ACCU_SWITCH implemented                                                        \n
 *-# opFILENAME CHECK implemented                                                             \n
 *-# opUI_READ GET_SDCARD implemented                                                         \n
 *-# opUI_READ GET_USBSTICK implemented but disabled                                          \n
 *-# opSTRINGS VALUE_TO_STRING changed to insert dashed ("-----") instead of "nan"            \n
 *-# Number of file handles for system commands changed to 64                                 \n
 *-# Boot time reduced to 30 seconds                                                          \n
 *
 *          
 *\version lms2012_v059_120830
 *
 *-# SD card   folder copy implemented (popup for overwrite and media full)                   \n
 *-# USB stick folder copy implemented (popup for overwrite and media full)                   \n
 *-# NXT temperature logging bug fixed                                                        \n
 *-# opFILENAME EXIST, TOTALSIZE, SPLIT, MERGE implemented                                    \n
 *-# opTST TST_OPEN, TST_CLOSE, TST_READ_PINS, TST_WRITE_PINS implemented                     \n
 *-# opTST TST_READ_ADC, TST_WRITE_UART, TST_READ_UART implemented                            \n
 *-# opFILE OPEN_LOG alwayes append if filename exist (delete file first if append not needed)\n
 *-# opFILE CLOSE_LOG append 8 times 0xFF at the end of the log file when closed              \n
 *-# opFILE GET_LOG_NAME implemented                                                          \n
 *-# opNOTE_TO_FREQ implemented (documentation under "Byte Codes"/"VM")                       \n      
 *-# NXT sound sensor detection bug fixed                                                     \n
 *-# "Test" app updated (display test)                                                        \n
 *-# "Bluetooth" app updated (mode 2)                                                         \n
 *-# "Port View" app updated (NXT color and ultrasonic sensor picture)                        \n
 *-# "Brick Program" updated (IR remote bug fixed)                                            \n
 *
 *          
 *\version lms2012_v0581_120822
 *
 *-# Daisy chain mode change bug fixed                                                        \n
 *-# NXT ultrasonic missing 9V fixed                                                          \n
 *-# opINPUT_DEVICE CLR_ALL bug fixed                                                         \n
 *-# Bluetooth connect issue fixed (firmware image scribt changed)                            \n
 *-# "Motor Control" app changed (graphics and functionality)                                 \n
 *-# "IR Control" app implemented                                                             \n
 *-# "Brick Program" app changed (open and save icons flipped)                                \n
 *-# opINPUT_DEVICE GET_CHANGES and GET_BUMPS is removed (will not work daisy chaned)         \n
 *-# TOUCH sensors have a new mode 1 called "BUMPS" (will work daisy chained)                 \n
 *-# opPORT_CNV_OUTPUT implemented                                                            \n
 *-# opPORT_CNV_INPUT implemented                                                             \n
 *
 *          
 *\version lms2012_v057_120816
 *
 *-# "Black layer buffering" bug fixed and enabled again                                      \n
 *-# opINPUT_DEVICE CLR_ALL implemented                                                       \n
 *-# opINPUT_DEVICE SETUP implemented                                                         \n
 *-# NXT light sensor mode 0 changed to NXT-REFLECT                                           \n
 *-# NXT light sensor mode 1 changed to NXT-AMBIENT                                           \n
 *-# NXT color sensor mode 0 changed to NXT-COL-REF                                           \n
 *-# NXT color sensor mode 2 changed to NXT-COL-COL                                           \n
 *-# opINPUT_DEVICE READY_XX do not wait if port is OPEN                                      \n
 *-# Low memory indication implementation started                                             \n
 *-# O_SYNC removed from file open                                                            \n
 *-# ON BRICK BUTTONS REMAPPED *NOT BACKWARD COMPATIBLE*                                      \n
 *-# WiFi splitted transfer stabilized                                                        \n
 *-# Daisy chain supports one slave (motor ready/test is not supported yet)                   \n
 *
 *          
 *\version lms2012_v056_120807
 *
 *-# "Black layer buffering" disabled                                                         \n
 *-# Internal use only: simple "C-call way" of executing byte code streams - implemented      \n
 *-# opINPUT_DEVICE CLR_ALL implemented (only placeholder - not functioning)                  \n
 *-# WiFi reconnection on TPC connection                                                      \n
 *-# WiFi menu lock up bug fixed                                                              \n
 *-# 3th party IIC sensors are named "IIC-SENSOR"                                             \n
 *
 *          
 *\version lms2012_v055_120718
 *
 *-# Fixed bug in CONTINUE_GETFILE                                                            \n
 *-# Implementation of iDevice interface started (Added c_i2c.c and c_i2c.h)                  \n
 *
 *
 *\version lms2012_v054_120712
 *
 *-# Fast datalog (black layer buffering and optimization) on IIC implemented                 \n
 *-# Third party device support implemented (HW buffer on IIC clock)                          \n
 *-# Error reply on direct commands implemented                                               \n
 *-# PRU UART bitrate adjusted                                                                \n
 *-# Integrated current shutdown implementation started                                       \n
 *-# Start of faulty program handled by showing an error popup                                \n
 *-# opMATH changed from radians to degrees                                                   \n
 *-# Button mapping implemented (not active yet)                                              \n
 *-# opUI_READ BUTTON0 - opBUTTON5 removed (use opUI_BUTTON SHORTPRESS instead)               \n
 *-# opMEMORY_USAGE implemented                                                               \n
 *-# MD5 SUM and filesize added to LIST_FILES and CONTINUE_LIST_FILES system commands         \n
 *
 *          
 *\version lms2012_v053_120628 (EP2)
 *
 *-# Dynamic hardware adaptation implemented (from FINALB V0.30 hardware)                     \n
 *-# opINPUT_SAMPLE changed to support dynamic output array                                   \n
 *-# opARRAY_APPEND implemented                                                               \n
 *-# opSTRINGS VALUE_TO_STRING changed to strib trailing zeroes                               \n
 *-# Validation bug on handles fixed                                                          \n
 *-# Daisy chain support implemented                                                          \n
 *-# Fast datalog (black layer buffering and optimization) on UART and analog implemented     \n
 *
 *          
 *\version lms2012_v052_120620
 *
 *-# Fast datalog (black layer buffering and optimization) implementation started             \n
 *-# opSTRINGS VALUE_TO_STRING bug fixed                                                      \n
 *-# opUI_DRAW FILLCIRCLE algorithm changed                                                   \n
 *-# opUI_BUTTON GET_BUMBED implemented                                                       \n
 *-# opINPUT_SAMPLE implemented (read buffered device values) (see \ref cinputsample "Example")\n
 *-# opFILE WRITE_LOG last two parameters removed and 4th. parameter changed encoding to "handle"\n
 *-# opUI_WRITE GRAPH_SETUP last five parameters changed encoding to "handle"                 \n
 *-# opFILE WRITE_LOG writes scrambled values (4 bytes floatingpoint) NOT ASCII characters in the file\n 
 *
 *          
 *\version lms2012_v051_120604
 *
 *-# "Brick Program" app graphics updated                                                     \n
 *-# Daisy chain support implementation started                                               \n
 *-# IIC sensor support implemented                                                           \n
 *-# Debug console bug fixed                                                                  \n
 *-# opSTRINGS VALUE_TO_STRING changed to accept left adjusted result                         \n
 *-# opTST byte codes implementation started                                                  \n
 *-# WiFi TKIP/AES implemented                                                                \n
 *
 *          
 *\version lms2012_v050_120511
 *
 *-# NEW KERNEL AND FILESYSTEM REQUERED                                                       \n
 *-# UART sensor module updated                                                               \n
 *-# Mini tacho motor regulation updated                                                      \n
 *-# opINPUT_DEVICE GET_BUMPS implemented (read negative changes on a device)                 \n
 *-# "Brick Program" app updated                                                              \n
 *-# opFILE GET_HANDLE has changed parameters (open for write flag implemented)               \n
 *-# opUI_DRAW CLEAN removed (use opUI_DRAW FILLWINDOW,0,0,0)                                 \n
 *-# opKEEP_ALIVE implemented (see \ref KEEPALIVE "opKEEP_ALIVE")                             \n
 *-# ISSUE 239 - LED flashing changed to 250mS on / 250mS off                                 \n
 *-# ISSUE 42  - "Motor Control" app IR seeker port changed to 4                              \n
 *-# opSOUND REPEAT implemented                                                               \n
 *-# WiFi enabled                                                                             \n
 *
 *          
 *\version lms2012_v049_120413
 *
 *-# opUI_DRAW ERASE_WINDOW removed                                                           \n
 *-# opUI_DRAW FILLWINDOW implemented (can replace ERASE_WINDOW with the right parameters)    \n
 *-# opFILE SAVE_IMAGE removed                                                                \n
 *-# opFILE LOAD_SOUND removed                                                                \n
 *-# "Brick Program" app updated                                                              \n
 *-# opFILE OPEN_APPEND implemented (open for write to end of file)                           \n
 *-# opFILE GET_HANDLE  implemented (get filehandle from open file by filename)               \n
 *
 *          
 *\version lms2012_v048_120330
 *
 *-# ISSUE 15  - Download and run can't stop program - bug fixed                              \n
 *-# ISSUE 56  - UI buttons are active while program is running - bug fixed                   \n
 *-# ISSUE 93  - Button light pattern on P-Brick - bug fixed                                  \n
 *-# opPROGRAM_START used in a direct command do nothing if USER_SLOT or DEBUG_SLOT is running\n
 *-# Topline update enable when user program stops                                            \n
 *-# A/D converter is running SPI (not bitbanging)                                            \n
 *-# Uart interrupt on port 1 implemented (not used yet)                                      \n
 *-# Bluetooth authentication implemented                                                     \n
 *-# Bluetooth hinted pairing implemented                                                     \n
 *
 *          
 *\version lms2012_v047_120323
 *
 *-# ISSUE 6   - "Motor Control" app react on wrong channel - bug fixed                       \n
 *-# ISSUE 17  - Motor run unlimitted preformance - bug fixed                                 \n
 *-# ISSUE 49  - Motor stop and brake - bug fixed                                             \n
 *-# Not able to stop user program - bug fixed                                                \n
 *-# Crash when trying to execute program with long (>51 chararcter) name - bug fixed         \n
 *-# "Brick Program" app sound retrig crashes - bug fixed                                     \n
 *-# Old NXT color sensor implementation started                                              \n
 *
 *          
 *\version lms2012_v046_120316
 *
 *-# "Brick Program" app : exit canvas when program saved bug fixed                           \n
 *-# Wrong bytecode version resets sensor in port 1       bug fixed                           \n
 *-# "Brick Program" app : no wait for sound finished implemented                             \n
 *-# opSTRING_TO_VALUE accept commas                                                          \n
 *
 *          
 *\version lms2012_v045_120312
 *
 *-# UART sensor port 3 and 4 bug fixed                                                       \n
 *-# Graphics minor issues fixed                                                              \n
 *-# "Port View" app : error graphics for wrong connected devices                             \n
 *-# "Port View" app : bar has center for signed value devices                                \n
 *-# "Brick Program" app : angle and encoder sensors made relative                            \n
 *-# "Brick Program" app : canvas full experience bug fixed                                   \n
 *-# "General navigation" file transfer to bluetooth implemented                              \n
 *
 *          
 *\version lms2012_v044_120302
 *
 *-# General navigation - WiFi - implementation started                                       \n
 *-# UI changed to also stop user programs started from direct commands                       \n
 *-# INPUT_DEVICE READY_xxx changed to not force change task                                  \n
 *-# opOBJECT_TRIG and opOBJECT_WAIT changed to not force change task                         \n
 *-# "Brick Program app" bug fix (run and save file no posible)                               \n
 *-# "Brick Datalog app" bug fix (save file no posible)                                       \n
 *-# "Brick Program app" bug fix (max block issue)                                            \n
 *-# General navigation - folder order fixed                                                  \n
 *-# On Brick Programs has changed extension from ".rbf" to ".rpf"                            \n
 *-# opMATH MOD8, MOD16, MOD32 implemented                                                    \n                                                                                        
 *-# "Details" app changed name to "Brick Info"                                               \n
 *-# opARRAY SIZE implemented                                                                 \n
 *-# opMATH POW   implemented                                                                 \n
 *-# opINPUT_DEVICE CAL_MIN and CAL_MAX implemented                                           \n
 *-# NXT devices got their name back                                                          \n
 *-# Output devices can be read equal to input devices (see \ref MOTOR_READ_EXAMPLE1 "Example")\n
 *-# Messaging implemented                                                                    \n 
 *
 *          
 *\version lms2012_v043_120210 (EP1)
 *
 *-# opUI_STORE and opUI_RESTORE had one parameter added (to expand the window levels)        \n
 *-# opUI_DRAW BMPFILE and PICTURE graphic bug (when drawing aligned bitmaps) fixed           \n 
 *-# opUI_DRAW KEYBOARD parameter has been added (Icon)                                       \n
 *-# opUI_DRAW VERTBAR  implemented                                                           \n
 *-# System specific defines are made visible for byte code assembler                         \n
 *-# Non volatile setting files are moved to a specific folder called "../sys/settings/"      \n
 *-# "Program app" (without test area) finished (development stopped)                         \n 
 *-# "Play Recent" items will disappear when deleted in "File Navigation" - implemented       \n
 *-# General navigation - Bluetooth - implementation started                                  \n
 *-# opINFO GET_ID removed                                                                    \n
 *-# opCOM_GET GET_ID implemented                                                             \n
 *-# opUI_DRAW KEYBOARD some characters disabled (characters invalid in filenames)            \n
 *-# opUI_WRITE LED has changed functionality and number of parameters                        \n
 *-# Bluetooth commands implemented (see "Byte Codes" - "Communication")                      \n
 *-# App names changed to "General Navigation: Flow (30JAN)" concept                          \n
 *-# "Program" app changed name to "Brick Program"                                            \n
 *-# "Datalog" app changed name to "Brick Datalog"                                            \n
 *-# "Remote"  app changed name to "Motor Control"                                            \n
 *-# "View"    app changed name to "Port View"                                                \n
 *
 *          
 *\version lms2012_v042_120120
 *
 *-# opINPUT_DEVICE GET_MINMAX implemented                                                    \n
 *-# opINPUT_DEVICE CMD parameter moved to start (first parameter)                            \n
 *-# Low voltage shut down changed (delay before user program stop / motor off)               \n
 *-# opUI_BUTTON TESTSHORTPRESS and TESTLONGPRESS implemented                                 \n
 *-# opUI_DRAW GRAPH_SETUP and GRAPH_DRAW implemented                                         \n
 *-# opUI_WRITE GRAPH_SAMPLE implemented                                                      \n
 *-# opFILE OPEN_LOG  implemented  (\ref file_open_log "OPEN_LOG example")                    \n
 *-# opFILE WRITE_LOG changed      (\ref file_write_log "WRITE_LOG example")                  \n 
 *-# opFILE CLOSE_LOG implemented  (\ref file_close_log "CLOSE_LOG example")                  \n
 *-# opFILE REMOVE implemented                                                                \n
 *-# opFILE MOVE implemented                                                                  \n
 *-# opUI_BUTTON supports ANY_BUTTON                                                          \n
 *-# opUI_DRAW support TINY_FONT                                                              \n
 *-# opUI_DRAW APPSELECT    removed (see opUI_DRAW BROWSE)                                    \n
 *-# opUI_DRAW PRJSELECT    removed (see opUI_DRAW BROWSE)                                    \n
 *-# opUI_DRAW CACHESELECT  removed (see opUI_DRAW BROWSE)                                    \n
 *-# opUI_DRAW BROWSE implemented                                                             \n
 *-# opUI_BUTTON PRESSED bug fixed                                                            \n
 *-# opRL32 bug fixed                                                                         \n
 *-# UART sensor READY/BUSY bug fixed                                                         \n
 *-# Repeate on arrow buttons implemented                                                     \n
 *-# opARRAY   COPY implemented                                                               \n
 *-# opFILE WRITE_TEXT  no of parameters changed (DEL added)                                  \n
 *-# opFILE READ_TEXT   no of parameters changed (DEL added)                                  \n
 *-# opFILE WRITE_VALUE no of parameters changed (DEL added)                                  \n
 *-# opFILE READ_VALUE  no of parameters changed (DEL added)                                  \n
 *-# opINPUT_DEVICE CAL_MINMAX implemented  (\ref input_device_cal_minmax "CAL_MINMAX example")\n
 *-# opINPUT_DEVICE CAL_DEFAULT implemented (\ref input_device_cal_default "CAL_DEFAULT example")\n
 *-# opINPUT_TEST has changed byte code number (to the one opINPUT_GET_TYPE had)              \n
 *-# opINPUT_GET_TYPE is removed (see below)                                                  \n
 *-# opINPUT_DEVICE GET_TYPEMODE implemented                                                  \n
 *-# Datalog app implemented                                                                  \n
 *-# Motor Control app implemented                                                            \n
 *-# Following byte codes are updated to support dynamic string handles                       \n
 *-  opINFO         GET_ID, ERRORTEXT                                                         \n
 *-  opSTRINGS      ADD, DUPLICATE, VALUE_TO_STRING, NUMBER_TO_STRING, STRIP                  \n
 *-  opINPUT_DEVICE_LIST                                                                      \n
 *-  opINPUT_DEVICE GET_NAME, GET_SYMBOL, GET_MODENAME                                        \n
 *-  opUI_READ      GET_HW_VERS, GET_FW_VERS, GET_FW_BUILD                                    \n
 *-  opUI_READ      GET_OS_VERS, GET_OS_BUILD, GET_VERSION                                    \n
 *-  opARRAY        COPY                                                                      \n
 *-  opARRAY_WRITE                                                                            \n
 *-  opFILE         READ_TEXT, READ_BYTES                                                     \n
 *-  opUI_DRAW      KEYBOARD, BROWSE                                                          \n
 *
 *          
 *\version lms2012_v041_111209
 *
 *-# opSINF, opCOSF, opTANF, opASINF, opACOSF, opATANF removed (see below)                    \n
 *-# opMATH SIN, COS, TAN, ASIN, ACOS, ATAN implemented                                       \n
 *-# opMATH EXP, MOD, FLOOR, CEIL, ROUND, ABS, NEGATE, SQRT, LOG and LN implemented           \n
 *-# opRL8, opRL16, opRL32 implemented                                                        \n
 *-# Delete files from the UI implemented                                                     \n
 *-# High temperature motor shut off implemented                                              \n
 *-# Low voltage shut down implemented                                                        \n
 *-# UI readout with kernel version and build implemented                                     \n
 *
 *          
 *\version lms2012_v040_111201
 *
 *-# OPB support for file load and save implemented                                           \n
 *-# Overall run screen implemented                                                           \n
 *-# opINFO GET_STATUS number of parameters has changed                                       \n
 *-# Weird Error - DATA8 parameter don't like variables above address 127 - fixed             \n
 *-# Debug app updated                                                                        \n
 *-# opTIMER_READ changed to return milliseconds from byte code program start                 \n
 *-# SUBCALLs optimized                                                                       \n
 *-# opMOVE32_16 writes to 4 bytes bug - fixed                                                \n
 *
 *          
 *\version lms2012_v039_111121
 *
 *-# Delete project (folder) from the UI implemented                                          \n
 *-# opINPUT_WRITE make device not ready until new data arrive                                \n
 *-# opINPUT_DEVICE GET_CHANGES and CLR_CHANGES implemented on input                          \n  
 *-# opINPUT_DEVICE READY_PCT, READY_RAW and READY_SI implemented on input                    \n
 *-# Close open files when user (all) program stops implemented                               \n
 *-# Debugger will start user programs in user slot (1) like the UI                           \n
 *-# Direct command breaks running program bug fixed                                          \n
 *-# Message counter in communication implemented                                             \n
 *-# opUI_BUTTON SET_BACK_BLOCK and GET_BACK_BLOCK implemented                                \n
 *-# opUI_DRAW BMPFILE implemented                                                            \n
 *-# opUI_BUTTON(FLUSH) does not flush LONGPRESS                                              \n
 *-# opFILE OPEN_READ - SIZE parameter added                                                  \n
 *-# On Brick Programming app started (motor, color, wait blocks implemented)                 \n
 *-# Motors must come to complete stop when brake parameter is set fixed                      \n
 *
 *          
 *\version lms2012_v038_111104
 *
 *-# opPROGRAM_INFO OBJ_START bug fixed (delayed program start)                               \n  
 *-# opOutput_RESET should be used to clear tacho and timer upon program start                \n  
 *-# opOUTPUT_CLR_COUNT 10mS tacho clear bug fixed                                            \n  
 *-# IR Seeker (doc error around DATA_SI)                                                     \n 
 *          
 *\version lms2012_v037_111027
 *
 *-# opINPUT_DEVICE SET_RAW     implemented                                                   \n  
 *-# opUI_DRAW VIEW_UNIT        implemented                                                   \n  
 *-# opSTRINGS VALUE_TO_STRING  implemented                                                   \n  
 *-# opSTRINGS STRING_TO_VALUE  implemented                                                   \n  
 *-# opUI_READ GET_HW_VERS      implemented                                                   \n  
 *-# opUI_READ GET_FW_VERS      implemented                                                   \n  
 *-# opUI_READ GET_FW_BUILD     implemented                                                   \n  
 *-# opUI_DRAW FILLCIRCLE       implemented                                                   \n  
 *-# opRANDOM                   implemented                                                   \n
 *-# opUI_BUTTON PRESSED        implemented                                                   \n
 *-# opFILE CLOSE changed to opFILE UNLOAD                                                    \n  
 *-# opFILE OPEN_WRITE, OPEN_READ, CLOSE, REMOVE implemented                                  \n
 *-# opFILE WRITE_TEXT, READ_TEXT                implemented                                  \n
 *-# opFILE WRITE_VALUE, READ_VALUE              implemented                                  \n
 *-# opFILE WRITE_BYTES, READ_BYTES              implemented                                  \n
 *-# opINPUT_DEVICE GET_FIGURES implemented                                                   \n  
 *-# opARRAY INIT8, INIT16, INIT32, INITF implemented                                         \n
 *-# "View" app                 implemented                                                   \n  
 *-# Figures and Decimals added to type datas (controls readout in view and datalog)          \n
 *-# opUI_DRAW NOTIFICATION     changed (last parameter removed)                              \n
 *-# opUI_DRAW APPSELECT        changed (STATUS parameter removed)                            \n
 *-# opUI_DRAW PRJSELECT        changed (STATUS parameter removed)                            \n
 *-# opUI_DRAW CACHESELECT      changed (STATUS parameter removed)                            \n
 *-# opINPUT_DEVICE GET_FORMAT  has changed number of parameters to contain "views"           \n  
 *-# opPROGRAM_STOP             changed to accept CURRENT_SLOT                                \n  
 *-# opUI_DRAW KEYBOARD         changed                                                       \n  
 *-# opUI_BUTTON WAIT_FOR_PRESS bug fixed (destroyed actually button press)                   \n  
 *-# Array handle type changed to 16 bit (DATA16)                                             \n  
 *-# New ID for "NEW TACHO MOTOR" implemented                                                 \n
 *-# opINIT_BYTES has changed parameter types to "encoded" ones                               \n
 *-# opPROGRAM_START has a possibility to load but not start the program (see \ref PROGRAM_START_EXAMPLE1 "Example")\n
 *-# Reentrant subcall validation bug - fixed                                                 \n
 *-# USB IDs changed                                                                          \n
 *-# BEGIN_UPLOAD, CONTINUE_UPLOAD, BEGIN_GETFILE, CONTINUE_GETFILE, LIST_FILES added to communication (see \ref systemcommands "Example")\n
 *          
 *\version lms2012_v036_110928
 *
 *-# File browser changed opUI_DRAW CACHESELECT, APPSELECT, PRJSELECT changed                 \n  
 *-# opFILE has changed numeric value from 0xB0 to 0xC0 (to make room for more motor commands)\n
 *-# opARRAY has changed numeric value from 0xB1 to 0xC1 (to make room for more motor commands)\n
 *-# opARRAY_WRITE has changed numeric value from 0xB2 to 0xC2 (to make room for more motor commands)\n
 *-# opARRAY_READ has changed numeric value from 0xB3 to 0xC3 (to make room for more motor commands)\n
 *-# Some "Pratical Stuff" updated in buildin documentation                                   \n
 *-# opUI_DRAW VALUE changed to fit "View" app  (negative sign, "nan" -> "----")              \n
 *-# Array bug when using handles for system calls fixed                                      \n
 *-# opUI_DRAW VIEW_VALUE implemented                                                         \n
 *-# Large font implemented                                                                   \n    
 *-# opOUTPUT_CLR_COUNT and opOUTPUT_GET_COUNT implemented                                    \n
 *-# opOUTPUT_STEP_SYNC and opOUTPUT_TIME_SYNC implementation started                         \n
 *
 *          
 *\version lms2012_v035_110909
 *
 *-# PrimParPointer changed so array handles can be converted to pointers (for array refference)\n  
 *-# Only first VMTHREAD is started when program is loaded                                    \n    
 *-# Normal, small, large icon implemented                                                    \n    
 *-# Normal, small font implemented                                                           \n    
 *-# Large font implementation started                                                        \n    
 *-# Validation of variable alignment implemented                                             \n    
 *-# opINFO GET_VOLUME, SET_VOLUME, GET_MINUTES, SET_MINUTES, GET_INCH implementation started \n 
 *-# opINFO SET_INCH, GET_FAHRENHEIT, SET_FAHRENHEIT implementation started                   \n    
 *-# opINFO SET_ERROR added                                                                   \n    
 *-# opINFO GET_ERROR added                                                                   \n    
 *-# opINFO ERRORTEXT added                                                                   \n    
 *-# opFILE GET_CACHE_PRJ_NAME, PUT_CACHE_PRJ_NAME, DEL_CACHE_PRJ_NAME, GET_CACHE_PRJS removed\n    
 *-# opFILE GET_CACHE_FILE, PUT_CACHE_FILE, DEL_CACHE_FILE, GET_CACHE_FILES added             \n    
 *-# opFILE GET_CACHE_NAME added                                                              \n    
 *-# opUI_DRAW DOTLINE added (only vertical and horisontal supported)                         \n    
 *-# opUI_DRAW SELECT_FONT added                                                              \n    
 *-# opUI_DRAW ERASE_WINDOW added                                                             \n    
 *-# opUI_DRAW CACHESELECT added                                                              \n    
 *-# opUI_DRAW TOPLINE added                                                                  \n    
 *-# opUI_LF removed (changed to opUI_BUTTON) (use opUI_WRITE,LC0(PUT_STRING),LCS,'\r','n',0) \n    
 *-# opUI_BUTTON added                                                                        \n    
 *-# opUI_WRITE BUTTON_FLUSH has been replaced by opUI_BUTTON FLUSH                           \n    
 *-# opUI_READ BUTTON_READY has been replaced by opUI_BUTTON WAIT_FOR_PRESS                   \n    
 *-# opUI_BUTTON SHORTPRESS added                                                             \n    
 *-# opUI_BUTTON LONGPRESS added                                                              \n    
 *-# opUI_BUTTON PRESS added                                                                  \n    
 *-# opUI_BUTTON RELEASE added                                                                \n    
 *-# opUI_READ BUTTON0, BUTTON1, BUTTON2, BUTTON3, BUTTON4, BUTTON5 will be removed in V0.36  \n
 *
 *  
 *\version lms2012_v034_110822
 *
 *-# End of direct commands does not float motors                                             \n
 *-# Validation of byte code programs has changed to be more restricteded                     \n
 *-# Version in image headers is tested against "BYTECODE_VERSION" from "bytecodes.h"         \n
 *-# Validation and disassembly has been separated                                            \n
 *-# lms2012.h header has been separated into lms2012.h, lmstypes.h, bytecodes.h              \n
 *-# bytecodes.c has been added and hold byte code description tables used for validation     \n
 *-# DATA_PCT and DATA_SI has changed value                                                   \n
 *-# opPROGRAM changed name to opPROGRAM_INFO                                                 \n
 *-# opINIT_BYTES parameter 1 and 2 has changed                                               \n
 *-# opUI_READ  POWER   has changed                                                           \n
 *-# opUI_READ  VERSION has changed                                                           \n
 *-# opUI_WRITE VERSION has changed                                                           \n
 *-# opUI_WRITE POWER   has changed                                                           \n
 *-# opINPUT_DEVICE     has changed                                                           \n
 *-# opINIT_BYTES       has changed                                                           \n
 *-# opSWITCH           has been removed                                                      \n
 *-# User interface flowcart added to documentation \ref buildinapps                          \n
 *-# Hardware schematics added to documentation \ref schematics                               \n
 *-# opUI_DRAW  NOTIFICATION implemented                                                      \n
 *-# opUI_DRAW  QUESTION     implemented                                                      \n
 *-# opUI_DRAW  KEYBOARD     implemented                                                      \n
 *-# opUI_DRAW  INVERSERECT  implemented                                                      \n
 *-# opUI_DRAW  APPSELECT   implementation started                                            \n
 *-# opUI_DRAW  PRJSELECT   implementation started                                            \n
 *-# opSOUND PLAY parameter 3 changed to filename                                             \n
 *-# opUI_WRITE STRING changed to opUI_WRITE PUT_STRING                                       \n
 *-# opSTRING   changed to opSTRINGS                                                          \n
 *
 *          
 *\version lms2012_v033_110728
 *
 *-#  opMEMORY_WRITE implemented to write to different memory types in VM space (see \ref opMEMORY_WRITE1 "Example")\n
 *-#  opSTRING ADD, COMPARE and DUPLICATE is implemented (see \ref stringexample1 "Example")  \n
 *-#  String parameters for SUBCALLS (see \ref STRING_EXAMPLE1 "Info")                        \n
 *-#  opOUTPUT_TEST number of parameters changes (see \ref opOUTPUT_TEST)                     \n
 *
 *          
 *\version lms2012_v032_110623
 *
 *-#  opUI_WRITE SET_TESTPIN implemented                                                      \n
 *-#  opINPUT_TEST implemented                                                                \n
 *-#  opINPUT_READY implemented                                                               \n
 *-#  opSOUND TONE implemented                                                                \n
 *-#  opSOUND PLAY implemented (volume not working yet)                                       \n
 *-#  opSOUND BREAK implemented                                                               \n
 *-#  opSOUND_TEST implemented                                                                \n
 *-#  opSOUND_READY implemented                                                               \n
 *
 *          
 *\version lms2012_v031_110616
 *
 *-#  Hardware platform "FINAL" implementation started                                        \n
 *-#  Sound implementation started                                                            \n
 *-#  UART sensor bug fixed                                                                   \n
 *-#  Read UART sensor returns "nan" if sensor not ready                                      \n
 *
 *          
 *\version lms2012_v030_110609
 *
 *-#  opUI_READ GET_IMAGE removed                                                             \n
 *-#  opFILE GET_PRJS, GET_APPS and GET_TOOLS removed                                         \n
 *-#  opFILE GET_PRJ_NAME, GET_APP_NAME and GET_TOOL_NAME removed                             \n
 *-#  opFILE GET_PRJ_ICON, GET_APP_ICON and GET_TOOL_ICON removed                             \n
 *-#  opFILE GET_PRJ_IMAGE, GET_APP_IMAGE and GET_TOOL_IMAGE removed                          \n
 *\n
 *-#  System command reply bug fixed                                                          \n
 *-#  All 128x178 pixels used on the display                                                  \n
 *-#  No terminal output as default (activate by running "Debug" app)                         \n
 *-#  ALL folders are relative to "~/lms2012/sys" (where the application executable reside)   \n       
 *-#  opINPUT_WRITE implemented (only works on UART device)                                   \n
 *-#  opINPUT_DEVICE GET_SYMBOL implemented                                                   \n
 *-#  opFILE GET_ITEM implemented                                                             \n
 *-#  opFILE GET_CACHE_PRJS implemented                                                       \n
 *-#  opFILE PUT_CACHE_PRJ_NAME implemented                                                   \n
 *-#  opFILE GET_CACHE_PRJ_NAME implemented                                                   \n
 *-#  opFILE DEL_CACHE_PRJ_NAME implemented                                                   \n
 *-#  opFILE GET_FOLDERS implemented                                                          \n
 *-#  opFILE GET_SUBFOLDER_NAME implemented                                                   \n
 *-#  opFILE GET_ICON implemented                                                             \n
 *-#  opFILE GET_IMAGE implemented                                                            \n
 *-#  opFILE DEL_SUBFOLDER implemented                                                        \n
 *\n
 *-#  GUI addition: startup folder contains latest projects runned                            \n
 *-#  GUI addition: delete total project                                                      \n
 *-#  GUI addition: Debug app activates terminal output                                       \n
 *
 *          
 *\version lms2012_v029_110513
 *
 *-#  opUI_READ BUTTON_READY implemented                                                      \n
 *-#  opUI_WRITE BUTTON_FLUSH implemented                                                     \n
 *-#  No need for poll on USB                                                                 \n
 *-#  Reply/no reply implemented on USB                                                       \n
 *
 *          
 *\version lms2012_v028_110509
 *
 *-#  Application folder structure changed (see \ref UIdesign)                                \n
 *-#  Bytecode file extension must be ".rbf"                                                  \n
 *-#  Graphics file extension must be ".rgf"                                                  \n
 *-#  Sound    file extension must be ".rsf"                                                  \n
 *-#  System command "Begin Download" creates folders acording to file path relative to "~/lms2012/"\n
 *
 *          
 *\version lms2012_v027_110428
 *
 *-#  Device type alignmet started                                                            \n
 *-#  UART device communition change started                                                  \n
 *-#  opARRAY_WRITE and opARRAY_READ bug fixed                                                \n
 *-#  SUBCALL IN/OUT parameter bug fixed                                                      \n
 *-#  opINPUT_READ, opINPUT_READSI and opINPUT_READEXT: MODE parameter added                  \n
 *-#  opINPUT_DEVICE GET_FORMAT: MODES parameter added                                        \n
 *-#  opFILE GET_PRJS, GET_APPS and GET_TOOLS implemented                                     \n
 *-#  opFILE GET_PRJ_NAME, GET_APP_NAME and GET_TOOL_NAME implemented                         \n
 *-#  opFILE GET_PRJ_ICON, GET_APP_ICON and GET_TOOL_ICON implemented                         \n
 *-#  opFILE GET_PRJ_IMAGE, GET_APP_IMAGE and GET_TOOL_IMAGE implemented                      \n
 *-#  opUI_READ GET_HORZ implemented                                                          \n
 *-#  opUI_READ GET_VERT implemented                                                          \n
 *-#  opUI_DRAW FILLRECT implemented                                                          \n
 *-#  opINFO GET_ID implemented                                                               \n
 *-#  Application folder structure changed (see \ref UIdesign)                                \n
 *-#  opTIMER_READ implemented                                                                \n
 *
 *          
 *\version lms2012_v026_110405
 *
 *-#  Input port 1 and 2 works now with Uart sensors (see \ref debug)                         \n
 *-#  opARRAY CREATE8, CREATE16, CREATE32, CREATEF implemented                                \n
 *-#  opARRAY DELETE, FILL, RESIZE implemented                                                \n
 *-#  opARRAY_WRITE and opARRAY_WRITE implemented                                             \n
 *
 *          
 *\version lms2012_v025_110330
 *
 *-#  USB communication support protocol from "Communication spec.docx"                       \n
 *-#  Userspace memory allocation centralized in "c_memory" (kernelspace is local)            \n
 *-#  opINPUT_DEVICE GET_FORMAT added                                                         \n
 *-#  BLOCKS local variable bug fixed                                                         \n
 *
 *          
 *\version lms2012_v024_110325
 *
 *-#  procedure for formatting and copying SC cards added in documentation                    \n
 *-#  SUBCALL mutex bug fixed ("motorsCrash" program runs)                                    \n
 *-#  opINPUT_READEXT implemented (see doc)                                                   \n
 *-#  support for more data sets added (c_input and d_uart)                                   \n
 *-#  device type tabel content has changed                                                   \n
 *
 *          
 *\version lms2012_v023_110307
 *
 *-#  linux prompt controlled by firmware started                                             \n
 *-#  opMEMORY_READ implemented to read different memory types from VM space (see \ref opMEMORY_READ1 "Example")\n
 *-#  opDO: PRGID parameter added                                                             \n 
 *-#  opUI_READ,CODE: LENGTH parameter type changed                                           \n
 *-#  opCOM_READ,CODE: LENGTH parameter type changed, SIZE parameter removed                  \n
 *-#  opFILE,LOAD_PICTURE: PRGID parameter removed                                            \n
 *-#  opFILE,GET_POOL added                                                                   \n
 *-#  opFILE,CLOSE added - used to close files opened by LOAD_PICTURE and GET_POOL            \n
 *-#  Direct commands are treaded as small programs able to run in parallel with user programs\n
 *-#  SUBCALLs protected by mutex                                                             \n
 *
 *          
 *\version lms2012_v022_110218
 *
 *-#  lms2012 project prepared for simulation                                                 \n
 *-#  Usb device module template added                                                        \n
 *-#  Usb host   module template added                                                        \n
 *-#  opINPUT_DEVICE_LIST have an extra parameter containing changed status                   \n
 *
 *          
 *\version lms2012_v021_110201
 *
 *-#  scratches bug fixed on display                                                          \n
 *-#  power off bug fixed on display                                                          \n
 *-#  support for IR seeker sensor                                                            \n
 *-#  support for Distance sensor                                                             \n
 *-#  support for Color sensor                                                                \n
 *
 *          
 *\version lms2012_v020_110126
 *
 *-#  Graphical interface implementation started                                              \n
 *-#  Simple graphical terminal implemented (in shared libary not in kernel module)           \n
 *-#  opUI_DRAW supports: UPDATE, CLEAN, PIXEL, LINE, CIRCLE, TEXT, ICON and BITMAP           \n
 *-#  opUI_WRITE,LED supports PWM 0..100% with 5% resolution                                  \n
 *-#  opUI_READ,BUTTON supports all five buttons on the A4 prototypes                         \n
 *-#  d_analog prepared for ONE2ONE prototype GPIO                                            \n
 *-#  d_power  prepared for ONE2ONE prototype GPIO                                            \n
 *-#  d_uart   prepared for ONE2ONE prototype GPIO                                            \n
 *-#  d_ui     prepared for ONE2ONE prototype GPIO                                            \n
 *-#  d_pwm    prepared for ONE2ONE prototype GPIO                                            \n
 *-#  Simple error logging implementation started                                             \n
 *-#  Simple graphical UI implemented                                                         \n
 *-#  IONGEN (sensor supply) removed 1 second under powerup to reset UART sensors             \n
 *-#  ONE2ONE power on and off implemented                                                    \n
 *
 *          
 *\version lms2012_v019_101231
 *
 *-#  Performance algorithm changed                                                           \n
 *-#  Uart statemachine implementation started                                                \n
 *
 *          
 *\version lms2012_v018_101209
 *
 *-#  prepared for cvs                                                                        \n
 *-#  module d_tacho removed                                                                  \n
 *-#  module d_display added                                                                  \n
 *
 *          
 *\version lms2012_v017_101203
 *
 *-#  Output ID detection implementation started                                              \n
 *-#  Shared memory for analog module changed to use ANALOG struct and no SIGNAL              \n
 *-#  d_power module implementation started                                                   \n
 *-#  d_uart module implementation started                                                    \n
 *
 *          
 *\version lms2012_v016_101129
 *
 *-#  PWM module changed to support all 4 output ports on LEGO A4 board                       \n
 *-#  opOUTPUT_TIME_POWER, opOUTPUT_POLARITY, opOUTPUT_READY and OUTPUT_TEST implemented      \n
 *-#  Simple debug monitor implemented                                                        \n
 *-#  opPROGRAM_START - one exstra parameter added (DEBUG)                                    \n
 *-#  Subcall return changed to return parameters in variables - offset by input parameters   \n
 *-#  USB direct command implementation started                                               \n
 *-#  USB file download implementation started                                                \n
 *-#  Byte code for LED control implemented (opUI_WRITE,LED,....)                             \n
 *
 *          
 *\version lms2012_v015_101114
 *
 *-#  Analog ID system implemented for input ports                                            \n
 *-#  Validation output changed to use "op" prefix on byte codes (output can be reassembled)  \n
 *
 *          
 *\version lms2012_v014_101110
 *
 *-#  Adapted to the new distribution (DaVinci-PSP-SDK-03.20.00.1313)                         \n
 *-#  Subcall return parameter bug fixed                                                      \n
 *-#  Analog module changed to support all 4 input ports on LEGO A4 board                     \n
 *-#  Port sequence remapped (physical 1 = logical 4, 2 = 1, 3 = 2, 4 = 3)                    \n
 *
 *          
 *\version lms2012_v013_101011
 *
 *-#  Internal transition to new platform support package                                     \n
 *
 *          
 *\version lms2012_v012_101011
 *
 *-#  Signal used to speed up awareness of device changes on input ports                      \n
 *-#  Kernel shared memory used to speed up reading of analog values from user land           \n
 *-#  In image the program header is expanded by 4 bytes to hold also the image size          \n
 *-#  opUI GET_IMAGE implemented                                                              \n
 *-#  opFILE ISAVE implemented                                                                \n
 *
 *          
 *\version lms2012_v011_100930
 *
 *-#  opCALL      - one more parameter = number of parameters added (needed for validation)   \n
 *-#  Simple UI changed to use subcalls                                                       \n
 *-#  Image.h substituted with a ui byte code file "ui"                                       \n
 *-#  Compare   instructions implemented                                                      \n
 *-#  Select    instructions implemented                                                      \n
 *-#  Logic     instructions implemented                                                      \n
 *-#  Geometric instructions implemented                                                      \n
 *-#  UI bytecode function, parameters and value changed                                      \n
 *-#  User programs and direct command sheet are updated to follow the above changes          \n
 *-#  opOUTPUT_STEP_POWER implemented                                                         \n
 *
 *          
 *\version lms2012_v010_100923
 *
 *-#  typedata    - 1st implementation for type data file read                                \n
 *-#  d_ui        - 1st implementation for read BUT0                                          \n
 *-#  lms_cmdin   - device file that are able to receive VM commands                          \n
 *-#  lms_cmdout  - device file that contains VM command output                               \n
 *-#  Jump label implemented                                                                  \n
 *-#  Automatic program validation started                                                    \n
 *-#  simple bytecode assembler added in folder "bytecodeassembler"                           \n
 *-#  opOBJECT_END bytecode implemented - must be the last bytecode in EVERY object in image  \n
 * 
 *
 *          
 *\version lms2012_v009_100903
 *
 *-#  More support for eval-add-on-board input port (type, Pct, Si)                           \n
 *-#  Support for eval-add-on-board output port (start, stop, power)                          \n
 *
 *          
 *\version lms2012_v008_100826
 *
 *-#  Place holder for d_pwm, d_tacho, d_analog, d_dcm added                                  \n
 *-#  d_analog - bitbang SPI for A/D converter implemented                                    \n
 *-#  d_dcm    - 1st implementation of device ID detection                                    \n
 *-#  c_input  - 1st implementation of device tabel                                           \n
 *-#  Support for eval-add-on-board input port started                                        \n
 *          
 *          
 *\version lms2012_v007_100809
 *
 *-#  opINPUT takes "TYPE" as 3th parameter                                                   \n
 *-#  opOUTPUT_WRITE, opOUTPUT_STEP removed                                                   \n
 *-#  opOUTPUT_TIME_POWER, opOUTPUT_TIME_SPEED, opOUTPUT_STEP_POWER, opOUTPUT_STEP_SPEED added\n
 *-#  opOUTPUT_STOP changed                                                                   \n
 *          
 *          
 *\version lms2012_v006_100806
 *
 *-#  AM1808 eclipse debug enabled (debug setup is username dependend)                        \n
 *-#  VM optimization started                                                                 \n
 *-#  opINPUT  takes "LAYER" as 1st parameter                                                 \n
 *-#  opOUTPUT takes "LAYER" as 1st parameter                                                 \n
 *
 *          
 *\version lms2012_v005_100708
 *
 *-#  AM1808 platform added                                                                   \n
 *-#  d_ppboard module uses "UDEV" way to deal with driver "files"                            \n
 *
 *          
 *\version lms2012_v004_100614
 *
 *-#  Parallel port board driver added                                                        \n
 *
 *          
 *\version lms2012_v003_100613
 *
 *-#  opUI,READ_CODE can read a ascii string and convert to a bytecode string                 \n
 *-#  opDO can execute a bytecode string as "Direct Command"                                  \n
 *-#  'c' executes direct command as cXXxxXXxxXXxxXX                                          \n
 *-#  opPROBE can show variables on stdout                                                    \n
 *-#  'p' probes VMTREAD 1 globals and locals                                                 \n
 *-#  More documentation added                                                                \n
 *-#  opSWITCH8 makes a simple selection on a DATA8 value                                     \n
 *
 *\version lms2012_v002_100603
 *
 *-#  opTIMER_WAIT, opTIMER_READY - 1mS resolution - cTimer changed to use "clock_gettime"    \n
 *-#  opJR_xx - cBranch optimized if no jump                                                  \n
 *-#  d_pwm changed to use hrtimer and PWM base is 1000 Hz with 10 steps resolution           \n
 *-#  Instruction counter implemented to read out execution speed                             \n
 *-#  p5 faked line follower                                                                  \n
 *-#  Some documentation started                                                              \n
 *-#  opOBJECT_TRIG, opOBJECT_WAIT implemented                                                \n
 *
 *\version lms2012_v001_100520
 *
 *-#  UiImage contains info string and commands 'q','r' and 'b'                               \n
 *-#  'r' runs programs as rFILENAME                                                          \n
 *-#  'b' sets breakpoint as bADDRESS                                                         \n
 *-#  stdin used for faking input values with + and -                                         \n
 *-#  opINIT_BYTES is used for initialising global and local variables as opINIT_BYTES (DATA32)Length (DATA8)Destination (DATA8)ByteStream\n 
 *-#  opBREAKPOINT bytecodes moved to 0x87 - 0x8F                                             \n
 *-#  opUI (READ_STR, READ_ADR, WRITE_STR, WRITE_ADR) stdin/out used for user input/output    \n
 *-#  LCS macro for image - defines that zero terminated string follows (see Image.h line 8+9)\n
 */

/******************************************************************************
 * MAINPAGE
 *****************************************************************************/
/*! \mainpage Firmware Documentation
 *
    \htmlonly
    <IMG src="Lms2012.jpg">
    \endhtmlonly
 *
 *- \subpage intro
 *  -  \subpage hardware
 *  -  \subpage firmware
 *- \subpage architecture
 *  - \subpage virtualmachine
 *  - \subpage sharedlibraries
 *  - \subpage kernelmodules
 *- \subpage implementation
 *  - \subpage imagelayout
 *  - \subpage memorylayout
 *  - \subpage objectstatus
 *  - \subpage ready
 *  - \subpage parameterencoding
 *  - \subpage programs
 *  - \subpage powermanagement
 *- \subpage bytecodes
 *- \subpage communication
 *- \subpage buildinapps
 *- \subpage interestingstuff
 *- \subpage practicalstuff
 *- \subpage applicationversions
 *- \subpage kernelversions
*/

/******************************************************************************
 * INTRODUCTION
 *****************************************************************************/
/*! \page intro Introduction
 *  The purpose of this document is to describe the LEGO Robotics firmware architecture primarily towards the advanced brick - hardware and firmware conciderations
 */

/******************************************************************************
 * HARDWARE
 *****************************************************************************/
/*! \page hardware Hardware Specification
 *- ARM 9 Processor
 *  - 16 MB Flash
 *  - 64 MB Ram
 *- USB 2.0 Client Interface (mini)
 *- USB 1.2 Host Interface (standard)
 *- Bluetooth Communication
 *- SD Card Reader (micro)
 *\n\n
 *- Monocrome Display (178x128)
 *- Sound Output (speaker ø23)
 *- 6 Button User Interface
 *- Button Ilumination (individual red and green LEDs x2)
 *- 4 Output Ports (RJ12 6 wire)
 *- 4 Input Ports (RJ12 6 wire)
 *  - Analog (10 bits), Digital, I2C (11Kbit/S), UART (230,4Kbit/S)
 *\n\n
 *- Power
 *  - 6 x AA Batteries
 *  - Rechargeable Battery (NXT power density)
 *
 */

/******************************************************************************
 * FIRMWARE
 *****************************************************************************/
/*! \page firmware Firmware Requirements
 *  The firmware needs to support all requested functionality and at the same time match 
 *  the requirements with software of the product.
 *\n
 *  Below is listed a few more concrete parameters:
 *\n
 *- Fast program execution which enables more advanced robotics control
 *  - Implement and execute a SegWay model without any 3rd party firmware drivers or hardware
 *    elements
 *  - FTC Challenges (Performance critical)
 *    - Bluetooth Communication
 *    - Higher resolution on sensors????
 *    - Fast program execution speed
 *  - Digital I/O
 *    - Communication between P-Brick and sensors
 *    - Communication speed between P_Bricks
 *- Reasonable program memory footprint
 *- Easier understandable and accessible for LEGO to extend
 *
 */

/******************************************************************************
 * ARCHITECTURE
 *****************************************************************************/
/*! \page architecture Architecture
 *
 *  \image html SystemBlock.jpg width=\textwidth
 *
 */
 
/******************************************************************************
 * SHARED LABRARIES
 *****************************************************************************/
/*! \page sharedlibraries Shared Libraries
 *
 *  The system will consist of multiple shared libraries which individually will handle
 *  the various relevant functionalities. These libraries are represented as the green layer 
 *  under \ref architecture.
 *\n 
 *  These shared libraries will be implemented as “Asynchrony driver model” which 
 *  therefore also mean that some sort of polling or signaling are needed between the 
 *  shared library and VM. 
 *\n\n
 *  The functionality implemented within the shared libraries will be accessed from the VM
 *  through system calls from the VM into the shared libraries. These system calls may not 
 *  be blocking in anyway. Please refer to \ref ready. 
 *\n\n
 *  The shared libraries will be implemented in C and compiled into native code.
 *  The approach for adding functionality to the firmware through shared libraries needs 
 *  to support the possibility for adding new shared libraries to the system without having 
 *  to recompiling the LINUX kernel.
 *\n
 *  This of course raises the questions towards how we want to control this possibility 
 *  and that have not been fully investigated and agreed upon at this stage.
 *
 *\n\n
 *- \subpage InputLibrary
 *- \subpage OutputLibrary
 *- \subpage SoundLibrary
 *- \subpage UserInterfaceLibrary
 *- \subpage CommunicationLibrary
 *- \subpage MemoryLibrary
 *
 */
 
/******************************************************************************
 * KERNEL MODULES
 *****************************************************************************/
/*! \page kernelmodules Kernel Modules
 *
 *  The kernel modules will handle all initialization and control of hardware components 
 *  but internal within the main processor and external hardware components. 
 *  Most of these drivers will be interrupt driven.
 *\n
 *  The kernel modules are represented as the black layer under \ref architecture.
 *\n\n
 *- \subpage UsbhostModule
 *- \subpage UsbdevModule
 *- \subpage UartModule
 *- \subpage IicModule
 *- \subpage PwmModule
 *- \subpage AnalogModule
 *- \subpage UiModule
 *- \subpage PowerModule
 */

/******************************************************************************
 * IMPLEMENTATION
 *****************************************************************************/
/*! \page implementation Implementation
 * 
 *- \subpage system
 *- \subpage types
 *\n
 *
 *- \subpage virtualmachine
 *  - \subpage MemoryLibrary
 *  - \subpage CommunicationLibrary
 *    - \subpage UsbhostModule
 *    - \subpage UsbdevModule
 *  - \subpage OutputLibrary
 *    - \subpage PwmModule
 *  - \subpage InputLibrary
 *    - \subpage AnalogModule
 *    - \subpage UartModule
 *  - \subpage SoundLibrary
 *  - \subpage UserInterfaceLibrary
 *    - \subpage UiModule
 *    - \subpage DisplayModule
 *    - \subpage PowerModule
 *
 */

/******************************************************************************
 * WAIT FOR COMPLETION IMPLEMENTATION
 *****************************************************************************/
/*! \page ready Wait for Completion
 * 
 *  All system calls can affect the dispatch status.
 *  
 *  If a system call is completed at once it will not change the dispatch status      \n
 *  If a system call is not completed it will set the dispatch status to "BUSYBREAK"  \n
 *  If a system call fails the dispatch status will be "FAILBREAK"                    \n
 *  
 *  To check for completion of a system call the XXXXXXX_READY (eg. OUTPUT_READY) system 
 *  call is used.
 *  XXXXXXX_READY blocks the calling object at user level until the specific resource
 *  function is completed/failed and then it sets the dispatch 
 *  status to "NOBREAK" or "FAILBREAK"                                                \n            
 *  In the case were another object has used the same resource and the first object 
 *  checks for completion it gets a status equal to "NOBREAK"
 *  
 *  In practice the specific resource saves the calling object id when the function is 
 *  called and when XXXXXXX_READY is called and the function
 *  is not completed the id is checked against the saved one:
 *  
 *    if saved id equals calling id the status will be "BUSYBREAK"                    \n  
 *    if saved id is not equal to calling status will be "NOBREAK"                    \n
 *  
 *  XXXXXXX_TEST can be used to test a resource: if it is busy it will block the calling 
 *  object by setting the dispatch status to "BUSYBREAK"
 *  until not busy.
 */


/******************************************************************************
 * PROGRAM EXAMPLES
 *****************************************************************************/
/*! \page programs Program Examples
 * 
 *  Some simple byte code programs showing howto 
 *
 *- \subpage programexample1
 *- \subpage blockexample1
 *- \subpage vmthreadsexample1
 *- \subpage subparexample1
 *- \subpage stringexample1
 */
 
  
/******************************************************************************
 * BYTE CODES
 *****************************************************************************/
/*! \page bytecodes Byte Codes
 *<hr size="1"/>
 * 
 *  - \subpage VM
 *  - \subpage cMath
 *  - \subpage Logic
 *  - \subpage cMove
 *  - \subpage cBranch
 *  - \subpage cCompare
 *  - \subpage Select
 *  - \subpage cInput 
 *  - \subpage cOutput 
 *  - \subpage cSound 
 *  - \subpage cUi
 *  - \subpage cTimer
 *  - \subpage cCom 
 *  - \subpage cMemory
 *
 *  - \subpage TST 
 *   
 *  - \subpage bytecodedef
 *
 *<hr size="1"/>
 *
 *  - \subpage howtobytecodes
 *  - \subpage bytecodeexamples
 *  - \ref directcommandexamples "Direct Command Examples"
 *  - \subpage blockexamples
 */
 
/******************************************************************************
 * INTERESTING STUFF
 *****************************************************************************/
/*! \page interestingstuff Interesting Stuff
 *
 *- LMS2012 Application Folder Structure 
 *  - \subpage UIdesign \n
 *\n
 *
 *- X3 Graphical Blocks
 *  - \subpage blockexamples
 *\n
 *
 *- Sensor and Motor Detection Describtion 
 *  - \subpage DcmDriver \n
 *\n
 *
 *- UART Sensor and Device Connection Sequence Describtion
 *  - \subpage UartDriver \n
 *\n
 *
 *- UART Sensor and Device Communication Protocol Describtion
 *  - \subpage UartProtocol \n
 *\n
 *
 *- Device Design Guidelines (sensors and motors)
 *  - \subpage legodevicedesign \n
 *  - \subpage thirdpartydevicedesign \n
 *\n
 *
 *
 *
 *
 */
 
/******************************************************************************
 * PRACTICAL STUFF
 *****************************************************************************/
/*! \page practicalstuff Practical Stuff
 *
 *- SD Card
 *  - \subpage formatsd
 *  - \subpage formatdatasd
 *  - \subpage copysd
 *  - \subpage readfssd
 *  - \subpage writefssd 
 *  - \subpage updatesd
 *  - \subpage advansd
 *
 *- EV3 Development on Linux PC
 *  - \subpage  pclinux
 *  - \subpage  pcvm
 *  - \subpage  pcfilesystem
 *  - \subpage  pckernel
 *  - \subpage  pccompile
 *  - \subpage  pccompileapps
 *  - \subpage  pcimage
 * 
 *- U-Boot (need "USB to EV3 Port1" adapter)
 *  - \subpage configuboot
 *  - \subpage updateuboot
 *
 *- LINUX (need WiFi Dongle or "USB to Ethernet" adapter)
 *  - \subpage linuxprompt
 *  - \subpage linuxstartssh
 *
 *- LINUX NFS (need "USB to EV3 Port1" and "USB to Ethernet" adapters)
 *  - \subpage linuxnfsinstall
 *  - \subpage linuxnfs
 *  - \subpage linuxnfsdebug
 *
 */


/******************************************************************************
 * ADVANCED
 *****************************************************************************/
/*! \page advansd Advanced SD Card
 *
 *- \subpage kernelsd
 *
 *- \subpage applicationsd
 *
 *- \subpage makefspk 
 *
 *- \subpage filesyssd
 *
 */
 
 
/******************************************************************************
 * BYTE CODE EXAMPLES
 *****************************************************************************/
/*! \page bytecodeexamples Byte Code Examples
<hr size="1"/>

<b>Handling Screen in Programs </b>
\anchor SCREEN_HANDLING_EXAMPLE1
\verbatim 
  When a program is started the animated run screen will appear as default. First
  time a graphical byte code is used - the screen will stop and the program can
  take over and fully control the screen drawing and updating.


  USE SCREEN FOR GRAPHICS
  -----------------------
  
    opUI_DRAW,LC0(FILLWINDOW),LC0(0),LC0(0),LC0(0)
  
      (clear entire screen by filling it with zero - background color)
      
      
    opUI_DRAW, - - - - - - 
    opUI_DRAW, - - - - - - 
    opUI_DRAW, - - - - - - 
    
      (draw graphical stuff on the screen)
      
    
    opUI_DRAW,LC0(UPDATE)  
  
      (show the stuff by updating the screen)
  


  RESTORE RUN SCREEN
  ------------------
  
    opUI_WRITE,LC0(INIT_RUN)

      (enable the animated run screen)
        

\endverbatim

\n

<b>Motor read Tacho and Speed </b>
\anchor MOTOR_READ_EXAMPLE1
\verbatim 
  It is possible to read and get informations from an output port in the same manner
  as for an input port - only the port number differs - they starts with 16.
  (PORTA = 16, PORTB = 17, PORTC = 18 and PORTD = 19)


  READ MOTOR TACHO COUNT
  ----------------------
  
    opINPUT_DEVICE,LC0(READY_SI),LC0(0),LC0(16),LC0(0),LC0(0),LC0(1),LV0(0)
                                           ----
      (reads si from "LAYER 0" "PORTA" "default type" "mode 0" into "local variable 0")                                          


  READ MOTOR SPEED
  ----------------

    opINPUT_DEVICE,LC0(READY_SI),LC0(0),LC0(19),LC0(0),LC0(2),LC0(1),LV0(0)
                                           ----           --- 
      (reads si from "LAYER 0" "PORTD" "default type" "mode 2" into "local variable 0")                                          


\endverbatim
\ref types "See type 7 and 8 in this link"

\n

<b>Program variable change before start </b>
\anchor PROGRAM_START_EXAMPLE1
\verbatim 
  NORMAL START OF A PROGRAM
  -------------------------
  
    Direct commands:

    // Get image from file
    opFILE,LC0(LOAD_IMAGE),LC0(USER_SLOT),LCS,'.','.','/','a','p','p','s','/','t','s','t','/','t','s','t',0,LV0(0),LV0(4),
    
    // Prepare image for run and start VM threat automatically (object 1)
    opPROGRAM_START,LC0(USER_SLOT),LV0(0),LV0(4),LC0(0),
                                                    --- 

  CHANGE GLOBAL VARIABLE 2 BEFORE STARTING A PROGRAM
  --------------------------------------------------

    Direct commands:

    // Get image from file
    opFILE,LC0(LOAD_IMAGE),LC0(USER_SLOT),LCS,'.','.','/','a','p','p','s','/','t','s','t','/','t','s','t',0,LV0(0),LV0(4),
    
    // Prepare image for run and set program (USER_SLOT) waiting
    opPROGRAM_START,LC0(USER_SLOT),LV0(0),LV0(4),LC0(2),      
                                                    ---
    // Init direct command local variable 0 with 1
    opINIT_BYTES,LV0(0),LC0(1),LC0(1),
    
    // Write direct command local variable 0 to waiting program (USER_SLOT) global variable 2
    opMEMORY_WRITE,LC0(USER_SLOT),LC0(0),LC0(2),LC0(0),LV0(0),

    // Start VM thread (object 1) in waiting program (USER_SLOT)    
    opPROGRAM_INFO,LC0(OBJ_START),LC0(USER_SLOT),LC0(1),


\endverbatim

<b>String Initialisation and Functions </b>
\anchor STRING_EXAMPLE1
\verbatim 
  STRINGS IN VM MEMORY
  --------------------
    Strings are located in the VM's normal global or local variabel space as other DATA8 
    variables and referenced by the variabel (start) number. Enough room must be ensured
    by allocating the next variabel on a suitable distance (string length) ahead.
  
    Examples:
  
      // Allocate space for variables
  
      #define String1 LV0(0)      // String 1 size is maximum 5  characters + zero termination
      #define String2 LV0(6)      // String 2 size is maximum 14 characters + zero termination 
      #define Dummy   LV0(21)     // Next variable 


      // Initialise string variabel 1 with a string constant

        opSTRING,LC0(DUPLICATE),LCS,'L','E','G','O',0,String1,    

      // Initialise string variabel 2 with a another string constant

        opSTRING,LC0(DUPLICATE),LCS,'M','i','n','d','s','t','o','r','m','s',0,String2,
      
      // Preform SUBCALL with three string parameters
    
        opCALL,LC0(MYSUB),LC0(3),String1,String2,String2,
      



      // MYSUB byte codes (checks first string if it is "LEGO" and then adds second string to it)
    
      #define In1     LV0(0)      // String In1 size is maximum 20 characters + zero termination
      #define In2     LV0(21)     // String In2 size is maximum 20 characters + zero termination 
      #define Out     LV1(42)     // String Out size is maximum 20 characters + zero termination 
      #define Result  LV1(63)     // Result for compare 


        0x03,IN_S,(21),IN_S,(21),OUT_S,(21),                      //  MYSUB(In1,In2,Out)
                                                                  //  {
        opSTRING,LC0(COMPARE),In1,LCS,'L','E','G','O',0,Result,   //    STRING(COMPARE,In1,"LEGO",Result)
        opJR_FALSE,Result,LC0(6),                                 //    if (Result != 0)
                                                                  //    {
        opSTRING,LC0(ADD),In1,In2,Out,                            //      STRING(ADD,In1,In2,Out)
                                                                  //    }
        opRETURN,                                                 //  }
        opOBJECT_END,                                  

      // Numbers in parantheses is the string size allocated in the SUBCALLs local variables !


  CHARACTERS IN ARRAYS
  --------------------
    Strings can be allocated as DATA8 arrays and referenced by the array handle. Enough room must
    be ensured making the array so large than it can hold the maximal string length inclusive zero 
    termination (it is possible to resize an array manually).
  
    Examples:
  
      // Allocate space for variables (array handle must use long encoding for later handle encoding)
  
      #define String1 LV1(0)                                      // String 1 is an array handle
      #define String2 LV1(1)                                      // String 2 is an array handle
      
        opARRAY,LC0(CREATE8),LC0(100),String1,                    // Length: 100 characters (including zero termination)
        opARRAY,LC0(CREATE8),LC0(100),String2,                    // Length: 100 characters (including zero termination)
      
      
      // Initialise string variabel 1 with a string constant through system call 

        opSTRING,LC0(DUPLICATE),LCS,'L','E','G','O',0,HND(String1),    


      // Preform SUBCALL with Two array handles
    
        opCALL,LC0(MY_STRING_COPY),LC0(2),String1,String2,


      // Defining SUBCALL for array handle parameter
      
        #define In1     LV1(0)
        #define Out1    LV1(1)
      
        0x02,IN_8,IO_8,                                           //  MY_STRING_COPY (out handles must be in/out 8)
                                                                  //  {
        opSTRING,LC0(DUPLICATE),HND(In1),HND(Out1),               //    STRING(DUPLICATE,&In1,&Out1)
        opRETURN,                                                 //  }
        opOBJECT_END,                                  
      

\endverbatim
\ref stringexample1 "Program Example"
*/
  

/******************************************************************************
 * GRAPHICAL BLOCK IMPLEMENTATION EXAMPLES
 *****************************************************************************/
/*! \page blockexamples Graphical Block Implementation Examples
<hr size="1"/>

<b>X3 NXT Sound Sensor (example taken from NI document "X3 Sensor Blocks.docx") </b>
\verbatim 

  Sound Block:  Volume Value - Immediate return of sound volume in percent dB

    Params      Type        Range                 Notes
    --------    --------    ------------------    --------------------
    PORT        List        1..4                  Static param on top
    VALUE       Number      0..100                [%]


      Implementation Notes:

      Compiler work:  if PORT parameter is static (compiler must generate following variables):
                      LAYER  = 0 ??????           // [0..3]
                      NO     = (PORT - 1)         // [0..3]
                      TYPE   = 3                  // NXT sound sensor
                      MODE   = 0                  // NXT sound sensor mode dB
        
        
      Byte codes:     opINPUT_READ, LAYER, NO, TYPE, MODE, VALUE,
        
        
\endverbatim
\ref cInput "opINPUT"
  

<hr size="1"/>

<b>X3 Ultrasonic Sensor </b>
\verbatim 

  Distance Block:  Distance Cm - Immediate return of distance in cm

    Params      Type        Range                 Notes
    --------    --------    ------------------    --------------------
    PORT        List        1..4                  Static param on top
    VALUE       Number      0..255                [cm]


      Implementation Notes:

      Compiler work:  if PORT parameter is static (compiler must generate following variables):
                      LAYER  = 0 ??????           // [0..3]
                      NO     = (PORT - 1)         // [0..3]
                      TYPE   = 30                 // X3 ultrasonic sensor
                      MODE   = 0                  // X3 ultrasonic sensor mode continuously ping
                      VALUE                       // floating point variable
        
        
      Byte codes:     opINPUT_READSI, LAYER, NO, TYPE, MODE, VALUE,     // read distance in SI units [meter]
                      opMULF, VALUE, 100, VALUE,
        
        
\endverbatim
  

<hr size="1"/>

<b>X3 Color Sensor </b>
\verbatim 

  Color block:  Color value - Immediate return of classified color

    Params      Type        Range                 Notes
    --------    --------    ------------------    --------------------
    PORT        List        1..4                  Static param on top
    COLOR       Number      0..6                  Numbers dependent on HW and FW


      Implementation Notes:

      Compiler work:  if PORT parameter is static (compiler must generate following variables):
                      LAYER  = 0 ??????           // [0..3]
                      NO     = (PORT - 1)         // [0..3]
                      TYPE   = 29                 // X3 color sensor
                      MODE   = 0                  // X3 color sensor mode color
                      VALUE                       // floating point variable
        
        
      Byte codes:     opINPUT_READSI, LAYER, NO, TYPE, MODE, VALUE,     // read color number
        
        
\endverbatim


<hr size="1"/>

<b>X3 MOTOR (example taken from NI document "X3 Output Blocks.docx") </b>
\verbatim 

  Move Block:   For Degrees - Motor action with rotation duration. Block waits for completion

    Params      Type        Range                 Notes
    --------    --------    ------------------    --------------------
    PORT        List        A,B,C,D,AB,...,ALL    Static param on top
    FORWARD     Boolean     0..1
    SPEED       Number      0..100
    DEGREES     Number      0..2147483647         
    BRAKE       Boolean     0..1


      Implementation Notes:

      Compiler work:  if PORT parameter is static (compiler must generate following variables):
                      LAYER  = 0 ??????           // [0..3]
                      NOS    = Bitfield           // [0..0xF]
                      STEP1  = 0                  // No ramp up
                      STEP2  = DEGREES            // Run for degrees
                      STEP3  = 0                  // No ramp down


      Byte codes:     opOUTPUT_STEP_SPEED, LAYER, NOS, SPEED, STEP1, STEP2, STEP3, BRAKE,
                      opOUTPUT_READY, LAYER, NOS,


\endverbatim 
\ref cOutput "opOUTPUT"
  

<hr size="1"/>

<b>X3 SOUND </b>
\verbatim 

  Sound Block:  File - Play a sampled sound file.

    Params      Type        Range                 Notes
    --------    --------    ------------------    --------------------
    NAME        String                            Useful to see on block
    VOLUME      Number      0..100                
    WAIT        Boolean     Wait/Continue         Defaults to wait


      Implementation Notes:

      Compiler work:  none 
      
      Byte codes:     opSOUND, PLAY, VOLUME, NAME,
                      opSOUND_READY,                // only if wait are true
                        


\endverbatim 



*/

/******************************************************************************
 * BUILDIN APPS
 *****************************************************************************/
/*! \page buildinapps Apps
 *
 *  <hr size="1"/>
 *
 *- General Navigation:
 *  - \subpage uiapp
 *
 *- Brick Apps:
 *  - \subpage portviewapp
 *  - \subpage motorcontrolapp
 *  - \subpage ircontrolapp
 *  - \subpage programapp
 *  - \subpage datalogapp
 *
 *- Settings:
 *  - \subpage volumeappcode
 *  - \subpage sleepappcode
 *  - \subpage bluetooth
 *  - \subpage wifiappcode
 *  - \subpage brickinfo
 *
 *- Info:
 *  - \subpage makingapps
 */

 
/******************************************************************************
 * UI
 *****************************************************************************/
/*! \page uiapp Userinterface
 *
 *  <hr size="1"/>
 *
    \htmlonly
    <IMG src="generalnavigation.png">
    \endhtmlonly
    \htmlonly
    <IMG src="filenavigation.png">
    \endhtmlonly
    \htmlonly
    <IMG src="buttonlight.png">
    \endhtmlonly
    \n
    \subpage uiappcode
 */

 
/******************************************************************************
 * PORT VIEW
 *****************************************************************************/
/*! \page portviewapp Port View
 *
 *  <hr size="1"/>
 *
    \htmlonly
    <IMG src="view.png">
    \endhtmlonly
    \n
    \subpage portviewappcode
 */

 
/******************************************************************************
 * MOTOR CONTROL
 *****************************************************************************/
/*! \page motorcontrolapp Motor Control
 *
 *  <hr size="1"/>
 *
    \htmlonly
    <IMG src="motorcontrol.png">
    \endhtmlonly
    \n
    \subpage motorcontrolappcode
 */
 
 
/******************************************************************************
 * IR CONTROL
 *****************************************************************************/
/*! \page ircontrolapp IR Control
 *
 *  <hr size="1"/>
 *
    \htmlonly
    <IMG src="ircontrol.png">
    \endhtmlonly
    \n
    \subpage ircontrolappcode
 */
 
 
/******************************************************************************
 * BRICK PROGRAM
 *****************************************************************************/
/*! \page programapp Brick Program
 *
 *  <hr size="1"/>
 *
    \htmlonly
    <IMG src="program.png">
    \endhtmlonly
    \n
    \subpage brickprogramapp 
    \n
    \subpage brickprogramtemplateapp
 */
 
 
/******************************************************************************
 * BRICK DATALOG
 *****************************************************************************/
/*! \page datalogapp Brick Datalog
 *
 *  <hr size="1"/>
 *
    \htmlonly
    <IMG src="datalog.png">
    \endhtmlonly
    \n
    \subpage brickdatalogapp
 */

 
/******************************************************************************
 * KERNEL / FILESYSTEM VERSIONS
 *****************************************************************************/
/*! \page kernelversions Kernel / Filesystem Versions
 * 
 *  This section describes the relative changes from previous version
 *
 *          
 *\n
 *  <hr size="1"/>
 *\n
 *  <b>KERNEL</b>
 *\n
 *\n
 *  <hr size="1"/>
 *\n
 *  
 *  \version V0.54
 *
 *-# Sensor IIC driver updated                                                                \n
 *  
 *  \version V0.53
 *
 *-# Display spi driver changed (dma)                                                         \n
 *-# SD card driver changed (turn off clock when not used)                                    \n
 *-# PIC IIC driver updated                                                                   \n
 *
 *          
 *\n
 *  <hr size="1"/>
 *\n
 *  <b>FILESYSTEM</b>
 *\n
 *\n
 *  <hr size="1"/>
 *\n
 *  
 *  \version V1.081
 *
 *-# Telnet disabled in run level 5                                                           \n
 *  
 *  \version V0.54
 *
 *-# PRU uarts updated (bitrate center moved 5% up)                                           \n
 *  
 *  \version V0.53
 *
 *-# BT_Init.sh updated                                                                       \n
 *
 *\n
 */


