initial push
This commit is contained in:
5
m68k/lib/.cvsignore
Normal file
5
m68k/lib/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
libBDM.a
|
||||
|
||||
153
m68k/lib/BDMlib.h
Normal file
153
m68k/lib/BDMlib.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Motorola Background Debug Mode Remote Library
|
||||
* Copyright (C) 1998 Chris Johns
|
||||
*
|
||||
* Chris Johns
|
||||
* Cybertec Pty Ltd
|
||||
*
|
||||
* cjohns@users.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
/*
|
||||
* Routines to control a CPU32(+) or Coldfire target
|
||||
*/
|
||||
|
||||
#ifndef _BDM_LIB_H_
|
||||
#define _BDM_LIB_H_
|
||||
|
||||
#if __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <bdm.h>
|
||||
|
||||
/*
|
||||
* Configuration file name.
|
||||
*/
|
||||
#define M68K_BDM_INIT_FILE ".m68kbdminit"
|
||||
|
||||
/*
|
||||
* All (int) routines return -1 on error, >=0 otherwise.
|
||||
*/
|
||||
void bdmReadConfiguration();
|
||||
int bdmCheck (void);
|
||||
int bdmOpen (const char *name);
|
||||
int bdmClose (void);
|
||||
int bdmIsOpen (void);
|
||||
int bdmSetDelay (int delay);
|
||||
int bdmSetDriverDebugFlag (int flag);
|
||||
void bdmSetDebugFlag (int flag);
|
||||
void bdmLogSyslog (void);
|
||||
|
||||
int bdmStatus (void);
|
||||
const char *bdmErrorString (void);
|
||||
|
||||
/*
|
||||
* Return a value in the host byte order. Useful for printing on
|
||||
* the host.
|
||||
*/
|
||||
unsigned long bdmHostByteOrder (unsigned long value);
|
||||
|
||||
/*
|
||||
* The following routines return, or are passed, data with byte
|
||||
* order (big-endian or little-endian) of the machine on which
|
||||
* the routines are running.
|
||||
*
|
||||
* Note, the control registers are the values documented in the
|
||||
* devices data sheet.
|
||||
*/
|
||||
int bdmReadControlRegister (int code, unsigned long *lp);
|
||||
int bdmReadDebugRegister (int code, unsigned long *lp);
|
||||
int bdmReadSystemRegister (int code, unsigned long *lp);
|
||||
int bdmReadRegister (int code, unsigned long *lp);
|
||||
int bdmReadMBAR (unsigned long *lp);
|
||||
|
||||
int bdmWriteControlRegister (int code, unsigned long l);
|
||||
int bdmWriteDebugRegister (int code, unsigned long l);
|
||||
int bdmWriteSystemRegister (int code, unsigned long l);
|
||||
int bdmWriteRegister (int code, unsigned long l);
|
||||
int bdmWriteMBAR (unsigned long l);
|
||||
|
||||
int bdmReadLongWord (unsigned long address, unsigned long *lp);
|
||||
int bdmReadWord (unsigned long address, unsigned short *sp);
|
||||
int bdmReadByte (unsigned long address, unsigned char *cp);
|
||||
|
||||
int bdmWriteLongWord (unsigned long address, unsigned long l);
|
||||
int bdmWriteWord (unsigned long address, unsigned short s);
|
||||
int bdmWriteByte (unsigned long address, unsigned char c);
|
||||
|
||||
/*
|
||||
* The following routines report the driver version, processor and
|
||||
* interface type
|
||||
*/
|
||||
int bdmGetDrvVersion (unsigned int *ver);
|
||||
int bdmGetProcessor (int *processor);
|
||||
int bdmGetInterface (int *iface);
|
||||
|
||||
/*
|
||||
* Get and set the PST signal state. 1 = enabled, 0 = disabled.
|
||||
*/
|
||||
|
||||
int bdmColdfireGetPST (int *pst);
|
||||
int bdmColdfireSetPST (int pst);
|
||||
|
||||
/*
|
||||
* The following routines control execution of the target machine
|
||||
*/
|
||||
int bdmReset (void);
|
||||
int bdmRestart (void);
|
||||
int bdmRelease (void);
|
||||
int bdmGo (void);
|
||||
int bdmStop (void);
|
||||
int bdmStep (void);
|
||||
|
||||
/*
|
||||
* In the bdmReadMemory and bdmWriteMemory routines, cbuf is the address
|
||||
* of a buffer whose contents are in M68k (i.e. big-endian) byte order.
|
||||
*/
|
||||
int bdmReadMemory (unsigned long address, unsigned char *cbuf, unsigned long nbytes);
|
||||
int bdmWriteMemory (unsigned long address, unsigned char *cbuf, unsigned long nbytes);
|
||||
|
||||
/*
|
||||
* The following routines are low-level and are used to implement a
|
||||
* client/interface.
|
||||
*/
|
||||
int bdmIoctlInt (int code, int *var);
|
||||
int bdmIoctlCommand (int code);
|
||||
int bdmIoctlIo (int code, struct BDMioctl *ioc);
|
||||
int bdmRead (unsigned char *cbuf, unsigned long nbytes);
|
||||
int bdmWrite (unsigned char *cbuf, unsigned long nbytes);
|
||||
|
||||
/*
|
||||
* BDM Configuration file support.
|
||||
*/
|
||||
void bdmReadConfiguration ();
|
||||
const char* bdmConfigSkipWhiteSpace (const char* text);
|
||||
const char* bdmConfigGet (const char* label, const char* last);
|
||||
|
||||
/*
|
||||
* BDM debug channel. Applications may use this to have a common
|
||||
* debug trace environment.
|
||||
*/
|
||||
void bdmInfo (const char *format, ...);
|
||||
void bdmPrint (const char *format, ...);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
111
m68k/lib/ChangeLog
Normal file
111
m68k/lib/ChangeLog
Normal file
@@ -0,0 +1,111 @@
|
||||
2002-02-10 Chris Johns <cjohns@cybertec.com.au>
|
||||
|
||||
* bdmIO.c: If on cygwin use our local stat.
|
||||
|
||||
* Makefile:
|
||||
Copy the bdm.h driver file to the user include as the lib headers need it.
|
||||
|
||||
2001-09-01 Chris Johns <cjohns@cybertec.com.au>
|
||||
|
||||
* bdmIO.c: Changed Win9x to Win as Windows 2000 is supported.
|
||||
|
||||
* Makefile:
|
||||
Added a path to the Cygwin Win32 API. This is a bug in Cygwin.
|
||||
Fixed the paths to Win9x by changing to Win only.
|
||||
|
||||
2001-03-29 Chris Johns <cjohns@kiwi.objectivedesign.com.au>
|
||||
|
||||
* Makefile: Fixed the assignments so /usr prefix is used.
|
||||
|
||||
2001-03-29 Chris Johns <cjohns@cybertec.com.au>
|
||||
|
||||
* Makefile: Fixed the assignments so /usr prefix is used.
|
||||
|
||||
2001-02-11 Chris Johns <cjohns@cybertec.com.au>
|
||||
|
||||
* bdmRemote.c:
|
||||
Seemed to lose the TCP_DELAY header when making Windows work.
|
||||
|
||||
2001-02-03 Chris Johns <cjohns@cybertec.com.au>
|
||||
|
||||
* bdmRemote.c,
|
||||
bdmIO.c: Enabled remote support for Win9x.
|
||||
|
||||
2001-02-03 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmRemote.c,
|
||||
bdmIO.c: Enabled remote support for Win9x.
|
||||
|
||||
2000-11-15 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmRemote.c: Support nesting of servers. Helps get around firewalls.
|
||||
Use ioctl numbers which are operating system independent.
|
||||
|
||||
2000-08-31 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmRemote.c: Made the ioctl numbers os independent.
|
||||
|
||||
* Makefile: Clean up.
|
||||
|
||||
22000-06-25 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bfd.h: From a 5.0 build.
|
||||
|
||||
2000-06-07 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmIO.c:
|
||||
Moved the Win9x open/close etc override defines to the driver file.
|
||||
Swap the bytes back after a write so the buffer is as the user passed
|
||||
it.
|
||||
|
||||
2000-05-27 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmIO.c: Added Win9x support.
|
||||
|
||||
* Makefile: Remote/local are controlled by (y/n).
|
||||
A copy does not fail on a read only file.
|
||||
Added the Win9x dependency.
|
||||
|
||||
2000-05-18 Chris Johns <ccj@acm.org>
|
||||
|
||||
* Makefile: Added remote support.
|
||||
|
||||
* BDMlib.h: Added low-level interface.
|
||||
|
||||
* bdmRemote.c: Fixed odd length data left in buffer bug.
|
||||
|
||||
2000-03-30 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmIO.c, Makefile: Added remote server support.
|
||||
|
||||
* bdmRemote.c: New file.
|
||||
|
||||
1999-05-16 Eric Norum <eric@cls.usask.ca>
|
||||
|
||||
* bfd.h: Version from gdb-4.18.
|
||||
|
||||
Tue Apr 27 11:56:39 CST 1999 Eric Norum <eric@cls.usask.ca>
|
||||
|
||||
* bdmBFD.c:
|
||||
Download code to Load Memory Address (LMA) rather than Virtual
|
||||
Memory Address (VMA).
|
||||
|
||||
Tue Jan 12 01:23:43 1999 Chris Johns <ccj@acm.org>
|
||||
|
||||
* bdmBFD.c, Makefile:
|
||||
Use a local bfd.h file to compile the download functions.
|
||||
|
||||
* ansidecl.h, bfd.h: Initial revision
|
||||
|
||||
Sat Jan 9 02:59:53 1999 Chris Johns <ccj@acm.org>
|
||||
|
||||
* Makefile:
|
||||
Detect if a coff or rtems BFD library is present and build the download functions.
|
||||
|
||||
* bdmBFD.c: Initial revision
|
||||
|
||||
* bdmIO.c:
|
||||
Split the download functions into a separate file to remove the BFD lib dependence.
|
||||
|
||||
* BDMlib.h, Makefile, bdmIO.c: Initial revision
|
||||
|
||||
46
m68k/lib/Makefile.am
Normal file
46
m68k/lib/Makefile.am
Normal file
@@ -0,0 +1,46 @@
|
||||
##
|
||||
## $Id: Makefile.am,v 1.6 2008/03/06 10:35:40 cjohns Exp $
|
||||
##
|
||||
## This file is part of a free BDM package
|
||||
##
|
||||
## This program 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 General Public License for more details.
|
||||
##
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/../driver
|
||||
AM_CFLAGS =
|
||||
|
||||
if BDM_IOPERM
|
||||
AM_CFLAGS += -DBDM_IOPERM=1
|
||||
endif
|
||||
|
||||
if BDM_REMOTE
|
||||
AM_CFLAGS += -DBDM_DEVICE_REMOTE=1
|
||||
endif
|
||||
|
||||
if BDM_DRIVER
|
||||
AM_CFLAGS += -DBDM_DEVICE_LOCAL=1
|
||||
endif
|
||||
|
||||
if TBLCF_USB
|
||||
AM_CFLAGS += -DBDM_TBLCF_USB=1
|
||||
AM_CPPFLAGS += -I$(srcdir)/../tblcf
|
||||
endif
|
||||
|
||||
lib_LIBRARIES = libBDM.a
|
||||
|
||||
include_HEADERS = \
|
||||
BDMlib.h \
|
||||
bdmRemote.h \
|
||||
../driver/bdm.h
|
||||
|
||||
libBDM_a_SOURCES = \
|
||||
bdmIO.c \
|
||||
bdmRemote.c
|
||||
|
||||
# FIXME: these would belong to driver/Makefile.am, which we don't have
|
||||
EXTRA_DIST = \
|
||||
../driver/bdm.c \
|
||||
../driver/ioperm/ioperm.c
|
||||
495
m68k/lib/Makefile.in
Normal file
495
m68k/lib/Makefile.in
Normal file
@@ -0,0 +1,495 @@
|
||||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
@BDM_IOPERM_TRUE@am__append_1 = -DBDM_IOPERM=1
|
||||
@BDM_REMOTE_TRUE@am__append_2 = -DBDM_DEVICE_REMOTE=1
|
||||
@BDM_DRIVER_TRUE@am__append_3 = -DBDM_DEVICE_LOCAL=1
|
||||
@TBLCF_USB_TRUE@am__append_4 = -DBDM_TBLCF_USB=1
|
||||
@TBLCF_USB_TRUE@am__append_5 = -I$(srcdir)/../tblcf
|
||||
subdir = lib
|
||||
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in ChangeLog
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
|
||||
libLIBRARIES_INSTALL = $(INSTALL_DATA)
|
||||
LIBRARIES = $(lib_LIBRARIES)
|
||||
ARFLAGS = cru
|
||||
libBDM_a_AR = $(AR) $(ARFLAGS)
|
||||
libBDM_a_LIBADD =
|
||||
am_libBDM_a_OBJECTS = bdmIO.$(OBJEXT) bdmRemote.$(OBJEXT)
|
||||
libBDM_a_OBJECTS = $(am_libBDM_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libBDM_a_SOURCES)
|
||||
DIST_SOURCES = $(libBDM_a_SOURCES)
|
||||
includeHEADERS_INSTALL = $(INSTALL_HEADER)
|
||||
HEADERS = $(include_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BDM_SUBDIRS = @BDM_SUBDIRS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FLASH_PLUGIN_GCC = @FLASH_PLUGIN_GCC@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LEX = @LEX@
|
||||
LEXLIB = @LEXLIB@
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBUSB_INCLUDE_DIR = @LIBUSB_INCLUDE_DIR@
|
||||
LIBUSB_LIB_DIR = @LIBUSB_LIB_DIR@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
flash_plugin_cc = @flash_plugin_cc@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
subdirs = @subdirs@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CPPFLAGS = -I$(srcdir)/../driver $(am__append_5)
|
||||
AM_CFLAGS = $(am__append_1) $(am__append_2) $(am__append_3) \
|
||||
$(am__append_4)
|
||||
lib_LIBRARIES = libBDM.a
|
||||
include_HEADERS = \
|
||||
BDMlib.h \
|
||||
bdmRemote.h \
|
||||
../driver/bdm.h
|
||||
|
||||
libBDM_a_SOURCES = \
|
||||
bdmIO.c \
|
||||
bdmRemote.c
|
||||
|
||||
|
||||
# FIXME: these would belong to driver/Makefile.am, which we don't have
|
||||
EXTRA_DIST = \
|
||||
../driver/bdm.c \
|
||||
../driver/ioperm/ioperm.c
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign lib/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
install-libLIBRARIES: $(lib_LIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
||||
else :; fi; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
p=$(am__strip_dir) \
|
||||
echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
|
||||
$(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
p=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
||||
rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
||||
done
|
||||
|
||||
clean-libLIBRARIES:
|
||||
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
|
||||
libBDM.a: $(libBDM_a_OBJECTS) $(libBDM_a_DEPENDENCIES)
|
||||
-rm -f libBDM.a
|
||||
$(libBDM_a_AR) libBDM.a $(libBDM_a_OBJECTS) $(libBDM_a_LIBADD)
|
||||
$(RANLIB) libBDM.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmIO.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmRemote.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
|
||||
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
f=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(includedir)/$$f"; \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am: install-libLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am \
|
||||
install-includeHEADERS install-info install-info-am \
|
||||
install-libLIBRARIES install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-includeHEADERS uninstall-libLIBRARIES
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
1283
m68k/lib/bdmIO.c
Normal file
1283
m68k/lib/bdmIO.c
Normal file
File diff suppressed because it is too large
Load Diff
881
m68k/lib/bdmRemote.c
Normal file
881
m68k/lib/bdmRemote.c
Normal file
@@ -0,0 +1,881 @@
|
||||
/*
|
||||
* Motorola Background Debug Mode Remote Library
|
||||
* Copyright (C) 1998 Chris Johns
|
||||
*
|
||||
* Based on `ser-tcp.c' in the gdb sources.
|
||||
*
|
||||
* 31-11-1999 Chris Johns (cjohns@users.sourceforge.net)
|
||||
* Extended to support remote operation. See bdmRemote.c for details.
|
||||
*
|
||||
* Chris Johns
|
||||
* Objective Design Systems
|
||||
*
|
||||
* cjohns@users.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define BDM_REMOTE_TRACE 0
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined (__WIN32__)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if !defined (__CYGWIN__)
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "bdmRemote.h"
|
||||
|
||||
#define BDM_REMOTE_OPEN_WAIT (15)
|
||||
#define BDM_REMOTE_TIMEOUT (67)
|
||||
#define BDM_REMOTE_BUF_SIZE (4096)
|
||||
|
||||
/*
|
||||
* Limit of one BDM per process
|
||||
*/
|
||||
static const char *hex = "0123456789abcdef";
|
||||
|
||||
/*
|
||||
* Ioctl code translation.
|
||||
*/
|
||||
static const int ioctl_code_table[] = {
|
||||
BDM_INIT,
|
||||
BDM_RESET_CHIP,
|
||||
BDM_RESTART_CHIP,
|
||||
BDM_STOP_CHIP,
|
||||
BDM_STEP_CHIP,
|
||||
BDM_GET_STATUS,
|
||||
BDM_SPEED,
|
||||
BDM_DEBUG,
|
||||
BDM_RELEASE_CHIP,
|
||||
BDM_GO,
|
||||
BDM_READ_REG,
|
||||
BDM_READ_SYSREG,
|
||||
BDM_READ_LONGWORD,
|
||||
BDM_READ_WORD,
|
||||
BDM_READ_BYTE,
|
||||
BDM_WRITE_REG,
|
||||
BDM_WRITE_SYSREG,
|
||||
BDM_WRITE_LONGWORD,
|
||||
BDM_WRITE_WORD,
|
||||
BDM_WRITE_BYTE,
|
||||
BDM_GET_DRV_VER,
|
||||
BDM_GET_CPU_TYPE,
|
||||
BDM_GET_IF_TYPE,
|
||||
BDM_GET_CF_PST, /* At the end to not break existing servers. */
|
||||
BDM_SET_CF_PST,
|
||||
BDM_READ_CTLREG,
|
||||
BDM_WRITE_CTLREG,
|
||||
BDM_READ_DBREG,
|
||||
BDM_WRITE_DBREG
|
||||
};
|
||||
|
||||
/*
|
||||
* Win32 support not provided as standard.
|
||||
*/
|
||||
|
||||
#if defined (__WIN32__)
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#define sleep(_s) Sleep((_s) * 1000000)
|
||||
|
||||
static int ws_started;
|
||||
int
|
||||
bdmInitWinSock ()
|
||||
{
|
||||
if (!ws_started) {
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
|
||||
wVersionRequested = MAKEWORD (2, 2);
|
||||
|
||||
err = WSAStartup (wVersionRequested, &wsaData);
|
||||
|
||||
if (err)
|
||||
return 0;
|
||||
|
||||
ws_started = 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Like strerror(), but knows about BDM driver errors, too.
|
||||
*/
|
||||
const char *
|
||||
bdmRemoteStrerror (int error_no)
|
||||
{
|
||||
switch (error_no) {
|
||||
case BDM_FAULT_TIMEOUT: return "Remote BDM server timeout";
|
||||
}
|
||||
return strerror (error_no);
|
||||
}
|
||||
|
||||
/*
|
||||
* Translation of local ioctl numbers to a protocol independent number
|
||||
* to send over the link. Different client and server operating systems
|
||||
* will generate different numbers.
|
||||
*/
|
||||
|
||||
static int
|
||||
bdmGenerateIOId (int code)
|
||||
{
|
||||
unsigned int id = 0;
|
||||
|
||||
while (id < (sizeof (ioctl_code_table) / sizeof (ioctl_code_table[0])))
|
||||
if (ioctl_code_table[id] == code)
|
||||
return id;
|
||||
else
|
||||
id++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
bdmSocketSend (int fd, char *buf, int buf_len)
|
||||
{
|
||||
int wrote;
|
||||
|
||||
#if BDM_REMOTE_TRACE
|
||||
bdmPrint ("bdm-remote:send: [%d] %s\n", buf_len, buf);
|
||||
#endif
|
||||
|
||||
#if defined (__WIN32__)
|
||||
wrote = send (fd, buf, buf_len, 0);
|
||||
#else
|
||||
wrote = write (fd, buf, buf_len);
|
||||
#endif
|
||||
if (wrote < 0)
|
||||
bdmPrint ("bdm-remote:send: socket write failed: %s\n",
|
||||
strerror (errno));
|
||||
return wrote;
|
||||
}
|
||||
|
||||
static int
|
||||
bdmRemoteWait (int fd, char *buf, int buf_len)
|
||||
{
|
||||
int numfds;
|
||||
struct timeval tv;
|
||||
fd_set readfds;
|
||||
fd_set exceptfds;
|
||||
int cread;
|
||||
|
||||
FD_ZERO (&readfds);
|
||||
FD_ZERO (&exceptfds);
|
||||
|
||||
tv.tv_sec = BDM_REMOTE_TIMEOUT;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
FD_SET (fd, &readfds);
|
||||
FD_SET (fd, &exceptfds);
|
||||
|
||||
while (1)
|
||||
{
|
||||
numfds = select (fd + 1, &readfds, 0, &exceptfds, &tv);
|
||||
if (numfds <= 0) {
|
||||
if (errno != EINTR) {
|
||||
if ((errno == 0) && (tv.tv_sec == 0) && (tv.tv_usec == 0))
|
||||
errno = BDM_FAULT_TIMEOUT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
memset (buf, 0, buf_len);
|
||||
|
||||
#if defined (__WIN32__)
|
||||
cread = recv (fd, buf, buf_len - 1, 0);
|
||||
#else
|
||||
cread = read (fd, buf, buf_len - 1);
|
||||
#endif
|
||||
|
||||
if (cread > 0) {
|
||||
buf[cread] = 0;
|
||||
#if BDM_REMOTE_TRACE
|
||||
bdmPrint ("bdm-remote:wait: [%d] %s\n", cread, buf);
|
||||
#endif
|
||||
return cread;
|
||||
}
|
||||
|
||||
if (cread < 0)
|
||||
if (errno != EINTR)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
bdmRemoteName (const char *name)
|
||||
{
|
||||
char lname[MAXHOSTNAMELEN];
|
||||
char *port;
|
||||
struct hostent *hostent;
|
||||
|
||||
#if defined (__WIN32__)
|
||||
if (!bdmInitWinSock ()) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We need a ':' in the name to be remote.
|
||||
*/
|
||||
|
||||
if (!strchr (name, ':'))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If the user supplies a port, strip it.
|
||||
*/
|
||||
|
||||
strncpy (lname, name, MAXHOSTNAMELEN);
|
||||
|
||||
port = strchr (lname, ':');
|
||||
|
||||
if (port)
|
||||
*port = '\0';
|
||||
|
||||
hostent = gethostbyname (lname);
|
||||
|
||||
if (!hostent) {
|
||||
bdmPrint ("bdm-remote:name: host look falied: %s\n", lname);
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a remote link. The name is of the form :
|
||||
*
|
||||
* host:port/device
|
||||
*/
|
||||
int
|
||||
bdmRemoteOpen (const char *name)
|
||||
{
|
||||
int fd = -1;
|
||||
char lname[256];
|
||||
char *port_str;
|
||||
char *device = 0;
|
||||
int port = 0;
|
||||
struct hostent *hostent;
|
||||
struct sockaddr_in sockaddr;
|
||||
struct protoent *protoent;
|
||||
struct servent *servent;
|
||||
int reties;
|
||||
int optarg;
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
int buf_len;
|
||||
char *s;
|
||||
|
||||
#if defined (__WIN32__)
|
||||
if (!bdmInitWinSock ()) {
|
||||
bdmPrint ("bdm-remote:open: failed to initialise WinSock\n");
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
strncpy (lname, name, sizeof (lname));
|
||||
lname[sizeof (lname) - 1] = 0;
|
||||
|
||||
/*
|
||||
* There can 2 types of files names passed:
|
||||
*
|
||||
* host:device
|
||||
* host:port:device
|
||||
*/
|
||||
|
||||
port_str = strchr (lname, ':');
|
||||
|
||||
if (port_str) {
|
||||
device = strchr (port_str + 1, ':');
|
||||
if (!device)
|
||||
device = strchr (port_str + 1, '/');
|
||||
if (device) {
|
||||
lname[port_str - lname] = '\0';
|
||||
port = atoi (port_str);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We cannot have a port of 0.
|
||||
*/
|
||||
|
||||
if (port == 0) {
|
||||
if ((servent = getservbyname ("bdm", "tcp"))) {
|
||||
port = ntohs (servent->s_port);
|
||||
}
|
||||
}
|
||||
|
||||
if (port == 0) {
|
||||
port = 6543;
|
||||
}
|
||||
|
||||
if (!device)
|
||||
device = port_str;
|
||||
|
||||
if (!device) {
|
||||
bdmPrint ("bdm-remote:open: no device found\n");
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the host name.
|
||||
*/
|
||||
|
||||
hostent = gethostbyname (lname);
|
||||
|
||||
if (!hostent) {
|
||||
bdmPrint ("bdm-remote:open: gethostbyname (%s) failed\n", lname);
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to make a connection for 15 second. That is
|
||||
* 15 attempts a second apart.
|
||||
*/
|
||||
|
||||
for (reties = 0; reties < BDM_REMOTE_OPEN_WAIT; reties++)
|
||||
{
|
||||
fd = socket (PF_INET, SOCK_STREAM, 0);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Allow rapid reuse of this port.
|
||||
*/
|
||||
|
||||
optarg = 1;
|
||||
if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *) &optarg, sizeof (optarg)) < 0) {
|
||||
int save_errno = errno;
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable TCP keep alive process.
|
||||
*/
|
||||
|
||||
optarg = 1;
|
||||
if (setsockopt (fd, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(char *) &optarg, sizeof (optarg)) < 0) {
|
||||
int save_errno = errno;
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sockaddr.sin_family = PF_INET;
|
||||
sockaddr.sin_port = htons (port);
|
||||
|
||||
memcpy (&sockaddr.sin_addr.s_addr,
|
||||
hostent->h_addr,
|
||||
sizeof (struct in_addr));
|
||||
|
||||
if (!connect (fd,
|
||||
(struct sockaddr *) &sockaddr,
|
||||
sizeof (sockaddr)))
|
||||
break;
|
||||
|
||||
close (fd);
|
||||
fd = -1;
|
||||
|
||||
/*
|
||||
* We retry for ECONNREFUSED because that is often a temporary
|
||||
* condition, which happens when the server is being restarted.
|
||||
*/
|
||||
|
||||
if (errno != ECONNREFUSED)
|
||||
return -1;
|
||||
|
||||
sleep (1);
|
||||
}
|
||||
|
||||
if (reties == BDM_REMOTE_OPEN_WAIT) {
|
||||
bdmPrint ("bdm-remote:open: %s:%d:%s failed\n", lname, port, device);
|
||||
errno = ENXIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
protoent = getprotobyname ("tcp");
|
||||
if (!protoent) {
|
||||
bdmPrint ("bdm-remote:open: getprotobyname failed\n");
|
||||
close (fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
optarg = 1;
|
||||
if (setsockopt (fd, protoent->p_proto,
|
||||
TCP_NODELAY, (char *) &optarg, sizeof (optarg))) {
|
||||
int save_errno = errno;
|
||||
bdmPrint ("bdm-remote:open: setsockopt failed\n");
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we don't do this, then GDB simply exits when the remote
|
||||
* side dies.
|
||||
*/
|
||||
#if !defined (__WIN32__)
|
||||
signal (SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Say hello. This will cause the server to open the port.
|
||||
*/
|
||||
|
||||
buf_len = 1 + sprintf (buf, "HELO %s", device);
|
||||
|
||||
if (bdmSocketSend (fd, buf, buf_len) != buf_len) {
|
||||
int save_errno = errno;
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bdmRemoteWait (fd, buf, BDM_REMOTE_BUF_SIZE) < 0) {
|
||||
int save_errno = errno;
|
||||
bdmPrint ("bdm-remote:open: wait failed\n");
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unpack the result.
|
||||
*/
|
||||
|
||||
s = strstr (buf, "HELO");
|
||||
|
||||
if (!s) {
|
||||
/* FIXME: need error message */
|
||||
return -1;
|
||||
}
|
||||
|
||||
s += sizeof "HELO";
|
||||
|
||||
errno = strtoul (s, NULL, 0);
|
||||
|
||||
if (errno) {
|
||||
int save_errno = errno;
|
||||
bdmRemoteClose (fd);
|
||||
fd = -1;
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close a remote link.
|
||||
*/
|
||||
int
|
||||
bdmRemoteClose (int fd)
|
||||
{
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
|
||||
strcpy (buf, "QUIT Later.");
|
||||
bdmSocketSend (fd, buf, strlen (buf) + 1);
|
||||
|
||||
return close (fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do an int-argument BDM ioctl
|
||||
*/
|
||||
int
|
||||
bdmRemoteIoctlInt (int fd, int code, int *var)
|
||||
{
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
int buf_len;
|
||||
char *s;
|
||||
int id;
|
||||
|
||||
/*
|
||||
* Get a network id for the IO code.
|
||||
*/
|
||||
|
||||
id = bdmGenerateIOId (code);
|
||||
|
||||
if (id < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pack the message and send.
|
||||
*/
|
||||
|
||||
buf_len = 1 + sprintf (buf, "IOINT 0x%x,0x%x", id, *var);
|
||||
|
||||
if (bdmSocketSend (fd, buf, buf_len) != buf_len)
|
||||
return -1;
|
||||
|
||||
if (bdmRemoteWait (fd, buf, BDM_REMOTE_BUF_SIZE) < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Unpack the result.
|
||||
*/
|
||||
|
||||
s = strstr (buf, "IOINT");
|
||||
|
||||
if (!s) {
|
||||
/* FIXME: need error message */
|
||||
return -1;
|
||||
}
|
||||
|
||||
s += sizeof "IOINT";
|
||||
|
||||
errno = strtoul (s, NULL, 0);
|
||||
|
||||
s = strchr (s, ',') + 1;
|
||||
|
||||
*var = strtoul (s, NULL, 0);
|
||||
|
||||
if (errno)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a command (no-argument) BDM ioctl
|
||||
*/
|
||||
int
|
||||
bdmRemoteIoctlCommand (int fd, int code)
|
||||
{
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
int buf_len;
|
||||
char *s;
|
||||
int id;
|
||||
|
||||
/*
|
||||
* Get a network id for the IO code.
|
||||
*/
|
||||
|
||||
id = bdmGenerateIOId (code);
|
||||
|
||||
if (id < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pack the message and send.
|
||||
*/
|
||||
|
||||
buf_len = 1 + sprintf (buf, "IOCMD 0x%x", id);
|
||||
|
||||
if (bdmSocketSend (fd, buf, buf_len) != buf_len)
|
||||
return -1;
|
||||
|
||||
if (bdmRemoteWait (fd, buf, BDM_REMOTE_BUF_SIZE) < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Unpack the result.
|
||||
*/
|
||||
|
||||
s = strstr (buf, "IOCMD");
|
||||
|
||||
if (!s) {
|
||||
/* FIXME: need error message */
|
||||
return -1;
|
||||
}
|
||||
|
||||
s += sizeof "IOCMD";
|
||||
|
||||
errno = strtoul (s, NULL, 0);
|
||||
|
||||
if (errno)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a BDMioctl-argument BDM ioctl
|
||||
*/
|
||||
int
|
||||
bdmRemoteIoctlIo (int fd, int code, struct BDMioctl *ioc)
|
||||
{
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
int buf_len;
|
||||
char *s;
|
||||
int id;
|
||||
|
||||
/*
|
||||
* Get a network id for the IO code.
|
||||
*/
|
||||
|
||||
id = bdmGenerateIOId (code);
|
||||
|
||||
if (id < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pack the message and send.
|
||||
*/
|
||||
|
||||
buf_len = 1 + sprintf (buf, "IOIO 0x%x,0x%x,0x%x",
|
||||
id, ioc->address, ioc->value);
|
||||
|
||||
if (bdmSocketSend (fd, buf, buf_len) != buf_len)
|
||||
return -1;
|
||||
|
||||
if (bdmRemoteWait (fd, buf, BDM_REMOTE_BUF_SIZE) < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Unpack the result.
|
||||
*/
|
||||
|
||||
s = strstr (buf, "IOIO");
|
||||
|
||||
if (!s) {
|
||||
/* FIXME: need error message */
|
||||
return -1;
|
||||
}
|
||||
|
||||
s += sizeof "IOIO";
|
||||
|
||||
errno = strtoul (s, NULL, 0);
|
||||
|
||||
s = strchr (s, ',') + 1;
|
||||
|
||||
ioc->address = strtoul (s, NULL, 0);
|
||||
|
||||
s = strchr (s, ',') + 1;
|
||||
|
||||
ioc->value = strtoul (s, NULL, 0);
|
||||
|
||||
if (errno)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a BDM read
|
||||
*/
|
||||
int
|
||||
bdmRemoteRead (int fd, unsigned char *cbuf, unsigned long nbytes)
|
||||
{
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
int buf_index;
|
||||
int buf_len;
|
||||
unsigned long remote_nbytes;
|
||||
unsigned long bytes;
|
||||
unsigned char octet;
|
||||
char *s;
|
||||
|
||||
/*
|
||||
* Pack the message and send. For a read send the address and length.
|
||||
* The server will return a protocol status code, the read protocol
|
||||
* label, errno, the length then the data.
|
||||
*/
|
||||
|
||||
buf_len = 1 + sprintf (buf, "READ %ld", nbytes);
|
||||
|
||||
if (bdmSocketSend (fd, buf, buf_len) != buf_len)
|
||||
return -1;
|
||||
|
||||
buf_len = bdmRemoteWait (fd, buf, BDM_REMOTE_BUF_SIZE);
|
||||
|
||||
if (buf_len < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Unpack the result.
|
||||
*/
|
||||
|
||||
s = strstr (buf, "READ");
|
||||
|
||||
if (!s) {
|
||||
/* FIXME: need error message */
|
||||
return -1;
|
||||
}
|
||||
|
||||
s += sizeof "READ";
|
||||
|
||||
errno = strtoul (s, NULL, 0);
|
||||
|
||||
s = strchr (s, ',') + 1;
|
||||
|
||||
remote_nbytes = strtoul (s, NULL, 0);
|
||||
|
||||
/*
|
||||
* We could receive an odd number of characters in a buffer
|
||||
* and we need an even number of characters to complete a
|
||||
* byte. So if a single character is left move it to the
|
||||
* start of the buffer and append the next buffer of data.
|
||||
*/
|
||||
|
||||
if (remote_nbytes) {
|
||||
bytes = 0;
|
||||
buf_index = strchr (s, ',') - buf + 1;
|
||||
|
||||
while (bytes < nbytes) {
|
||||
if (buf_len < 2) {
|
||||
int new_read;
|
||||
new_read = bdmRemoteWait (fd, buf + buf_len,
|
||||
BDM_REMOTE_BUF_SIZE - buf_len);
|
||||
if (new_read < 0)
|
||||
return -1;
|
||||
buf_len += new_read;
|
||||
}
|
||||
|
||||
while ((bytes < nbytes) && ((buf_len - buf_index) > 1)) {
|
||||
if (buf[buf_index] > '9') {
|
||||
buf[buf_index] = tolower (buf[buf_index]);
|
||||
octet = buf[buf_index] - 'a' + 10;
|
||||
}
|
||||
else
|
||||
octet = buf[buf_index] - '0';
|
||||
|
||||
buf_index++;
|
||||
|
||||
octet <<= 4;
|
||||
|
||||
if (buf[buf_index] > '9') {
|
||||
buf[buf_index] = tolower (buf[buf_index]);
|
||||
octet |= buf[buf_index] - 'a' + 10;
|
||||
}
|
||||
else
|
||||
octet |= buf[buf_index] - '0';
|
||||
|
||||
buf_index++;
|
||||
|
||||
*cbuf = octet;
|
||||
|
||||
cbuf++;
|
||||
bytes++;
|
||||
}
|
||||
|
||||
if (buf_index < buf_len) {
|
||||
buf[0] = buf[buf_index];
|
||||
buf_len = 1;
|
||||
}
|
||||
else
|
||||
buf_len = 0;
|
||||
|
||||
buf_index = 0;
|
||||
}
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a BDM write
|
||||
*/
|
||||
int
|
||||
bdmRemoteWrite (int fd, unsigned char *cbuf, unsigned long nbytes)
|
||||
{
|
||||
char buf[BDM_REMOTE_BUF_SIZE];
|
||||
int buf_len;
|
||||
unsigned long bytes;
|
||||
char *s;
|
||||
|
||||
/*
|
||||
* Pack the message and send. A write is a matter of
|
||||
* formatting buffers of BDM_REMOTE_BUF_SIZE and streaming them to the
|
||||
* server. This server uses the number of bytes at the start
|
||||
* of the message to detect the number of bytes being sent.
|
||||
*/
|
||||
|
||||
if (nbytes == 0)
|
||||
return 0;
|
||||
|
||||
buf_len = sprintf (buf, "WRITE %ld,", nbytes);
|
||||
bytes = 0;
|
||||
|
||||
while (bytes < nbytes) {
|
||||
while ((bytes < nbytes) && ((BDM_REMOTE_BUF_SIZE - buf_len) > 2)) {
|
||||
buf[buf_len] = hex[(*cbuf >> 4) & 0xf];
|
||||
buf_len++;
|
||||
buf[buf_len] = hex[*cbuf & 0xf];
|
||||
buf_len++;
|
||||
cbuf++;
|
||||
bytes++;
|
||||
}
|
||||
|
||||
buf[buf_len] = 0;
|
||||
if (bdmSocketSend (fd, buf, buf_len) != buf_len)
|
||||
return -1;
|
||||
|
||||
buf_len = 0;
|
||||
}
|
||||
|
||||
if (bdmRemoteWait (fd, buf, BDM_REMOTE_BUF_SIZE) < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Unpack the result.
|
||||
*/
|
||||
|
||||
s = strstr (buf, "WRITE");
|
||||
|
||||
if (!s) {
|
||||
/* FIXME: need error message */
|
||||
return -1;
|
||||
}
|
||||
|
||||
s += sizeof "WRITE";
|
||||
|
||||
errno = strtoul (s, NULL, 0);
|
||||
|
||||
s = strchr (s, ',') + 1;
|
||||
|
||||
nbytes = strtoul (s, NULL, 0);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
60
m68k/lib/bdmRemote.h
Normal file
60
m68k/lib/bdmRemote.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Motorola Background Debug Mode Remote Library
|
||||
* Copyright (C) 1998 Chris Johns
|
||||
*
|
||||
* Based on `ser-tcp.c' in the gdb sources.
|
||||
*
|
||||
* 31-11-1999 Chris Johns (ccj@acm.org)
|
||||
* Extended to support remote operation. See bdmRemote.c for details.
|
||||
*
|
||||
* Chris Johns
|
||||
* Objective Design Systems
|
||||
* 35 Cairo Street
|
||||
* Cammeray, Sydney, 2062, Australia
|
||||
*
|
||||
* ccj@acm.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _BDM_REMOTE_LIB_H_
|
||||
#define _BDM_REMOTE_LIB_H_
|
||||
|
||||
#if __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "BDMlib.h"
|
||||
|
||||
/*
|
||||
* Internal to the BDM library.
|
||||
*/
|
||||
|
||||
const char *bdmRemoteStrerror (int error_no);
|
||||
int bdmRemoteName (const char *name);
|
||||
int bdmRemoteOpen (const char *name);
|
||||
int bdmRemoteClose (int fd);
|
||||
int bdmRemoteIoctlInt (int fd, int code, int *var);
|
||||
int bdmRemoteIoctlCommand (int fd, int code);
|
||||
int bdmRemoteIoctlIo (int fd, int code, struct BDMioctl *ioc);
|
||||
int bdmRemoteRead (int fd, unsigned char *cbuf, unsigned long nbytes);
|
||||
int bdmRemoteWrite (int fd, unsigned char *cbuf, unsigned long nbytes);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user