Index: pcmmio/ChangeLog
===================================================================
--- pcmmio/ChangeLog	(revision 68a1abb2a5929f34f1dcfd3d8fd43f741f9d3f1a)
+++ pcmmio/ChangeLog	(revision 396c14396bb6880de57e3c2f5d6be3122c83490a)
@@ -1,2 +1,6 @@
+2011-10-05	Cindy Cicalese <cicalese@mitre.org>
+
+	* mio_io.c, mio_io.h, mio_io_rtems.c: Updates after testing in lab.
+
 2011-03-18	Joel Sherrill <joel.sherrill@oarcorp.com>
 
Index: pcmmio/mio_io.c
===================================================================
--- pcmmio/mio_io.c	(revision 68a1abb2a5929f34f1dcfd3d8fd43f741f9d3f1a)
+++ pcmmio/mio_io.c	(revision 396c14396bb6880de57e3c2f5d6be3122c83490a)
@@ -1353,4 +1353,12 @@
 	temp = read_dio_byte(port);
 
+        // Temporarily clear only our enable. This clears the interrupt
+
+        temp = temp & ~mask;
+
+        // Write out the temporary value
+
+        write_dio_byte(port, temp);
+
 	// Set the enable bit for our bit number
 
Index: pcmmio/mio_io.h
===================================================================
--- pcmmio/mio_io.h	(revision 68a1abb2a5929f34f1dcfd3d8fd43f741f9d3f1a)
+++ pcmmio/mio_io.h	(revision 396c14396bb6880de57e3c2f5d6be3122c83490a)
@@ -142,6 +142,4 @@
 
 #endif
-
-#include <sys/types.h>
 
 /* part of the porting layer */
@@ -188,5 +186,5 @@
 int dio_get_int(void);
 int dio_get_int_with_timestamp(
-  struct timespec *timestamp
+  unsigned long long *timestamp
 );
 int wait_adc_int(int adc_num);
@@ -195,5 +193,4 @@
 
 #if defined(__rtems__)
-
   void pcmmio_initialize(
     unsigned short _base_port,
@@ -206,6 +203,6 @@
   int wait_dio_int_with_timeout(int milliseconds);
   int wait_dio_int_with_timestamp(
-    int              milliseconds,
-    struct timespec *timestamp
+    int                 milliseconds,
+    unsigned long long *timestamp
   );
   int dio_get_missed_interrupts(void);
Index: pcmmio/mio_io_rtems.c
===================================================================
--- pcmmio/mio_io_rtems.c	(revision 68a1abb2a5929f34f1dcfd3d8fd43f741f9d3f1a)
+++ pcmmio/mio_io_rtems.c	(revision 396c14396bb6880de57e3c2f5d6be3122c83490a)
@@ -32,5 +32,5 @@
 /* Function prototypes for local functions */
 static int get_buffered_int(
-  struct timespec *timestamp
+  unsigned long long *timestamp
 );
 static void init_io(unsigned short io_address);
@@ -53,6 +53,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 typedef struct {
-  struct timespec timestamp;
-  int             pin;
+  unsigned long long timestamp;
+  int                pin;
 } din_message_t;
 
@@ -340,5 +340,5 @@
 
 int dio_get_int_with_timestamp(
-  struct timespec *timestamp
+  unsigned long long *timestamp
 )
 {
@@ -405,6 +405,6 @@
 
 int wait_dio_int_with_timestamp(
-  int              milliseconds,
-  struct timespec *timestamp
+  int                 milliseconds,
+  unsigned long long *timestamp
 )
 {
@@ -426,10 +426,10 @@
   );
   if ( rc == RTEMS_UNSATISFIED ) {
+    mio_error_code = MIO_TIMEOUT_ERROR;
+    return -1;
+  }
+
+  if ( rc == RTEMS_TIMEOUT ) {
     mio_error_code = MIO_READ_DATA_FAILURE;
-    return -1;
-  }
-
-  if ( rc == RTEMS_TIMEOUT ) {
-    mio_error_code = MIO_TIMEOUT_ERROR;
     return -1;
   }
@@ -536,6 +536,4 @@
   if ( rc == RTEMS_SUCCESSFUL )
     return 0;
-
-  mio_error_code = MIO_TIMEOUT_ERROR;
   return -1;
 }
@@ -545,7 +543,8 @@
 )
 {
-  uint32_t  unblocked;
-
-  (void) rtems_barrier_release(*id, &unblocked);
+  rtems_status_code rc;
+  uint32_t          unblocked;
+
+  rc = rtems_barrier_release(*id, &unblocked);
 }
 
@@ -651,4 +650,6 @@
 }
 
+#include <libcpu/cpuModel.h> /* for rdtsc */
+
 /*
  *  From this point down, we should be able to share easily with the Linux
@@ -702,11 +703,10 @@
 
     /* DIO interrupt. Find out which bit */
-    int_num = get_int();
-    if (int_num) {
+    while ((int_num = get_int()) != 0) {
       rtems_status_code  rc;
       din_message_t      din;
 
-      rtems_clock_get_uptime( &din.timestamp );
-      din.pin = int_num; 
+      din.timestamp = rdtsc(); 
+      din.pin       = int_num; 
 
       rc = rtems_message_queue_send( wq_dio, &din, sizeof(din_message_t) );
@@ -859,5 +859,5 @@
 
 int get_buffered_int(
-  struct timespec *timestamp
+  unsigned long long *timestamp
 )
 {
@@ -881,8 +881,6 @@
     0
   );
-  if ( rc == RTEMS_UNSATISFIED ) {
-    mio_error_code = MIO_READ_DATA_FAILURE;
+  if ( rc == RTEMS_UNSATISFIED )
     return 0;
-  }
 
   if ( rc != RTEMS_SUCCESSFUL ) {
