aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-ocd.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-08-09 00:21:50 +0000
committerIan Lance Taylor <ian@airs.com>1997-08-09 00:21:50 +0000
commit5dcd8e70125ffa9dccd2c128f45659991b33233c (patch)
treeb71267167cc394434c0957d51fb71651442b1acd /gdb/ser-ocd.c
parent740895462f700e34f3a5959802f4631e11817c86 (diff)
downloadgdb-5dcd8e70125ffa9dccd2c128f45659991b33233c.zip
gdb-5dcd8e70125ffa9dccd2c128f45659991b33233c.tar.gz
gdb-5dcd8e70125ffa9dccd2c128f45659991b33233c.tar.bz2
* ser-ocd.c: If _WIN32, include <windows.h>.
(dll_do_command): New static variable if _WIN32. (ocd_open): Set dll_do_command if _WIN32. (ocd_write): Use dll_do_command rather than do_command. * config/i386/cygwin32.mh (XDEPFILES): Remove libwigglers.a. (BDM_DLLNAME, BDM_LIBNAME, BDM_DEFFILE): Don't define. ($(BDM_LIBNAME)): Remove target. * wigglers.def: Remove.
Diffstat (limited to 'gdb/ser-ocd.c')
-rw-r--r--gdb/ser-ocd.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/gdb/ser-ocd.c b/gdb/ser-ocd.c
index 1bded76..ad9ba0c 100644
--- a/gdb/ser-ocd.c
+++ b/gdb/ser-ocd.c
@@ -22,6 +22,10 @@
#include "defs.h"
#include "serial.h"
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
static int ser_ocd_open PARAMS ((serial_t scb, const char *name));
static void ser_ocd_raw PARAMS ((serial_t scb));
static int ser_ocd_readchar PARAMS ((serial_t scb, int timeout));
@@ -31,11 +35,35 @@ static void ser_ocd_close PARAMS ((serial_t scb));
static serial_ttystate ser_ocd_get_tty_state PARAMS ((serial_t scb));
static int ser_ocd_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
+#ifdef _WIN32
+/* On Windows, this function pointer is initialized to a function in
+ the wiggler DLL. */
+static int (*dll_do_command) PARAMS ((const char *, char *));
+#endif
+
static int
ocd_open (scb, name)
serial_t scb;
const char *name;
{
+#ifdef _WIN32
+ /* Find the wiggler DLL which talks to the board. */
+ if (dll_do_command == NULL)
+ {
+ HINSTANCE handle;
+
+ /* FIXME: Should the user be able to configure this? */
+ handle = LoadLibrary ("Wigglers.dll");
+ if (handle == NULL)
+ error ("Can't load Wigglers.dll");
+
+ dll_do_command = ((int (*) PARAMS ((const char *, char *)))
+ GetProcAddress (handle, "do_command"));
+ if (dll_do_command == NULL)
+ error ("Can't find do_command function in Wigglers.dll");
+ }
+#endif
+
return 0;
}
@@ -134,7 +162,7 @@ ocd_write (scb, str, len)
#ifdef __CYGWIN32__
/* send packet to Wigglers.dll and store response so we can give it to
remote-wiggler.c when get_packet is run */
- do_command (str, from_wiggler_buffer);
+ dll_do_command (str, from_wiggler_buffer);
wiggler_buffer_ptr = from_wiggler_buffer;
#endif
@@ -171,9 +199,3 @@ _initialize_ser_ocd_bdm ()
{
serial_add_interface (&ocd_ops);
}
-
-
-
-
-
-