Index: pcmmio/.cvsignore
===================================================================
--- pcmmio/.cvsignore	(revision d810c068200691d298f97072c54953cf2acb6d3e)
+++ pcmmio/.cvsignore	(revision d810c068200691d298f97072c54953cf2acb6d3e)
@@ -0,0 +1,1 @@
+o-optimize
Index: pcmmio/ChangeLog
===================================================================
--- pcmmio/ChangeLog	(revision 1662ededd7be80e254430fa50182c535d1025e8f)
+++ pcmmio/ChangeLog	(revision d810c068200691d298f97072c54953cf2acb6d3e)
@@ -1,2 +1,8 @@
+2011-03-18	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* Makefile, mio_io.h, mio_io_rtems.c, pcmmio_shell.c, rtems_config.c:
+	Initial implementation.
+	* .cvsignore, multiio_pcmmio.c: New files.
+
 2009-12-14	Joel Sherrill <joel.sherrill@oarcorp.com>
 
Index: pcmmio/mio_io.h
===================================================================
--- pcmmio/mio_io.h	(revision 1662ededd7be80e254430fa50182c535d1025e8f)
+++ pcmmio/mio_io.h	(revision d810c068200691d298f97072c54953cf2acb6d3e)
@@ -142,4 +142,6 @@
 
 #endif
+
+#include <sys/types.h>
 
 /* part of the porting layer */
@@ -186,5 +188,5 @@
 int dio_get_int(void);
 int dio_get_int_with_timestamp(
-  unsigned long long *timestamp
+  struct timespec *timestamp
 );
 int wait_adc_int(int adc_num);
@@ -193,4 +195,5 @@
 
 #if defined(__rtems__)
+
   void pcmmio_initialize(
     unsigned short _base_port,
@@ -203,6 +206,6 @@
   int wait_dio_int_with_timeout(int milliseconds);
   int wait_dio_int_with_timestamp(
-    int                 milliseconds,
-    unsigned long long *timestamp
+    int              milliseconds,
+    struct timespec *timestamp
   );
   int dio_get_missed_interrupts(void);
Index: pcmmio/mio_io_rtems.c
===================================================================
--- pcmmio/mio_io_rtems.c	(revision 1662ededd7be80e254430fa50182c535d1025e8f)
+++ pcmmio/mio_io_rtems.c	(revision d810c068200691d298f97072c54953cf2acb6d3e)
@@ -32,5 +32,5 @@
 /* Function prototypes for local functions */
 static int get_buffered_int(
-  unsigned long long *timestamp
+  struct timespec *timestamp
 );
 static void init_io(unsigned short io_address);
@@ -53,6 +53,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 typedef struct {
-  unsigned long long timestamp;
-  int                pin;
+  struct timespec timestamp;
+  int             pin;
 } din_message_t;
 
@@ -340,5 +340,5 @@
 
 int dio_get_int_with_timestamp(
-  unsigned long long *timestamp
+  struct timespec *timestamp
 )
 {
@@ -405,6 +405,6 @@
 
 int wait_dio_int_with_timestamp(
-  int                 milliseconds,
-  unsigned long long *timestamp
+  int              milliseconds,
+  struct timespec *timestamp
 )
 {
@@ -651,6 +651,4 @@
 }
 
-#include <libcpu/cpuModel.h> /* for rdtsc */
-
 /*
  *  From this point down, we should be able to share easily with the Linux
@@ -709,6 +707,6 @@
       din_message_t      din;
 
-      din.timestamp = rdtsc(); 
-      din.pin       = int_num; 
+      rtems_clock_get_uptime( &din.timestamp );
+      din.pin = int_num; 
 
       rc = rtems_message_queue_send( wq_dio, &din, sizeof(din_message_t) );
@@ -861,5 +859,5 @@
 
 int get_buffered_int(
-  unsigned long long *timestamp
+  struct timespec *timestamp
 )
 {
Index: pcmmio/multiio_pcmmio.c
===================================================================
--- pcmmio/multiio_pcmmio.c	(revision d810c068200691d298f97072c54953cf2acb6d3e)
+++ pcmmio/multiio_pcmmio.c	(revision d810c068200691d298f97072c54953cf2acb6d3e)
@@ -0,0 +1,119 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include "multiio.h"
+#include "mio_io.h"
+#include <stdint.h>
+#include <rtems.h>
+
+int rtems_multiio_initialize(void)
+{
+  /*
+   *  Initialize the PCMMIO module to use IRQ6.  Ours is jumpered for 0x300
+   *  base address.  We use discrete input interrupts so enable all of the
+   *  as edge triggered on 1.
+   */
+  pcmmio_initialize(0x300, 6);
+  enable_dio_interrupt();
+  { int i;
+    for (i=1 ; i<=48 ; i++ )
+      dio_enab_bit_int(i, 1);
+  }
+
+  return 0;
+}
+
+const char *rtems_multiio_get_name(void)
+{
+  return "Winsystems";
+}
+
+/*
+ *  ADC
+ */
+int rtems_adc_get_maximum(void)
+{
+  return 16;
+}
+
+float rtems_adc_get_channel_voltage(int adc)
+{
+  return adc_get_channel_voltage(adc);
+}
+
+/*
+ *  DAC
+ */
+int rtems_dac_get_maximum(void)
+{
+  return 8;
+}
+
+float rtems_dac_get_minimum_voltage(void)
+{
+  return -10.0;
+}
+
+float rtems_dac_get_maximum_voltage(void)
+{
+  return 10.0;
+}
+
+int rtems_set_dac_voltage(int dac, float voltage)
+{
+  set_dac_voltage(dac, voltage);
+  return 0;
+}
+
+/*
+ *  Discrete Outputs
+ */
+int rtems_dout_get_maximum(void)
+{
+  return 48;
+}
+
+int rtems_set_dout(int dout, int value)
+{
+  dio_write_bit(dout+1, value);
+  return 0;
+}
+
+/*
+ *  Discrete Inputs
+ */
+int rtems_din_get_maximum(void)
+{
+  return 48;
+}
+
+int rtems_din_get(int din)
+{
+  return dio_read_bit(din+1);
+}
+
+int rtems_din_flush_buffered_interrupts(void)
+{
+  flush_buffered_ints();
+  return 0;
+}
+
+int rtems_din_wait_interrupt_with_timestamp(
+  int                milliseconds,
+  struct timespec   *timestamp
+)
+{
+  rtems_status_code sc;
+
+  sc = wait_dio_int_with_timestamp(milliseconds, timestamp);
+  return 0;
+}
+
Index: pcmmio/pcmmio_shell.c
===================================================================
--- pcmmio/pcmmio_shell.c	(revision 1662ededd7be80e254430fa50182c535d1025e8f)
+++ pcmmio/pcmmio_shell.c	(revision d810c068200691d298f97072c54953cf2acb6d3e)
@@ -1,4 +1,4 @@
 /*
- *  COPYRIGHT (c) 1989-2009.
+ *  COPYRIGHT (c) 1989-2011.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -10,5 +10,7 @@
  */
 
-#include "pcmmio_commands.h"
+#include <rtems.h>
+#include <multiio_commands.h>
+#include <multiio.h>
 
 rtems_task Init(
@@ -17,16 +19,4 @@
 {
   /*
-   *  Initialize the PCMMIO module to use IRQ6.  Ours is jumpered for 0x300
-   *  base address.  We use discrete input interrupts so enable all of the
-   *  as edge triggered on 1.
-   */
-  pcmmio_initialize(0x300, 6);
-  enable_dio_interrupt();
-  { int i;
-    for (i=1 ; i<=48 ; i++ )
-      dio_enab_bit_int(i, 1);
-  }
-
-  /*
    *  Display a herald with some hints on usage
    */
@@ -34,7 +24,9 @@
     "\n"
     "\n"
-    "*** Shell Configured with WinSystems PCMMIO Commands ***\n"
-    "Type \"help pcmmio\" for more information\n"
-    "\n"
+    "*** Shell Configured with Multi IO Commands ***\n"
+    "Multi IO Configuration: %s\n"
+    "Type \"help multiio\" for more information\n"
+    "\n",
+    rtems_multiio_get_name()
   );
   rtems_shell_init(
@@ -84,7 +76,7 @@
 
 #define CONFIGURE_SHELL_USER_COMMANDS \
-  CONFIGURE_PCMMIO_COMMANDS
+  CONFIGURE_MULTIIO_COMMANDS
 #define CONFIGURE_SHELL_USER_ALIASES \
-  CONFIGURE_PCMMIO_ALIASES
+  CONFIGURE_MULTIIO_ALIASES
 
 #define CONFIGURE_SHELL_COMMANDS_INIT
