changeset 211:f9e44621e638

8130906: Various changes from ME side projects Summary: fixes from ME branches Reviewed-by: snazarki Contributed-by: alexey.savin@oracle.com
author snazarki
date Fri, 10 Jul 2015 13:55:35 +0300
parents e594b663ed53
children 2c0af8cb3202
files src/se/classes/com/oracle/dio/utils/ExceptionMessage.java src/share/classes/com/oracle/dio/utils/Constants.java src/share/classes/com/oracle/dio/utils/Utils.java src/share/native/com/oracle/dio/javacall_uart.h
diffstat 4 files changed, 31 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/se/classes/com/oracle/dio/utils/ExceptionMessage.java	Tue Jul 07 17:58:01 2015 +0300
+++ b/src/se/classes/com/oracle/dio/utils/ExceptionMessage.java	Fri Jul 10 13:55:35 2015 +0300
@@ -65,7 +65,7 @@
     public static final int ADC_FIRST = DEVICE_LAST + 1;
     public static final int ADC_ANOTHER_OPERATION_PROGRESS           = ADC_FIRST + 0;
     public static final int ADC_NONPOSITIVE_INTERVAL                 = ADC_FIRST + 1;
-    public static final int ADC_LESS_MINIMAL_INTERVAL                = ADC_FIRST + 2;
+    public static final int ADC_OUT_OF_RANGE_INTERVAL                = ADC_FIRST + 2;
     public static final int ADC_CANNOT_START_ACQUISITION             = ADC_FIRST + 3;
     public static final int ADC_ARGUMENT_LOW_GREATER_THAN_HIGH       = ADC_FIRST + 4;
     public static final int ADC_LAST = ADC_ARGUMENT_LOW_GREATER_THAN_HIGH;
@@ -89,7 +89,7 @@
     public static final int DAC_FIRST = COUNTER_LAST + 1;
     public static final int DAC_GENERATION_IS_ACTIVE                 = DAC_FIRST + 0;
     public static final int DAC_NONPOSITIVE_INTERVAL                 = DAC_FIRST + 1;
-    public static final int DAC_LESS_MINIMAL_INTERVAL                = DAC_FIRST + 2;
+    public static final int DAC_OUT_OF_RANGE_INTERVAL                = DAC_FIRST + 2;
     public static final int DAC_UNACCEPTABLE_VALUE                   = DAC_FIRST + 3;
     public static final int DAC_CANNOT_START_CONVERSION              = DAC_FIRST + 4;
     public static final int DAC_LAST = DAC_CANNOT_START_CONVERSION;
@@ -98,16 +98,17 @@
     public static final int GPIO_INVALID_TRIGGER                     = GPIO_FIRST + 0;
     public static final int GPIO_INVALID_DIRECTION                   = GPIO_FIRST + 1;
     public static final int GPIO_INVALID_MODE                        = GPIO_FIRST + 2;
-    public static final int GPIO_DIR_UNSUPPORTED_BY_PIN_CONFIG       = GPIO_FIRST + 3;
-    public static final int GPIO_SET_TO_INPUT_PIN                    = GPIO_FIRST + 4;
-    public static final int GPIO_REGISTER_LISTENER_TO_OUTPUT_PIN     = GPIO_FIRST + 5;
-    public static final int GPIO_CANNOT_START_NOTIFICATION           = GPIO_FIRST + 6;
-    public static final int GPIO_LISTENER_ALREADY_ASSIGNED           = GPIO_FIRST + 7;
-    public static final int GPIO_DIR_SHOULD_BE_INPUT_OR_OUTPUT       = GPIO_FIRST + 8;
-    public static final int GPIO_INCOMPATIBLE_DIR                    = GPIO_FIRST + 9;
-    public static final int GPIO_WRITE_TO_INPUT_PORT                 = GPIO_FIRST + 10;
-    public static final int GPIO_REGISTER_LISTENER_TO_OUTPUT_PORT    = GPIO_FIRST + 11;
-    public static final int GPIO_INCOMPATIBLE_MODE                   = GPIO_FIRST + 12;
+    public static final int GPIO_ILLEGAL_DIR                         = GPIO_FIRST + 3;
+    public static final int GPIO_DIR_UNSUPPORTED_BY_PIN_CONFIG       = GPIO_FIRST + 4;
+    public static final int GPIO_SET_TO_INPUT_PIN                    = GPIO_FIRST + 5;
+    public static final int GPIO_REGISTER_LISTENER_TO_OUTPUT_PIN     = GPIO_FIRST + 6;
+    public static final int GPIO_CANNOT_START_NOTIFICATION           = GPIO_FIRST + 7;
+    public static final int GPIO_LISTENER_ALREADY_ASSIGNED           = GPIO_FIRST + 8;
+    public static final int GPIO_DIR_SHOULD_BE_INPUT_OR_OUTPUT       = GPIO_FIRST + 9;
+    public static final int GPIO_INCOMPATIBLE_DIR                    = GPIO_FIRST + 10;
+    public static final int GPIO_WRITE_TO_INPUT_PORT                 = GPIO_FIRST + 11;
+    public static final int GPIO_REGISTER_LISTENER_TO_OUTPUT_PORT    = GPIO_FIRST + 12;
+    public static final int GPIO_INCOMPATIBLE_MODE                   = GPIO_FIRST + 13;
     public static final int GPIO_LAST = GPIO_INCOMPATIBLE_MODE;
 
     public static final int I2CBUS_FIRST = GPIO_LAST + 1;
@@ -188,7 +189,7 @@
         "actions are empty",
         "Invalid permission class: %s",
         "Cannot add a Permission to a readonly PermissionCollection",
-        "Opening with deviceName is unsupported",
+        "Opening with controllerName is unsupported",
         "Buffer was modified by application",
         "The object can't be cloned",
         "The buffer has a zero-capacity",
@@ -197,7 +198,7 @@
         // adc messages
         "Another operation on ADC channel is in progress",
         "'interval' is negative or 0",
-        "'interval' is less than minimal sampling interval",
+        "'interval' is out of the supported range",
         "Cannot start acquisition",
         "Argument 'low' is greater than 'high'",
 
@@ -218,7 +219,7 @@
         // dac messages
         "Generation is already active",
         "'interval' is negative or 0",
-        "'interval' is less than minimal sampling interval",
+        "'interval' is out of the supported range",
         "'value' is out of an allowed range",
         "Cannot start conversion",
 
--- a/src/share/classes/com/oracle/dio/utils/Constants.java	Tue Jul 07 17:58:01 2015 +0300
+++ b/src/share/classes/com/oracle/dio/utils/Constants.java	Fri Jul 10 13:55:35 2015 +0300
@@ -46,4 +46,5 @@
     public static final String SAMPLING_INTERVAL = "samplingInterval";
     public static final String ADDRESS = "address";
     public static final String CLOCK_FREQUENCY = "clockFrequency";
+    public static final String SCALE_FACTOR = "scaleFactor";
 }
--- a/src/share/classes/com/oracle/dio/utils/Utils.java	Tue Jul 07 17:58:01 2015 +0300
+++ b/src/share/classes/com/oracle/dio/utils/Utils.java	Fri Jul 10 13:55:35 2015 +0300
@@ -259,6 +259,19 @@
 
     }
 
+    /** Checks new requested scaled value range e.g. sampling interval range, pulse period range */
+    public static void checkNewScaledRange(final double min_er,
+                                        final double max_er,
+                                        final double new_factor
+                                        ) {
+        // new scaled ones
+        final double min_sr = min_er * new_factor;
+        final double max_sr = max_er * new_factor;
+
+        if (min_sr < 1.0d || max_sr > new Integer(Integer.MAX_VALUE).doubleValue())
+            throw new IllegalArgumentException();
+    }
+
     // Check all characters in the string are decimal digits
     private static boolean isNonNegativeNumber(String str, int radix) {
         try {
--- a/src/share/native/com/oracle/dio/javacall_uart.h	Tue Jul 07 17:58:01 2015 +0300
+++ b/src/share/native/com/oracle/dio/javacall_uart.h	Fri Jul 10 13:55:35 2015 +0300
@@ -378,8 +378,7 @@
  * @param hPort the port to configure
  * @param mode pointer to where to return the flowcontrol mode (bitwise)
  * @retval JAVACALL_DIO_OK on success,
- * @retval JAVACALL_DIO_UNSUPPORTED_OPERATION  if the flowcontrol is not supported
- *         JAVACALL_DIO_FAIL on error
+ * @retval JAVACALL_DIO_FAIL on error
  */
 javacall_dio_result /*OPTIONAL*/
 javacall_uart_get_flowcontrol(javacall_handle handle, /*OUT*/ javacall_serial_flowcontrol *mode);