|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.system.TINIOS
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 reinitializes heap and stored system variables on next boot. |
static int |
BLAST_HEAP
Flag used with blastHeapOnReboot() to reinitializes heap on next boot. |
static int |
DS80C390
|
static int |
DS80C400
|
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 |
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 debug boot messages |
static int |
SERIAL_SET_DEBUG_MESSAGE_STATE
Enables or disables the 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. |
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 in a critical, atomic heap modification. |
static void |
enableSerialPort1(boolean enable)
Deprecated. Use setSerial(SERIAL_SET_ENABLE,port,myBooleanHere); |
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 or DS80C400. |
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_EX_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 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,port,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 bootup messages. |
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 the bootup messages. |
static void |
setDebugMessagesState(boolean on)
Deprecated. Use setSerial(SERIAL_SET_DEBUG_MESSAGE_STATE,port,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_EX_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 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,
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,port,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 |
public static final int NETWORK_CONFIGURATION_RESTORED
public static final int MASTER_ERASE_OCCURRED
public static final int HEAP_CLEAR_OCCURRED
public static final int FS_MODIFICATION_OCCURRED
public static final int BLAST_HEAP
public static final int BLAST_ALL
public static final int SERIAL_SET_ENABLE
public static final int SERIAL_GET_ENABLE
public static final int SERIAL_SET_RTSCTS_FLOW_CONTROL
public static final int SERIAL_GET_RTSCTS_FLOW_CONTROL
public static final int SERIAL_SET_BOOT_MESSAGE_STATE
public static final int SERIAL_SET_DEBUG_MESSAGE_STATE
public static final int SERIAL_GET_DEBUG_MESSAGE_STATE
public static final int SERIAL_GET_BOOT_MESSAGE_STATE
public static final int SERIAL_EX_SET_SEARCH_ENABLE
public static final int SERIAL_EX_GET_SEARCH_ENABLE
public static final int SERIAL_EX_SET_PORT_ADDRESS
public static final int SERIAL_EX_GET_PORT_ADDRESS
public static final int SERIAL_EX_GET_DIVISOR
public static final int SERIAL_EX_SET_DIVISOR
public static final int DS80C390
public static final int DS80C400
Method Detail |
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 |
Enable or disable a serial port. |
SERIAL_SET_RTSCTS_FLOW_CONTROL |
Enable or disable RTS/CTS flow control. |
SERIAL_SET_BOOT_MESSAGE_STATE |
Show or hide serial debug on startup |
SERIAL_SET_DEBUG_MESSAGE_STATE |
Query the state of the debug serial port |
SERIAL_EX_SET_SEARCH_ENABLE |
Enable or disable searching for external serial ports on startup |
SERIAL_EX_SET_PORT_ADDRESS |
Sets the address of the 16550 UART |
SERIAL_EX_SET_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.cmd
- The serial port command to be executedport
- The serial port to referencearr
- Byte array of parameterspublic static int setSerial(int cmd, int port, boolean arr) throws javax.comm.UnsupportedCommOperationException
cmd
- The serial port command to be executedport
- The serial port to referencearr
- For boolean operations, pass true or false.setSerial(int,int,byte[])
public static int setSerial(int cmd, int port, int arr) throws javax.comm.UnsupportedCommOperationException
cmd
- The serial port command to be executedport
- The serial port to referencearr
- Integer argument to the command.setSerial(int,int,byte[])
public static void setShell(TINIShell newShell) throws java.lang.SecurityException
newShell
- new shell for the system to usepublic static int login(java.lang.String userName, java.lang.String password)
userName
- user name of the user logging inpassword
- password for this userpublic static void logout(java.lang.Object info)
info
- any extra information needed in the logout processpublic static boolean isCurrentUserAdmin()
true
if the user has admin rights,
false
otherwisepublic static byte getCurrentUID()
public static boolean isAdmin(byte uid)
uid
- the user ID.true
if the user is an administrator,
false
otherwise.public static java.lang.String getUserNameByUID(byte uid)
uid
- user id to checkpublic static int getUIDByUserName(java.lang.String username)
username
- user username to check.public static java.lang.String getCurrentUserName()
public static java.util.Hashtable getSystemEnvironment()
public static java.util.Hashtable getCurrentEnvironment()
public static java.lang.String getFromCurrentEnvironment(java.lang.String key)
key
- The key to lookup in the current environment.null
if the key
is not set in the current environment.public static void execute(java.lang.Object[] commandLine, SystemInputStream in, SystemPrintStream out, SystemPrintStream err, java.util.Hashtable env) throws java.lang.Exception
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.public static java.lang.String getShellName()
public static java.lang.String getShellVersion()
public static TINIShell getShell()
public static boolean isConsoleOutputEnabled()
public static void setConsoleOutputEnabled(boolean set)
set
- true if output should be enabled, false if it should be
disabledpublic static boolean getExternalSerialPortEnable(int portNum)
setSerial(SERIAL_EX_GET_ENABLE,port,0);
IllegalArgumentException
for all other specified ports.portNum
- specifies number of external serial portsetSerial(int,int,int)
public static void setExternalSerialPortEnable(int portNum, boolean enable)
setSerial(SERIAL_EX_SET_ENABLE,port,yourBooleanHere);
IllegalArgumentException
for all
other specified ports.portNum
- specifies number of external serial portenable
- true to enable, false to disablesetSerial(int,int,boolean)
protected static boolean getExternalSerialPortSearchEnable()
setSerial(SERIAL_EX_GET_SEARCH_ENABLE,port,0);
setSerial(int,int,int)
public static void setExternalSerialPortSearchEnable(boolean enable)
setSerial(SERIAL_EX_SET_SEARCH_ENABLE,port,myBooleanHere);
enable
- true if enabled, false if disabledsetSerial(int,int,boolean)
public static int getExternalSerialPortAddress(int portNum)
setSerial(SERIAL_EX_GET_PORT_ADDRESS,port,0);
IllegalArgumentException
for all other specified ports.portNum
- specifies number of external serial portsetSerial(int,int,int)
public static void setExternalSerialPortAddress(int portNum, int address)
setSerial(SERIAL_EX_SET_PORT_ADDRESS,port,portAddressInt);
IllegalArgumentException
for all other specified ports.portNum
- specifies number of external serial portaddress
- specifies address of external serial portsetSerial(int,int,int)
public static void setIrDAClockPinState(boolean on)
on
- true to enable IrDA clock, false to disablepublic static void setWatchdogTimeout(int mstimeout)
mstimeout
- - timeout, in milliseconds. Don't set this too low,
because Java ain't that quick! Set to zero to turn off
the watchdog.public static void feedWatchdog()
public static java.lang.String getTINIOSFirmwareVersion()
public static java.lang.String getTINIHWVersion()
public static final java.lang.String getTINISerialNumber()
public static void setTimeZone(java.lang.String zone) throws java.lang.IllegalArgumentException
zone
- timezone stringpublic static java.lang.String getTimeZone()
public static boolean isCurrentTaskInit()
public static int getTaskID()
public static void lockInitProcesses()
public static int getOwnerIDByTaskID(int taskid)
taskid
- public static boolean isTaskRunning(int taskid)
taskid
- ID of taskpublic static java.lang.String[] getTaskTable()
public static int[] getTaskTableIDs()
public static void killTask(int taskID)
taskID
- Task ID of task to killpublic static void killTask(int taskID, boolean force)
taskID
- Task ID of task to killforce
- false to request, true to demand kill.public static void changeTaskPriority(int taskID, int priorityLevel)
0 - highest priority
1 - default priority
2 -
3 - lowest priority
taskID
- Task ID of task to changepriorityLevel
- new priority level of taskpublic static final int getFreeRAM()
public static final void reboot()
public static final boolean getSerialBootMessagesState()
setSerial(SERIAL_GET_BOOT_MESSAGE_STATE,port,0);
setSerial(int,int,int)
public static final void setSerialBootMessagesState(boolean on)
setSerial(SERIAL_SET_BOOT_MESSAGE_STATE,port,myBooleanHere);
on
- sets to true to turn on boot messages, false to turn offsetSerial(int,int,boolean)
public static final void setDebugMessagesState(boolean on)
setSerial(SERIAL_SET_DEBUG_MESSAGE_STATE,port,myBooleanHere);
on
- sets to true to turn on debug messages, false to turn offsetSerial(int,int,boolean)
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.
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.
blastType
- - BLAST_HEAP for heap reinit only
BLAST_ALL for heap reinit and stored system variable initpublic static final void disablePowerFailRecovery()
DANGER: Do not turn this off unless you know what you are doing. All heap data could become corrupted.
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.
public static final void enableSerialPort1(boolean enable)
setSerial(SERIAL_SET_ENABLE,port,myBooleanHere);
true
- to enabled serial port 1, false will disable serial port 1setSerial(int,int,boolean)
public static void addProcessDeathListener(ProcessDeathListener pdl)
pdl
- ProcessDeathListener to be added to the registered death listeners.public static void removeProcessDeathListener(ProcessDeathListener pdl)
pdl
- ProcessDeathListener to be removedpublic static final long uptimeMillis()
public static boolean getRecoveryHash(byte[] recoveryHash)
byte
- array to be filled in with the recovery hash.public static void setRecoveryHash(byte[] recoveryHash)
recovery
- hash to be storedpublic static int getBootState()
public static boolean setRTSCTSFlowControlEnable(int portNumber, boolean enable) throws javax.comm.UnsupportedCommOperationException
setSerial(SERIAL_SET_RTSCTS_FLOW_CONTROL,port,myBooleanHere);
portNumber
- - the number of the port number to enable RTS/CTS flow
controlenable
- - enables or disables the RTS/CTS hardware flow control
for the given portsetSerial(int,int,boolean)
public static boolean getRTSCTSFlowControlEnable(int portNumber)
setSerial(SERIAL_GET_RTSCTS_FLOW_CONTROL,port,0);
portNumber
- - the number of the port to get RTS/CTS flow control
information.setSerial(int,int,int)
public static final int getThreadLimit()
public static final int getProcessLimit()
public static void setStackSize(int size)
size
- of the new stackpublic static int getStackSize()
setStackSize(int)
because a
certain amount of memory is consumed for stack overhead, which is
not reported by this method.public static int getCurrentStackUsage()
public static int getCrystalSpeed()
getClockMultiplier()
public static int getClockMultiplier()
getCrystalSpeed()
public static int getCPU()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |