diff --git a/makefile b/makefile
index 5a3db1d..0713614 100755
--- a/makefile
+++ b/makefile
@@ -1,3 +1,9 @@
+# Config:
+CONFIG_PARPORT="n"
+CONFIG_BITBANG="y"
+
+########################################
+
 PROJ = cblsrv
 
 ########################################
@@ -34,18 +40,30 @@ SRCS = \
 	$(SRC_DIR)/$(PROJ).cpp \
 	$(SRC_DIR)/bits.cpp \
 	$(SRC_DIR)/cable.cpp \
-	$(SRC_DIR)/parport.cpp \
 	$(SRC_DIR)/utils.cpp
 
+DEFS =
+# Optional build items#
+ifeq ($(CONFIG_PARPORT),"y")
+SRCS +=	$(SRC_DIR)/parport.cpp
+DEFS += -DCONFIG_PARPORT=1
+endif
+
+ifeq ($(CONFIG_BITBANG),"y")
+SRCS += $(SRC_DIR)/bitbang.cpp \
+	$(SRC_DIR)/GpioCtrl_ar7.cpp
+DEFS += -DCONFIG_BITBANG=1
+endif
+
 OBJS = $(addsuffix .o, \
 	$(addprefix $(OBJ_DIR)/, \
 	$(basename $(notdir $(SRCS)))))
 TARG = $(OBJ_DIR)/$(PROJ)$(BIN_EXT)
 
-CC    = g++
-LD    = g++
+CC    = $(CROSS_COMPILE)g++
+LD    = $(CROSS_COMPILE)g++
 
-CPFLAGS = -O3 -Wall
+CPFLAGS = -O3 -Wall -fno-rtti $(DEFS)
 LDFLAGS =
 
 ifeq ($(IS_CYGWIN),yes)
diff --git a/src/GpioCtrl.h b/src/GpioCtrl.h
new file mode 100644
index 0000000..2abc43c
--- /dev/null
+++ b/src/GpioCtrl.h
@@ -0,0 +1,67 @@
+/*
+cblsrv is covered by the LGPL:
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+This file copyright (c) 2010 Matt Evans <matt@axio.ms>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  A general interface class to drive JTAG via a 'bitbang'-style interface.
+*/
+
+#ifndef GpioCtrl_H
+#define GpioCtrl_H
+
+/* An interface class */
+class GpioCtrl
+{
+ public:
+  GpioCtrl() {}
+  virtual ~GpioCtrl() {}
+
+  virtual int  init() = 0;
+  virtual int  shutdown() = 0;
+
+  virtual void setTMS(int state) = 0;
+  virtual void setTCK(int state) = 0;
+  virtual void setTDI(int state) = 0;
+  virtual int  getTDO() = 0;
+};
+
+
+#endif
diff --git a/src/GpioCtrl_ar7.cpp b/src/GpioCtrl_ar7.cpp
new file mode 100644
index 0000000..2a458a1
--- /dev/null
+++ b/src/GpioCtrl_ar7.cpp
@@ -0,0 +1,96 @@
+/*
+cblsrv is covered by the LGPL:
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+This file copyright (c) 2010 Matt Evans <matt@axio.ms>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  AR7-specific subclass of 'GpioCtrl' to drive JTAG via AR7 GPIO pins.
+*/
+
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+#include "GpioCtrl_ar7.h"
+
+int GpioCtrl_ar7::init()
+{
+  int fd;
+
+  DBG("GpioCtrl_ar7::init()\n");
+
+  if (regs == 0)
+  {
+    if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {
+      perror("Can't open /dev/mem!");
+      return -1;
+    }
+
+    regs = (volatile unsigned int *)mmap(0, getpagesize(),
+                                         PROT_READ | PROT_WRITE,
+                                         MAP_SHARED, fd, AR7_REGS_BASE);
+    close(fd);
+    if (regs == (void *)MAP_FAILED) {
+      perror("Can't mmap /dev/mem!");
+      return 1;
+    }
+
+    DBG("GpioCtrl_ar7: Mapped regs 0x%x at %p\n", AR7_REGS_BASE, regs);
+
+    gpio = regs + (AR7_REGS_GPIO_OFFSET / sizeof(unsigned int));
+    DBG("GpioCtrl_ar7: Gpio regs at %p\n", gpio);
+
+    /* Set pin directions! */
+    gpio[AR7_GPIO_DIR] &= ~JTAG_OUT;   // Outputs
+    gpio[AR7_GPIO_DIR] |=  JTAG_IN;    // Inputs
+    gpio[AR7_GPIO_ENABLE] |= JTAG_OUT | JTAG_IN;
+  }
+  return 0;
+}
+
+int GpioCtrl_ar7::shutdown()
+{
+  DBG("GpioCtrl_ar7::shutdown()\n");
+
+  /* We never unmap.  That's okay.   munmap((void *)regs, getpagesize()); */
+  return 0;
+}
diff --git a/src/GpioCtrl_ar7.h b/src/GpioCtrl_ar7.h
new file mode 100644
index 0000000..01794fb
--- /dev/null
+++ b/src/GpioCtrl_ar7.h
@@ -0,0 +1,164 @@
+/*
+cblsrv is covered by the LGPL:
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+This file copyright (c) 2010 Matt Evans <matt@axio.ms>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  AR7-specific subclass of 'GpioCtrl' to drive JTAG via AR7 GPIO pins.
+*/
+
+#ifndef GpioCtrl_ar7_H
+#define GpioCtrl_ar7_H
+
+#include "GpioCtrl.h"
+
+//#define GPIO_DEBUG yes
+
+#ifdef GPIO_DEBUG
+#define DBG(x...) fprintf(stderr, x)
+#else
+#define DBG(x...) do { } while(0)
+#endif
+
+// JTAG pins
+#define JTAG_TMS  10
+#define JTAG_TCK  6
+#define JTAG_TDI  19
+#define JTAG_TDO  16
+#define JTAG_RST  8
+#define JTAG_MISC 14
+// LEDs
+#define LED_A     9
+#define LED_B     7
+#define LED_C     12
+
+#define B_LED_A   BIT(LED_A)
+#define B_LED_B   BIT(LED_B)
+#define B_LED_C   BIT(LED_C)
+
+#define B_JTAG_TMS  BIT(JTAG_TMS)
+#define B_JTAG_TCK  BIT(JTAG_TCK)
+#define B_JTAG_TDI  BIT(JTAG_TDI)
+#define B_JTAG_TDO  BIT(JTAG_TDO)
+#define B_JTAG_RST  BIT(JTAG_RST)
+#define B_JTAG_MISC BIT(JTAG_MISC)
+
+#define B_LEDS   (B_LED_A | B_LED_B | B_LED_C)
+
+#define JTAG_IN  (B_JTAG_TDO | B_JTAG_MISC)
+#define JTAG_OUT (B_JTAG_TMS | B_JTAG_TCK | B_JTAG_TDI \
+		  | B_JTAG_RST | B_LEDS)
+
+#define AR7_REGS_BASE        0x08610000
+#define AR7_REGS_GPIO_OFFSET 0x0900
+#define AR7_GPIO_INPUT       0x0
+#define AR7_GPIO_OUTPUT      (0x4/4)
+#define AR7_GPIO_DIR         (0x8/4)  /* 0 output, 1 input */
+#define AR7_GPIO_ENABLE      (0xc/4)
+
+#define BIT(X) (1<<(X))
+
+/* Reset is unused for this type of 'cable' */
+
+class GpioCtrl_ar7 : public GpioCtrl
+{
+ public:
+ GpioCtrl_ar7()
+ {
+   regs = 0;
+   gpio = 0;
+ }
+
+  virtual int init();
+  virtual int shutdown();
+
+  /* Remember, pins are inverted! */
+  virtual void setTMS(int state)
+  {
+    unsigned int outs = gpio[AR7_GPIO_OUTPUT];
+    if (!state) {
+      DBG("[TMS 0]\n");
+      gpio[AR7_GPIO_OUTPUT] = outs | B_JTAG_TMS;
+    }
+    else {
+      DBG("[TMS 1]\n");
+      gpio[AR7_GPIO_OUTPUT] = outs & ~B_JTAG_TMS;
+    }
+  }
+
+  virtual void setTCK(int state)
+  {
+    unsigned int outs = gpio[AR7_GPIO_OUTPUT];
+    if (!state) {
+      DBG("[TCK 0]\n");
+      gpio[AR7_GPIO_OUTPUT] = outs | B_JTAG_TCK;
+    }
+    else {
+      DBG("[TCK 1]\n");
+      gpio[AR7_GPIO_OUTPUT] = outs & ~B_JTAG_TCK;
+    }
+  }
+
+  virtual void setTDI(int state)
+  {
+    unsigned int outs = gpio[AR7_GPIO_OUTPUT];
+    if (!state) {
+      DBG("[TDI 0]\n");
+      gpio[AR7_GPIO_OUTPUT] = outs | B_JTAG_TDI;
+    }
+    else {
+      DBG("[TDI 1]\n");
+      gpio[AR7_GPIO_OUTPUT] = outs & ~B_JTAG_TDI;
+    }
+  }
+
+  virtual int  getTDO()
+  {
+    int ret = (gpio[AR7_GPIO_INPUT] & B_JTAG_TDO) ? 0 : 1;
+    DBG("[TDO = %d]\n", ret);
+    return ret;
+  }
+
+ private:
+  volatile unsigned int *regs;
+  volatile unsigned int *gpio;
+};
+
+#endif
diff --git a/src/bitbang.cpp b/src/bitbang.cpp
new file mode 100755
index 0000000..d7469ff
--- /dev/null
+++ b/src/bitbang.cpp
@@ -0,0 +1,160 @@
+/*
+cblsrv is covered by the LGPL:
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+Copyright (c) 2006 Zoltan Csizmadia <zoltan_csizmadia@yahoo.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Based on parport.cpp.  Split out by Matt Evans, 19 Apr 2010 */
+
+#include "cblsrv.h"
+#include "bitbang.h"
+#include "GpioCtrl_ar7.h"
+#include "utils.h"
+
+bitbang::bitbang(const char* addr)
+{
+}
+
+int bitbang::open()
+{
+  tracef(3, "Opening cable ...\n");
+
+  return gpio.init();
+}
+
+int bitbang::close()
+{
+  gpio.shutdown();
+
+  tracef(3, "Cable closed.\n");
+
+  return 0;
+}
+
+int bitbang::get_desc(char* desc, int len)
+{
+  return snprintf(desc, len, "Bitbang port");
+}
+
+int bitbang::set_tdi(int b)
+{
+  gpio.setTDI(b);
+  return 0;
+}
+
+int bitbang::set_tms(int b)
+{
+  gpio.setTMS(b);
+  return 0;
+}
+
+int bitbang::set_tck(int b)
+{
+  gpio.setTCK(b);
+  return 0;
+}
+
+int bitbang::get_tdo()
+{
+  return gpio.getTDO();
+}
+
+int bitbang::pulse_tck(int count)
+{
+    while (count--)
+    {
+        set_tck(1);
+        set_tck(0);
+    }
+    return 0;
+}
+
+int bitbang::shift(int num_bits, void* wbuff, void* rbuff, int last)
+{
+    u8 tdi_byte, tdo_byte;
+    int i;
+    u8* pw = (u8*)wbuff;
+    u8* pr = (u8*)rbuff;
+
+    while (num_bits)
+    {
+        tdi_byte = *pw++;
+        tdo_byte = 0;
+
+        for (i = 0; (num_bits && (i < 8)); i++)
+        {
+            num_bits--;
+            if (last && !num_bits)
+                // Exit Shift-DR state
+                set_tms(1);
+
+            // Set the new TDI value
+            set_tdi(tdi_byte & 1);
+            tdi_byte >>= 1;
+
+            if (pr)
+                // Save TDO bit
+                tdo_byte |= get_tdo() << i;
+
+            // Clock cycle
+            set_tck(1);
+            set_tck(0);
+        }
+
+        // Save TDO byte
+        if (pr)
+            *pr++ = tdo_byte;
+    }
+
+    return 0;
+}
+
+int bitbang::shift_tms(u32 tms_seq, int count)
+{
+    while (count--)
+    {
+        set_tms(tms_seq & 1);
+        set_tck(1);
+        set_tck(0);
+        tms_seq >>= 1;
+    }
+    return 0;
+}
diff --git a/src/bitbang.h b/src/bitbang.h
new file mode 100755
index 0000000..8ba3ef7
--- /dev/null
+++ b/src/bitbang.h
@@ -0,0 +1,79 @@
+/*
+cblsrv is covered by the LGPL:
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+Copyright (c) 2006 Zoltan Csizmadia <zoltan_csizmadia@yahoo.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef BITBANG_H
+#define BITBANG_H
+
+#include "cable.h"
+#include "GpioCtrl.h"
+#include "GpioCtrl_ar7.h"
+
+#define GPIO_AR7
+
+class bitbang : public cable
+{
+ public:
+    bitbang(const char* addr);
+
+ public:
+    int open();
+    int close();
+
+    int get_desc(char* desc, int len);
+
+    int get_tdo();
+    int set_tdi(int b);
+    int set_tms(int);
+    int set_tck(int);
+    int pulse_tck(int);
+
+    int shift_tms(u32 tms_seq, int count);
+    int shift(int num_bits, void* wbuff, void* rbuff, int last);
+
+ protected:
+    /* Todo: Multiplex/build with different GPIO abstractions... */
+    GpioCtrl_ar7 gpio;
+};
+
+#endif
diff --git a/src/cblsrv.cpp b/src/cblsrv.cpp
index 6944251..6593da4 100755
--- a/src/cblsrv.cpp
+++ b/src/cblsrv.cpp
@@ -44,9 +44,16 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "cblsrv.h"
 #include "utils.h"
+#ifdef CONFIG_PARPORT
 #include "parport.h"
+#endif
+#ifdef CONFIG_BITBANG
+#include "bitbang.h"
+#endif
+#include "cable.h"
 #include "bits.h"
 
+
 #define SOCK_RECV_RET(s, p, l) \
     if (sock_recv((s), (p), (l)) != (int)(l)) \
         return -1;
@@ -629,7 +636,8 @@ cable* create_cable(const char* addr)
 
     // Param
     param = *addr == ':' ? addr + 1 : NULL;
-    
+
+#ifdef CONFIG_PARPORT    
     // Xilinx Parallel III
     if (strcmp(name, "dlc5") == 0)
         cbl = new dlc5(param);
@@ -637,7 +645,11 @@ cable* create_cable(const char* addr)
     // Altera Byte Blaster
     if (strcmp(name, "bb") == 0)
         cbl = new byte_blaster(param);
-
+#endif
+#ifdef CONFIG_BITBANG
+    if (strcmp(name, "bitbang") == 0)
+        cbl = new bitbang(param);
+#endif
     return cbl;
 }
 
@@ -647,8 +659,13 @@ void usage()
     printf("    level     Debug level (0-3). (Default=1)\n");
     printf("    port      Server port (default=2000)\n");
     printf("    type      Cable type:\n");
+#ifdef CONFIG_PARPORT
     printf("                  dlc5     Xilinx Parallel III\n");
     printf("                  bb       Altera ByteBlaster\n");
+#endif
+#ifdef CONFIG_BITBANG
+    printf("                  bitbang  GPIO bitbang\n");
+#endif
     printf("\n");
     printf("E.g: cblsrv -d 3 -c dlc5:0x378\n");
 #if !defined(WIN32) && !defined(__CYGWIN__)
@@ -659,7 +676,11 @@ void usage()
 int init(int argc, char** argv)
 {
     int i;
+#ifdef CONFIG_BITBANG
+    char* cable_addr = "bitbang";
+#else
     char* cable_addr = "dlc5";
+#endif
     char cable_desc[256];
     char* tmp;
     
diff --git a/src/parport.cpp b/src/parport.cpp
index ff04e8f..7d5c8a3 100755
--- a/src/parport.cpp
+++ b/src/parport.cpp
@@ -110,6 +110,36 @@ parport::~parport()
 {
 }
 
+static int enable_user_mode_io()
+{
+#ifdef WIN32
+    HANDLE h;
+    
+    h = CreateFile(
+            "\\\\.\\giveio",
+            GENERIC_READ,
+            0,
+            NULL,
+            OPEN_EXISTING,
+            FILE_ATTRIBUTE_NORMAL,
+            NULL);
+    if (h != INVALID_HANDLE_VALUE)
+    {
+        // Giveio activated successfully
+        CloseHandle(h);
+        return 0;
+    }
+#else
+    if (iopl(3) == 0)
+        // Success
+        return 0;
+#endif
+
+    tracef(1, "Failed to enable user mode I/O access!\n");
+
+    return -1;
+}
+
 int parport::open()
 {
     int rc = -1;
diff --git a/src/platform.h b/src/platform.h
index 8d5c972..f012d60 100755
--- a/src/platform.h
+++ b/src/platform.h
@@ -56,7 +56,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #ifndef WIN32
 #include <unistd.h>
+#ifdef LINUX
 #include <sys/io.h>
+#endif
 #include <sys/fcntl.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
diff --git a/src/utils.cpp b/src/utils.cpp
index 919867c..9f3f655 100755
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -86,36 +86,6 @@ void outb(u8 data, u16 port)
 }
 #endif
 
-int enable_user_mode_io()
-{
-#ifdef WIN32
-    HANDLE h;
-    
-    h = CreateFile(
-            "\\\\.\\giveio",
-            GENERIC_READ,
-            0,
-            NULL,
-            OPEN_EXISTING,
-            FILE_ATTRIBUTE_NORMAL,
-            NULL);
-    if (h != INVALID_HANDLE_VALUE)
-    {
-        // Giveio activated successfully
-        CloseHandle(h);
-        return 0;
-    }
-#else
-    if (iopl(3) == 0)
-        // Success
-        return 0;
-#endif
-
-    tracef(1, "Failed to enable user mode I/O access!\n");
-
-    return -1;
-}
-
 //
 // Sockets
 //
diff --git a/src/utils.h b/src/utils.h
index 04d076d..30d7ce3 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -52,8 +52,6 @@ u8 inb(u16 port);
 void outb(u8 data, u16 port);
 #endif
 
-int enable_user_mode_io();
-
 int sock_init();
 int sock_deinit();
 int sock_send(int sock, void* buff, int len);
