Sun SPOT API
Green Release  


com.sun.squawk
Class JavaDriverManager

java.lang.Object
  extended by com.sun.squawk.JavaDriverManager

public class JavaDriverManager
extends Object

The Java driver manager. This manager supports dynamic loading of drivers.

Author:
Nik Shaylor and Alex Garthwaite

Field Summary
static int STATUS_CAUGHT
          Constant to be used with getInterruptStatus(int, int) to query the number of times a particular interrupt has been caught and handled.
static int STATUS_IGNORED
          Constant to be used with getInterruptStatus(int, int) to query the number of times a particular interrupt has been ignored.
static int STATUS_TIMESTAMP
          Constant to be used with getInterruptStatus(int, int) to query the last time at which a particular interrupt was caught.
 
Constructor Summary
JavaDriverManager()
           
 
Method Summary
static String deviceInterruptName(int interrupt)
          Returns a suitable key for an interrupt.
static long getInterruptStatus(int interrupt, int id)
          Retrieves the value of a low-level statistic for a given device interrupt.
static void initializeDrivers(String[] args)
          Initializes the driver used to dynamically load other drivers.
static boolean loadDriver(String className)
          Sends a request to the kernel to loads and initialize a driver.
static void main(String[] args)
          Main routine.
static void sendInterrupt(int signum)
          Emulates generation of a hardware interrupt.
static void setupAlarmInterval(int start, int period)
          Schedules the platform-specific alarm timer.
static void setupInterrupt(int interrupt, String handler)
          Configures the interrupt handler table by indicating that a given signal/interrupt will be handled by a Java device driver.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_CAUGHT

public static final int STATUS_CAUGHT
Constant to be used with getInterruptStatus(int, int) to query the number of times a particular interrupt has been caught and handled.

See Also:
Constant Field Values

STATUS_IGNORED

public static final int STATUS_IGNORED
Constant to be used with getInterruptStatus(int, int) to query the number of times a particular interrupt has been ignored.

See Also:
Constant Field Values

STATUS_TIMESTAMP

public static final int STATUS_TIMESTAMP
Constant to be used with getInterruptStatus(int, int) to query the last time at which a particular interrupt was caught.

See Also:
Constant Field Values
Constructor Detail

JavaDriverManager

public JavaDriverManager()
Method Detail

initializeDrivers

public static void initializeDrivers(String[] args)
Initializes the driver used to dynamically load other drivers. It will also initialize any other drivers that were specified at startup time.

Parameters:
args - the command line argument array

loadDriver

public static boolean loadDriver(String className)
Sends a request to the kernel to loads and initialize a driver. This request can only be made from user code, not kernel code.

Parameters:
className - fully qualified name of a class that implements Driver.
Returns:
true if the driver was successfully loaded, false otherwise

deviceInterruptName

public static String deviceInterruptName(int interrupt)
Returns a suitable key for an interrupt. Should be kept in sync with C-code definition of the device-name prefix.

Parameters:
interrupt - identfier of interrupt to handle
Returns:
the key

main

public static void main(String[] args)
                 throws Exception
Main routine.

Parameters:
args - the command line argument array
Throws:
Exception

setupInterrupt

public static void setupInterrupt(int interrupt,
                                  String handler)
Configures the interrupt handler table by indicating that a given signal/interrupt will be handled by a Java device driver. The Java device driver should already have registered its call back message system under the name returned by calling deviceInterruptName(int) with interrupt.

Parameters:
interrupt - the interrupt to be handled
handler - name of a C function that can be dynamically loaded/bound to

getInterruptStatus

public static long getInterruptStatus(int interrupt,
                                      int id)
Retrieves the value of a low-level statistic for a given device interrupt.

Parameters:
interrupt - identifier of interrupt to query
id - STATUS_CAUGHT, STATUS_IGNORED or STATUS_TIMESTAMP
Returns:
the value of the requested status field
Throws:
IllegalArgumentException - if id is not one of the accepted values

sendInterrupt

public static void sendInterrupt(int signum)
Emulates generation of a hardware interrupt.

Parameters:
signum - the signal to raise

setupAlarmInterval

public static void setupAlarmInterval(int start,
                                      int period)
Schedules the platform-specific alarm timer.

Parameters:
start - interval to wait (in microseconds) before delivering first signal
period - period to wait (in microseconds) before delivering subsequent signals

Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.