com.dalsemi.system
Class TINIOS

java.lang.Object
  |
  +--com.dalsemi.system.TINIOS

public class TINIOS
extends java.lang.Object

The TINIOS class contains static methods to read the state of the running tasks and set system configuration variables. The default encoding String is also kept here.


Field Summary
static int BLAST_ALL
          Flag used with blastHeapOnReboot() to reinitialize heap and stored system variables on next boot.
static int BLAST_HEAP
          Flag used with blastHeapOnReboot() to reinitialize heap on next boot.
static int BLAST_NONE
          Flag used with blastHeapOnReboot() to disable a previous command to reinitialize heap and/or system variables on next boot.
static int CRYSTAL_FAIL_OCCURRED
          Crystal fail detect restarted system.
static int DS80C390
          Constant identifier for DS80C390 CPU.
static int DS80C400
          Constant identifier for DS80C400 CPU.
static int DS80C410
          Constant identifier for DS80C410 CPU.
static int DS80C411
          Constant identifier for DS80C411 CPU.
static int FS_MODIFICATION_OCCURRED
          Filesystem modification occurred on last reboot.
static int HEAP_CLEAR_OCCURRED
          Heap clearing occurred on last reboot.
static int MASTER_ERASE_OCCURRED
          Master erase occurred on last reboot.
static int NETWORK_CONFIGURATION_RESTORED
          Network configuration was restored on last reboot.
static int POWER_FAIL_OCCURRED
          Power fail occurred prior to boot.
static int SERIAL_EX_GET_DIVISOR
          Sets the 16550 UART divisor value.
static int SERIAL_EX_GET_PORT_ADDRESS
          Returns the address to the 16550 UART.
static int SERIAL_EX_GET_SEARCH_ENABLE
          Checks if the external serial port search is enabled or disabled.
static int SERIAL_EX_SET_DIVISOR
          Returns the 16550 UART divisor value.
static int SERIAL_EX_SET_PORT_ADDRESS
          Sets the address to the 16550 UART.
static int SERIAL_EX_SET_SEARCH_ENABLE
          Enables searching for the external serial ports on boot.
static int SERIAL_GET_BOOT_MESSAGE_STATE
          Checks the state of boot messages
static int SERIAL_GET_DEBUG_MESSAGE_STATE
          Checks if the serial debug port is enabled
static int SERIAL_GET_ENABLE
          Determines if a serial port is enabled.
static int SERIAL_GET_RTSCTS_FLOW_CONTROL
          Checks if flow control is enabled on a specified port
static int SERIAL_SET_BOOT_MESSAGE_STATE
          Enables or disables serial0 boot messages
static int SERIAL_SET_DEBUG_MESSAGE_STATE
          Enables or disables the bit bang debug serial port.
static int SERIAL_SET_ENABLE
          Enables or disables serial ports.
static int SERIAL_SET_RTSCTS_FLOW_CONTROL
          Enables or disables RTS/CTS Flow Control for a specified serial port.
static int WATCHDOG_RESET_OCCURRED
          The hardware watchdog restarted system.
 
Method Summary
static void addProcessDeathListener(ProcessDeathListener pdl)
          Registers a listener to TINIOS that is executed when the process terminates.
static void blastHeapOnReboot(int blastType)
           Calling this function will cause the heap to be destroyed (reinitialized) on the next boot.
static void changeTaskPriority(int taskID, int priorityLevel)
          Changes a tasks priority in the TINIOS scheduler.
static void disablePowerFailRecovery()
          Disables the ability to recover after a power fail during a critical, atomic heap modification.
static void enableSerialPort1(boolean enable)
          Deprecated. Use setSerial(SERIAL_SET_ENABLE,port,myBooleanHere);
static int execTINIImage(java.lang.String newProcessName, int address)
          Execute a contiguous TINI executable image at specified memory address.
static void execute(java.lang.Object[] commandLine, SystemInputStream in, SystemPrintStream out, SystemPrintStream err, java.util.Hashtable env)
          Executes a command in the shell.
static void feedWatchdog()
          Resets (feeds) the Watchdog timer.
static int getBootState()
          Returns the restore state from last reboot.
static int getClockMultiplier()
          Gets the clock multiplier (1, 2 or 4).
static int getCPU()
          Gets the CPU type, either DS80C390, DS80C400, DS80C410, or DS80C411.
static int getCrystalSpeed()
          Gets the approximate crystal speed in Hz.
static java.util.Hashtable getCurrentEnvironment()
          Returns a copy of the current environment.
static int getCurrentStackUsage()
          Gets the amount of Java Stack being used by the current thread.
static byte getCurrentUID()
          Returns the user ID of the current user.
static java.lang.String getCurrentUserName()
          Returns the name of the current user logged in.
static int getExternalSerialPortAddress(int portNum)
          Deprecated. Use setSerial(SERIAL_EX_GET_PORT_ADDRESS,port,0);
static boolean getExternalSerialPortEnable(int portNum)
          Deprecated. Use setSerial(SERIAL_GET_ENABLE,port,0);
protected static boolean getExternalSerialPortSearchEnable()
          Deprecated. Use setSerial(SERIAL_EX_GET_SEARCH_ENABLE,port,0);
static int getFreeRAM()
          Gets the free RAM.
static java.lang.String getFromCurrentEnvironment(java.lang.String key)
          Gets the value of the given key from the current environment.
static int getOwnerIDByTaskID(int taskid)
          Gets the owner of specified task ID.
static int getProcessLimit()
          Returns the process limit in TINIOS
static int getRebootCount()
          Returns the cumulative number of system restarts.
static boolean getRecoveryHash(byte[] recoveryHash)
          Returns the recovery hash.
static boolean getRTSCTSFlowControlEnable(int portNumber)
          Deprecated. Use setSerial(SERIAL_GET_RTSCTS_FLOW_CONTROL,port,0);
static boolean getSerialBootMessagesState()
          Deprecated. Use setSerial(SERIAL_GET_BOOT_MESSAGE_STATE,0,0);
static TINIShell getShell()
          Returns the current shell.
static java.lang.String getShellName()
          Returns the name of the shell.
static java.lang.String getShellVersion()
          Returns the version of the shell.
static int getStackSize()
          Gets the size of the Java Stack for the currently executing thread.
static java.util.Hashtable getSystemEnvironment()
          Returns the system environment.
static int getTaskID()
          Gets this tasks ID
static java.lang.String[] getTaskTable()
          Returns the task table.
static int[] getTaskTableIDs()
          Returns the task table ID list.
static int getThreadLimit()
          Returns the Thread limit in TINIOS
static java.lang.String getTimeZone()
          Gets a string representing the current Timezone.
static java.lang.String getTINIHWVersion()
          Gets a string representing the TINI HW Version.
static java.lang.String getTINIOSFirmwareVersion()
          Gets a string representing the TINI OS Firmware Version.
static java.lang.String getTINISerialNumber()
          Gets the hardware serial number.
static int getUIDByUserName(java.lang.String username)
          Returns the ID of the user with the given user name.
static java.lang.String getUserNameByUID(byte uid)
          Returns the user name that corresponds to the given user ID.
static boolean isAdmin(byte uid)
          Determines if the given user ID has administrative rights.
static boolean isConsoleOutputEnabled()
          Returns the state of Slush startup message output.
static boolean isCurrentTaskInit()
          Returns true if the current process is the init process (first running user process)
static boolean isCurrentUserAdmin()
          Indicates whether or not the current user has admin privileges.
static boolean isTaskRunning(int taskid)
          Checks to see if task with specified ID is running
static void killTask(int taskID)
          Stops and removes task from system.
static void killTask(int taskID, boolean force)
          Stops and removes task from system.
static void lockInitProcesses()
          Allows root to protect the 1st two processes from being killed by non admin users.
static int login(java.lang.String userName, java.lang.String password)
          Logs a user into the system and sets his privilege level correctly.
static void logout(java.lang.Object info)
          Logs the current user out of the system and returns the privilege level of the current process to the default state.
static void reboot()
          Performs an orderly system reboot.
static void removeProcessDeathListener(ProcessDeathListener pdl)
          Removes a death listener from the system.
static void setConsoleOutputEnabled(boolean set)
          Sets the state of Slush startup message output.
static void setDebugMessagesState(boolean on)
          Deprecated. Use setSerial(SERIAL_SET_DEBUG_MESSAGE_STATE,0,myBooleanHere);
static void setExternalSerialPortAddress(int portNum, int address)
          Deprecated. Use setSerial(SERIAL_EX_SET_PORT_ADDRESS,port,portAddressInt);
static void setExternalSerialPortEnable(int portNum, boolean enable)
          Deprecated. Use setSerial(SERIAL_SET_ENABLE,port,yourBooleanHere);
static void setExternalSerialPortSearchEnable(boolean enable)
          Deprecated. Use setSerial(SERIAL_EX_SET_SEARCH_ENABLE,port,myBooleanHere);
static void setIrDAClockPinState(boolean on)
          Turn on or off the IrDA clock pin (P3.5).
static void setRecoveryHash(byte[] recoveryHash)
          Sets the recovery hash.
static boolean setRTSCTSFlowControlEnable(int portNumber, boolean enable)
          Deprecated. Use setSerial(SERIAL_SET_RTSCTS_FLOW_CONTROL,port,myBooleanHere);
static int setSerial(int cmd, int port, boolean arg)
          setSerial is used to set serial port options in TINIOS that can't be set using javax.comm.
static int setSerial(int cmd, int port, byte[] arr)
          setSerial is used to set serial port options in TINIOS that can't be set using javax.comm.
static int setSerial(int cmd, int port, int arr)
          setSerial is used to set serial port options in TINIOS that can't be set using javax.comm.
static void setSerialBootMessagesState(boolean on)
          Deprecated. Use setSerial(SERIAL_SET_BOOT_MESSAGE_STATE,0,myBooleanHere);
static void setShell(TINIShell newShell)
          Sets the system shell.
static void setStackSize(int size)
          Sets the Java Stack Size of the currently executing thread.
static void setTimeZone(java.lang.String zone)
          Sets the current timezone.
static void setWatchdogTimeout(int mstimeout)
          Sets the TINI Watchdog timeout.
static long uptimeMillis()
          Gets the approximate number of milliseconds the system has been running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORK_CONFIGURATION_RESTORED

public static final int NETWORK_CONFIGURATION_RESTORED
Network configuration was restored on last reboot.
See Also:
getBootState()

MASTER_ERASE_OCCURRED

public static final int MASTER_ERASE_OCCURRED
Master erase occurred on last reboot.
See Also:
getBootState()

HEAP_CLEAR_OCCURRED

public static final int HEAP_CLEAR_OCCURRED
Heap clearing occurred on last reboot.
See Also:
getBootState()

FS_MODIFICATION_OCCURRED

public static final int FS_MODIFICATION_OCCURRED
Filesystem modification occurred on last reboot.
See Also:
getBootState()

POWER_FAIL_OCCURRED

public static final int POWER_FAIL_OCCURRED
Power fail occurred prior to boot.
See Also:
getBootState()

WATCHDOG_RESET_OCCURRED

public static final int WATCHDOG_RESET_OCCURRED
The hardware watchdog restarted system.
See Also:
getBootState()

CRYSTAL_FAIL_OCCURRED

public static final int CRYSTAL_FAIL_OCCURRED
Crystal fail detect restarted system.
See Also:
getBootState()

BLAST_HEAP

public static final int BLAST_HEAP
Flag used with blastHeapOnReboot() to reinitialize heap on next boot.
See Also:
blastHeapOnReboot(int)

BLAST_ALL

public static final int BLAST_ALL
Flag used with blastHeapOnReboot() to reinitialize heap and stored system variables on next boot.
See Also:
blastHeapOnReboot(int)

BLAST_NONE

public static final int BLAST_NONE
Flag used with blastHeapOnReboot() to disable a previous command to reinitialize heap and/or system variables on next boot. NOTE: If disablePowerFailRecovery has been called, this parameter will be ignored.
See Also:
blastHeapOnReboot(int)

SERIAL_SET_ENABLE

public static final int SERIAL_SET_ENABLE
Enables or disables serial ports. Serial 0 is always enabled. Use a boolean parameter
See Also:
setSerial(int,int,boolean)

SERIAL_GET_ENABLE

public static final int SERIAL_GET_ENABLE
Determines if a serial port is enabled.
See Also:
setSerial(int,int,boolean)

SERIAL_SET_RTSCTS_FLOW_CONTROL

public static final int SERIAL_SET_RTSCTS_FLOW_CONTROL
Enables or disables RTS/CTS Flow Control for a specified serial port. Only serial0 or serial1 or serial4 can have RTS/CTS flow control enabled at a time.
See Also:
setSerial(int,int,boolean)

SERIAL_GET_RTSCTS_FLOW_CONTROL

public static final int SERIAL_GET_RTSCTS_FLOW_CONTROL
Checks if flow control is enabled on a specified port
See Also:
setSerial(int,int,boolean)

SERIAL_SET_BOOT_MESSAGE_STATE

public static final int SERIAL_SET_BOOT_MESSAGE_STATE
Enables or disables serial0 boot messages
See Also:
setSerial(int,int,boolean)

SERIAL_SET_DEBUG_MESSAGE_STATE

public static final int SERIAL_SET_DEBUG_MESSAGE_STATE
Enables or disables the bit bang debug serial port. Use a boolean parameter
See Also:
setSerial(int,int,boolean)

SERIAL_GET_DEBUG_MESSAGE_STATE

public static final int SERIAL_GET_DEBUG_MESSAGE_STATE
Checks if the serial debug port is enabled
See Also:
setSerial(int,int,boolean)

SERIAL_GET_BOOT_MESSAGE_STATE

public static final int SERIAL_GET_BOOT_MESSAGE_STATE
Checks the state of boot messages
See Also:
setSerial(int,int,boolean)

SERIAL_EX_SET_SEARCH_ENABLE

public static final int SERIAL_EX_SET_SEARCH_ENABLE
Enables searching for the external serial ports on boot. Applies to the external serial ports only.
See Also:
setSerial(int,int,boolean)

SERIAL_EX_GET_SEARCH_ENABLE

public static final int SERIAL_EX_GET_SEARCH_ENABLE
Checks if the external serial port search is enabled or disabled. Applies to external serial ports only
See Also:
setSerial(int,int,boolean)

SERIAL_EX_SET_PORT_ADDRESS

public static final int SERIAL_EX_SET_PORT_ADDRESS
Sets the address to the 16550 UART. Applies to external serial ports only
See Also:
setSerial(int,int,boolean)

SERIAL_EX_GET_PORT_ADDRESS

public static final int SERIAL_EX_GET_PORT_ADDRESS
Returns the address to the 16550 UART. Applies to external serial ports only. Uses an integer parameter.
See Also:
setSerial(int,int,int)

SERIAL_EX_GET_DIVISOR

public static final int SERIAL_EX_GET_DIVISOR
Sets the 16550 UART divisor value. Applies to external serial ports only
See Also:
setSerial(int,int,int)

SERIAL_EX_SET_DIVISOR

public static final int SERIAL_EX_SET_DIVISOR
Returns the 16550 UART divisor value. Applies to external serial ports only. Use a integer parameter.
See Also:
setSerial(int,int,int)

DS80C390

public static final int DS80C390
Constant identifier for DS80C390 CPU.
See Also:
getCPU()

DS80C400

public static final int DS80C400
Constant identifier for DS80C400 CPU.
See Also:
getCPU()

DS80C410

public static final int DS80C410
Constant identifier for DS80C410 CPU.
See Also:
getCPU()

DS80C411

public static final int DS80C411
Constant identifier for DS80C411 CPU.
See Also:
getCPU()
Method Detail

setSerial

public static int setSerial(int cmd,
                            int port,
                            byte[] arr)
                     throws javax.comm.UnsupportedCommOperationException
setSerial is used to set serial port options in TINIOS that can't be set using javax.comm. The following commands are available.

SERIAL_SET_ENABLE
SERIAL_GET_ENABLE
Enable or disable a serial port.
SERIAL_SET_RTSCTS_FLOW_CONTROL
SERIAL_GET_RTSCTS_FLOW_CONTROL
Enable or disable RTS/CTS flow control.
SERIAL_SET_BOOT_MESSAGE_STATE
SERIAL_GET_BOOT_MESSAGE_STATE
Show or hide serial debug on startup
SERIAL_SET_DEBUG_MESSAGE_STATE
SERIAL_GET_DEBUG_MESSAGE_STATE
Enable or disable the state of the debug serial port


The following options are available for external serial ports only.

SERIAL_EX_SET_SEARCH_ENABLE
SERIAL_EX_GET_SEARCH_ENABLE
Enable or disable searching for external serial ports on startup
SERIAL_EX_SET_PORT_ADDRESS
SERIAL_EX_GET_PORT_ADDRESS
Sets the address of the 16550 UART
SERIAL_EX_SET_DIVISOR
SERIAL_EX_GET_DIVISOR
Sets the divisor of the 16550 UART
setSerial replaces the TINI 1.02 TINIOS serial calls, which were very specific to the DS80C390. It provides a more flexible, expandable serial port API for future microcontrollers running the TINI platform. Note that for RTS\CTS flow control only ONE internal Serial port can be enabled at a time. Enable is persistant over process Death, as this is a System call.
Parameters:
cmd - The serial port command to be executed
port - The serial port to reference
arr - Byte array of parameters
Throws:
javax.comm.UnsupportedCommOperationException - - if Unable to carry out the command specifed or if attempt is made to enable RTS\CTS flow control on more than one port at a time or if attempt to set divisor on Serial0,1 or 4

setSerial

public static int setSerial(int cmd,
                            int port,
                            boolean arg)
                     throws javax.comm.UnsupportedCommOperationException
setSerial is used to set serial port options in TINIOS that can't be set using javax.comm. This is a helper version for serial commands requiring boolean arguments like SERIAL_SET_ENABLE.
Parameters:
cmd - The serial port command to be executed
port - The serial port to reference
arg - For boolean operations, pass true or false.
See Also:
setSerial(int,int,byte[])

setSerial

public static int setSerial(int cmd,
                            int port,
                            int arr)
                     throws javax.comm.UnsupportedCommOperationException
setSerial is used to set serial port options in TINIOS that can't be set using javax.comm. This is a helper version for serial commands requiring integer arguments like SERIAL_EX_SET_DIVISOR.
Parameters:
cmd - The serial port command to be executed
port - The serial port to reference
arr - Integer argument to the command.
See Also:
setSerial(int,int,byte[])

setShell

public static void setShell(TINIShell newShell)
                     throws java.lang.SecurityException
Sets the system shell. You must be admin to call this function, and you can only set a shell if one has not been previously set.
Parameters:
newShell - new shell for the system to use

login

public static int login(java.lang.String userName,
                        java.lang.String password)
Logs a user into the system and sets his privilege level correctly. Most shells will have a list of valid users and their corresponding passwords and user id's to consult when this method is called. (Such as a passwd file.)
Parameters:
userName - user name of the user logging in
password - password for this user
Returns:
user ID of the newly logged in user, or -1 if the userName password combination was not correct

logout

public static void logout(java.lang.Object info)
Logs the current user out of the system and returns the privilege level of the current process to the default state.
Parameters:
info - any extra information needed in the logout process

isCurrentUserAdmin

public static boolean isCurrentUserAdmin()
Indicates whether or not the current user has admin privileges.
Returns:
true if the user has admin rights, false otherwise

getCurrentUID

public static byte getCurrentUID()
Returns the user ID of the current user.
Returns:
current user's ID

isAdmin

public static boolean isAdmin(byte uid)
Determines if the given user ID has administrative rights.
Parameters:
uid - the user ID.
Returns:
true if the user is an administrator, false otherwise.

getUserNameByUID

public static java.lang.String getUserNameByUID(byte uid)
Returns the user name that corresponds to the given user ID.
Parameters:
uid - user id to check
Returns:
the user name that corresponds to the given user ID, or null if that ID is not valid.

getUIDByUserName

public static int getUIDByUserName(java.lang.String username)
Returns the ID of the user with the given user name.
Parameters:
username - user username to check.
Returns:
the ID of the user with the given user name, or -1 if that user does not exist.

getCurrentUserName

public static java.lang.String getCurrentUserName()
Returns the name of the current user logged in.
Returns:
name of the current user

getSystemEnvironment

public static java.util.Hashtable getSystemEnvironment()
Returns the system environment. (i.e. the environment that all processes see when they start up.
Returns:
a copy of the system environment

getCurrentEnvironment

public static java.util.Hashtable getCurrentEnvironment()
Returns a copy of the current environment.
Returns:
current environment

getFromCurrentEnvironment

public static java.lang.String getFromCurrentEnvironment(java.lang.String key)
Gets the value of the given key from the current environment.
Parameters:
key - The key to lookup in the current environment.
Returns:
The value of the key, or null if the key is not set in the current environment.

execute

public static void execute(java.lang.Object[] commandLine,
                           SystemInputStream in,
                           SystemPrintStream out,
                           SystemPrintStream err,
                           java.util.Hashtable env)
                    throws java.lang.Exception
Executes a command in the shell.
Parameters:
commandLine - An Object array containing the command in the first element, followed by any parameters need for that command in a String[] in the second element.
in - The stream the command will use to get input.
out - The stream used to report non-critical messages.
err - The stream used to report critical messages.
env - A table of environment variables.
Throws:
java.lang.Exception - Any exception raised by the command.

getShellName

public static java.lang.String getShellName()
Returns the name of the shell.
Returns:
The name of the shell.

getShellVersion

public static java.lang.String getShellVersion()
Returns the version of the shell.
Returns:
The shell version.

getShell

public static TINIShell getShell()
Returns the current shell.
Returns:
current shell

isConsoleOutputEnabled

public static boolean isConsoleOutputEnabled()
Returns the state of Slush startup message output.
Returns:
true if Slush console output is enabled, false if disabled

setConsoleOutputEnabled

public static void setConsoleOutputEnabled(boolean set)
Sets the state of Slush startup message output.
Parameters:
set - true if Slush output should be enabled, false if it should be disabled

getExternalSerialPortEnable

public static boolean getExternalSerialPortEnable(int portNum)
Deprecated. Use setSerial(SERIAL_GET_ENABLE,port,0);

Gets the state of the external serial port described by portNum. Currently only ports 2 and 3 are supported. Throws IllegalArgumentException for all other specified ports.
Parameters:
portNum - specifies number of external serial port
Returns:
true if the external serial port enabled
See Also:
setSerial(int,int,int)

setExternalSerialPortEnable

public static void setExternalSerialPortEnable(int portNum,
                                               boolean enable)
Deprecated. Use setSerial(SERIAL_SET_ENABLE,port,yourBooleanHere);

Sets the state of the external serial port. Currently only ports 2 and 3 are supported. Throws IllegalArgumentException for all other specified ports.
Parameters:
portNum - specifies number of external serial port
enable - true to enable, false to disable
See Also:
setSerial(int,int,boolean)

getExternalSerialPortSearchEnable

protected static boolean getExternalSerialPortSearchEnable()
Deprecated. Use setSerial(SERIAL_EX_GET_SEARCH_ENABLE,port,0);

Returns true if a search for serial ports 2 and 3 will be performed on boot.
Returns:
true if enabled, false if disabled
See Also:
setSerial(int,int,int)

setExternalSerialPortSearchEnable

public static void setExternalSerialPortSearchEnable(boolean enable)
Deprecated. Use setSerial(SERIAL_EX_SET_SEARCH_ENABLE,port,myBooleanHere);

Searches for serial ports 2 and 3 on boot if enabled.
Parameters:
enable - true if enabled, false if disabled
See Also:
setSerial(int,int,boolean)

getExternalSerialPortAddress

public static int getExternalSerialPortAddress(int portNum)
Deprecated. Use setSerial(SERIAL_EX_GET_PORT_ADDRESS,port,0);

Gets the address of the external serial port described by portNum. Currently only ports 2 and 3 are supported. Throws IllegalArgumentException for all other specified ports.
Parameters:
portNum - specifies number of external serial port
Returns:
address of external serial port
See Also:
setSerial(int,int,int)

setExternalSerialPortAddress

public static void setExternalSerialPortAddress(int portNum,
                                                int address)
Deprecated. Use setSerial(SERIAL_EX_SET_PORT_ADDRESS,port,portAddressInt);

Sets the address of the external serial port described by portNum. Currently only ports 2 and 3 are supported. Throws IllegalArgumentException for all other specified ports.
Parameters:
portNum - specifies number of external serial port
address - specifies address of external serial port
See Also:
setSerial(int,int,int)

setIrDAClockPinState

public static void setIrDAClockPinState(boolean on)
Turn on or off the IrDA clock pin (P3.5). This pin oscillates at 16 times the baud rate generator for serial port 1. Note, P3.5 is used for internal 1-Wire and will not work when the IrDA clock pin is running.
Parameters:
on - true to enable IrDA clock, false to disable

setWatchdogTimeout

public static void setWatchdogTimeout(int mstimeout)
Sets the TINI Watchdog timeout. If timer is allowed to run without being reset (fed) system will reboot.
Parameters:
mstimeout - - timeout, in milliseconds. Don't set this too low, because Java ain't that quick! Set to zero to turn off the watchdog.

feedWatchdog

public static void feedWatchdog()
Resets (feeds) the Watchdog timer. This must be called frequently at some interval less than the watchdog timeout value to prevent the system from rebooting. Watchdog timers are useful for recovering the system when a critical process goes awry.

getTINIOSFirmwareVersion

public static java.lang.String getTINIOSFirmwareVersion()
Gets a string representing the TINI OS Firmware Version.
Returns:
version string

getTINIHWVersion

public static java.lang.String getTINIHWVersion()
Gets a string representing the TINI HW Version.
Returns:
version string, or null if version is not known

getTINISerialNumber

public static final java.lang.String getTINISerialNumber()
Gets the hardware serial number. This is the address of the DS2502 configuration memory.
Returns:
HW serial number

setTimeZone

public static void setTimeZone(java.lang.String zone)
                        throws java.lang.IllegalArgumentException
Sets the current timezone. If you want to set the time to an offset from GMT, pass in a string of the form "TOffset" - Example "-10" sets the timezone to an offset of GMT-10.
Parameters:
zone - timezone string

getTimeZone

public static java.lang.String getTimeZone()
Gets a string representing the current Timezone.
Returns:
timezone string

isCurrentTaskInit

public static boolean isCurrentTaskInit()
Returns true if the current process is the init process (first running user process)
Returns:
true if the current process is the init process (first running user process)

getTaskID

public static int getTaskID()
Gets this tasks ID
Returns:
my Task ID

lockInitProcesses

public static void lockInitProcesses()
Allows root to protect the 1st two processes from being killed by non admin users. Process 1 is the GC, process 2 is the user program in bank 7. You must be admin to call this function.

getOwnerIDByTaskID

public static int getOwnerIDByTaskID(int taskid)
Gets the owner of specified task ID.
Parameters:
taskid - ID of task
Returns:
owner ID

isTaskRunning

public static boolean isTaskRunning(int taskid)
Checks to see if task with specified ID is running
Parameters:
taskid - ID of task
Returns:
true if task is running

getTaskTable

public static java.lang.String[] getTaskTable()
Returns the task table.
Returns:
string array with size equal to number of tasks

getTaskTableIDs

public static int[] getTaskTableIDs()
Returns the task table ID list.
Returns:
int array with size equal to number of tasks

killTask

public static void killTask(int taskID)
Stops and removes task from system.
Parameters:
taskID - Task ID of task to kill
Throws:
java.lang.IllegalArgumentException - if task does not exist.

killTask

public static void killTask(int taskID,
                            boolean force)
Stops and removes task from system.
Parameters:
taskID - Task ID of task to kill
force - false to request, true to demand kill.
Throws:
java.lang.IllegalArgumentException - if task does not exist.

changeTaskPriority

public static void changeTaskPriority(int taskID,
                                      int priorityLevel)
Changes a tasks priority in the TINIOS scheduler. Valid priorities for the TINIOS scheduler:

0 - highest priority

1 - default priority

2 -

3 - lowest priority

Parameters:
taskID - Task ID of task to change
priorityLevel - new priority level of task
Throws:
java.lang.IllegalArgumentException - if task does not exist, or invalid priority level.

getFreeRAM

public static final int getFreeRAM()
Gets the free RAM.
Returns:
available free RAM

reboot

public static final void reboot()
Performs an orderly system reboot.

getSerialBootMessagesState

public static final boolean getSerialBootMessagesState()
Deprecated. Use setSerial(SERIAL_GET_BOOT_MESSAGE_STATE,0,0);

Gets the state of TINIOS serial0 boot up messages.
Returns:
true or false state of boot messages
See Also:
setSerial(int,int,int)

setSerialBootMessagesState

public static final void setSerialBootMessagesState(boolean on)
Deprecated. Use setSerial(SERIAL_SET_BOOT_MESSAGE_STATE,0,myBooleanHere);

Sets the state of TINIOS serial0 boot up messages.

NOTE: This value will take effect on the next boot. This value is sticky and will survive across reboot.

Parameters:
on - sets to true to turn on boot messages, false to turn off
See Also:
setSerial(int,int,boolean)

setDebugMessagesState

public static final void setDebugMessagesState(boolean on)
Deprecated. Use setSerial(SERIAL_SET_DEBUG_MESSAGE_STATE,0,myBooleanHere);

Sets the state of TINIOS bit bang debug port messages.

NOTE: This value is sticky and will survive across reboot.

Parameters:
on - sets to true to turn on debug messages, false to turn off
See Also:
setSerial(int,int,boolean)

blastHeapOnReboot

public static final void blastHeapOnReboot(int blastType)

Calling this function will cause the heap to be destroyed (reinitialized) on the next boot. All data in RAM will be destroyed. Initialization of system variables is conditional.

WARNING: This is designed to be used when the application in flash, and the user does not care if the filesystem is destroyed.

NOTE: System variables are kept in a separate portion of the RAM, and are only destroyed with the BLAST_ALL parameter to this function.

NOTE: If disablePowerFailRecovery has been called, the BLAST_NONE parameter will be ignored.

Calling this function only sets the trigger for the next boot. The trigger is disengaged immediately after it fires after boot. Every subsequent boot will be unaffected, unless the user calls this function again.

Parameters:
blastType - - BLAST_HEAP for heap reinit only BLAST_ALL for heap reinit and stored system variable init BLAST_NONE to rescind a previous BLAST_HEAP or BLAST_ALL
Throws:
java.lang.IllegalArgumentException - If an invalid parameter is used, or invalid BLAST_NONE request.
See Also:
BLAST_HEAP, BLAST_ALL, BLAST_NONE

disablePowerFailRecovery

public static final void disablePowerFailRecovery()
Disables the ability to recover after a power fail during a critical, atomic heap modification.

DANGER: Do not turn this off unless you know what you are doing. All heap data could become corrupted.

NOTE: This function will automatically call blastHeapOnReboot(BLAST_HEAP) to ensure heap data integrity. If you wish to BLAST_ALL, make sure to follow disablePowerFailRecovery() with blastHeapOnReboot(BLAST_ALL).

Calling this function disables POR recovery until the next firmware restart/reboot. On the next boot, POR protection will be reenabled.

The benefit to disabling power fail recovery is an improved speed of object creation, as well as a faster garbage collector. Performance should increase about 30% on these operations.


enableSerialPort1

public static final void enableSerialPort1(boolean enable)
Deprecated. Use setSerial(SERIAL_SET_ENABLE,port,myBooleanHere);

Enables or disables serial port 1. Enabling serial port 1 causes the external 1-Wire to be disabled. Disabling serial port 1 enables external 1-Wire.
Parameters:
enable - true to enable serial port 1, false will disable serial port 1
See Also:
setSerial(int,int,boolean)

addProcessDeathListener

public static void addProcessDeathListener(ProcessDeathListener pdl)
Registers a listener to TINIOS that is executed when the process terminates. This allows cleanup code to be run if a process is killed by the system.
Parameters:
pdl - ProcessDeathListener to be added to the registered death listeners.

removeProcessDeathListener

public static void removeProcessDeathListener(ProcessDeathListener pdl)
Removes a death listener from the system.
Parameters:
pdl - ProcessDeathListener to be removed

uptimeMillis

public static final long uptimeMillis()
Gets the approximate number of milliseconds the system has been running. This number is guaranteed to be less than or equal to the actual uptime. It will never be larger.
Returns:
number of milliseconds since last boot

getRecoveryHash

public static boolean getRecoveryHash(byte[] recoveryHash)
Returns the recovery hash. This hash can be used on system recovery as the hash of the root password for login purposes.
Parameters:
recoveryHash - array to be filled in with the recovery hash.
Returns:
true if a hash has been stored. false otherwise.

setRecoveryHash

public static void setRecoveryHash(byte[] recoveryHash)
Sets the recovery hash. This hash can be used on system recovery as the hash of the root password for login purposes.
Parameters:
recoveryHash - recovery hash to be stored

getBootState

public static int getBootState()
Returns the restore state from last reboot.
Returns:
an integer representing the extent of any restoration that was performed at boot time. This number will be the Inclusive-OR of bit fields containing information on heap restore state, file system restore state and network restore state.
See Also:
NETWORK_CONFIGURATION_RESTORED, MASTER_ERASE_OCCURRED, HEAP_CLEAR_OCCURRED, FS_MODIFICATION_OCCURRED, POWER_FAIL_OCCURRED, WATCHDOG_RESET_OCCURRED, CRYSTAL_FAIL_OCCURRED

getRebootCount

public static int getRebootCount()
Returns the cumulative number of system restarts.
Returns:
an integer representing number of system restarts

setRTSCTSFlowControlEnable

public static boolean setRTSCTSFlowControlEnable(int portNumber,
                                                 boolean enable)
                                          throws javax.comm.UnsupportedCommOperationException
Deprecated. Use setSerial(SERIAL_SET_RTSCTS_FLOW_CONTROL,port,myBooleanHere);

Enables RTS/CTS hardware flow control for the given serial port. RTS/CTS hardware flow control is only supported on one serial port at a time. If RTS/CTS flow control is enabled for a different port than the port indicated, an UnsupportedCommOperationException will be thrown. If harware flow control is enabled, DTR and DCD can not be used for BitPort. This method will always return true for serial2 and serial3.
Parameters:
portNumber - - the number of the port number to enable RTS/CTS flow control
enable - - enables or disables the RTS/CTS hardware flow control for the given port
Returns:
true if the operation was successful, false if the hardware version of TINI does not support RTS/CTS hardware flow control
Throws:
javax.comm.UnsupportedCommOperationException - - if another Internal Serial Port has flow control enabled. Or if attempt is made to enable RTS/CTS hardware flow control for Serial4 on the 390
See Also:
setSerial(int,int,boolean)

getRTSCTSFlowControlEnable

public static boolean getRTSCTSFlowControlEnable(int portNumber)
Deprecated. Use setSerial(SERIAL_GET_RTSCTS_FLOW_CONTROL,port,0);

Returns the state of the RTS/CTS flow control for the given port.
Parameters:
portNumber - - the number of the port to get RTS/CTS flow control information.
Returns:
true if RTS/CTS flow control is enabled.
See Also:
setSerial(int,int,int)

getThreadLimit

public static final int getThreadLimit()
Returns the Thread limit in TINIOS
Returns:
maximum Threads per process that can be running at the same time.

getProcessLimit

public static final int getProcessLimit()
Returns the process limit in TINIOS
Returns:
maximum processes that can be running at the same time.

setStackSize

public static void setStackSize(int size)
Sets the Java Stack Size of the currently executing thread. The default stack size is 2560 bytes. Stack sizes over 64K will throw an OutOfMemoryError.
Parameters:
size - of the new stack
Throws:
OutOfMemoryError - if the amount of memory requested is not available or if the amount requested is 64K or greater
java.lang.IllegalArgumentException - if the amount of memory requested is smaller than the current amount of stack in use or less than 500 bytes (anything less tends to be dangerous)

getStackSize

public static int getStackSize()
Gets the size of the Java Stack for the currently executing thread. Note that this will not equal the amount specified by the previous call to setStackSize(int) because a certain amount of memory is consumed for stack overhead, which is not reported by this method.
Returns:
size of current Java Stack (in bytes)

getCurrentStackUsage

public static int getCurrentStackUsage()
Gets the amount of Java Stack being used by the current thread.
Returns:
amount of stack currently in use (in bytes)

execTINIImage

public static int execTINIImage(java.lang.String newProcessName,
                                int address)
Execute a contiguous TINI executable image at specified memory address. This function is intended to allow execution of TINI executable binaries from flash. These binaries must be contiguous and whole. Normal checks are performed to verify binary compatibility and validity (CRC).
Parameters:
newProcessName - Name of new process
address - Memory address of contiguous TINI executable image
Returns:
process ID of new process, or < 0 for error

getCrystalSpeed

public static int getCrystalSpeed()
Gets the approximate crystal speed in Hz. The crystal speed multiplied with the clock multiplier is the CPU operating frequency.
Returns:
crystal speed in Hz.
See Also:
getClockMultiplier()

getClockMultiplier

public static int getClockMultiplier()
Gets the clock multiplier (1, 2 or 4). The crystal speed multiplied with the clock multiplier is the CPU operating frequency.
Returns:
clock multiplier (1, 2, 4).
See Also:
getCrystalSpeed()

getCPU

public static int getCPU()
Gets the CPU type, either DS80C390, DS80C400, DS80C410, or DS80C411.
Returns:
CPU type (DS80C390, DS80C400, DS80C410, DS80C411).
See Also:
DS80C390, DS80C400, DS80C410, DS80C411


Also see:
o TINI 1.16 API, Optional Modules
o TINI Home Page
o 1-Wire API

o JDK 1.1

Last update Wed Jun 8 17:19:36 CDT 2005