add openocd.h for top-level declarations
authorZachary T Welch <zw@superlucidity.net>
Sat, 14 Nov 2009 15:29:16 +0000 (07:29 -0800)
committerZachary T Welch <zw@superlucidity.net>
Sat, 14 Nov 2009 15:29:16 +0000 (07:29 -0800)
Create src/openocd.h to hold declarations previously made internally
by src/main.c and src/server/server.c.  This ensures all functions
are verified to be in-sync at compile time (rather than at link),
making it easier to track down bugs.

src/Makefile.am
src/ecosboard.c
src/main.c
src/openocd.h [new file with mode: 0644]
src/server/Makefile.am
src/server/server.c

index 7721f34010ffe200ae382053382b0fac3c50eb80..77ae5ae2e771e0975950ddae0942bd913e94aeca 100644 (file)
@@ -16,6 +16,10 @@ libopenocd_la_SOURCES = \
        hello.c \
        openocd.c
 
        hello.c \
        openocd.c
 
+noinst_HEADERS = \
+       openocd.h
+
+
 # set the include path found by configure
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src \
 # set the include path found by configure
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src \
index 38f32525abad8d94bf22563f6f0994f24f43a0a7..e38316cb7f6045fcf2b7db608311552a674eaa5e 100644 (file)
@@ -36,6 +36,7 @@
 #include "server.h"
 #include "telnet_server.h"
 #include "gdb_server.h"
 #include "server.h"
 #include "telnet_server.h"
 #include "gdb_server.h"
+#include "openocd.h"
 
 #include <time_support.h>
 #include <sys/time.h>
 
 #include <time_support.h>
 #include <sys/time.h>
index c2b53da6e3dc7ae203e36a7d9f954b62e9468bf2..a71977daf9041e896599c5a1050c2525328414f3 100644 (file)
@@ -22,6 +22,7 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#include "openocd.h"
 
 /* This is the main entry for developer PC hosted OpenOCD.
  *
 
 /* This is the main entry for developer PC hosted OpenOCD.
  *
@@ -32,8 +33,6 @@
  * Those applications will have their own main() implementation
  * and use bits and pieces from openocd.c. */
 
  * Those applications will have their own main() implementation
  * and use bits and pieces from openocd.c. */
 
-extern int openocd_main(int argc, char *argv[]);
-
 int main(int argc, char *argv[])
 {
        return openocd_main(argc, argv);
 int main(int argc, char *argv[])
 {
        return openocd_main(argc, argv);
diff --git a/src/openocd.h b/src/openocd.h
new file mode 100644 (file)
index 0000000..1bf6b7e
--- /dev/null
@@ -0,0 +1,39 @@
+/***************************************************************************
+ *   Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de>              *
+ *   Copyright (C) 2009 by Zachary T Welch <zw@superlucidity.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.             *
+ ***************************************************************************/
+
+#ifndef OPENOCD_H
+#define OPENOCD_H
+
+/** 
+ * Different applications can define this entry point to override
+ * the default openocd main function.  On most systems, this will be
+ * defined in src/openocd.c.
+ * @param argc normally passed from main()
+ * @param argv normally passed from main()
+ * @returns return code for main()
+ */
+int openocd_main(int argc, char *argv[]);
+
+/// used by the server_loop() function in src/server/server.c
+void openocd_sleep_prelude(void);
+/// used by the server_loop() function in src/server/server.c
+void openocd_sleep_postlude(void);
+
+#endif
index 2f0700757978aa1defecb142938d017e2c3d666f..6e52fdfb88f5a3d4fdb64968f84ac8959158b1a8 100644 (file)
@@ -1,4 +1,5 @@
 AM_CPPFLAGS = \
 AM_CPPFLAGS = \
+       -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/helper \
        -I$(top_srcdir)/src/target \
        -I$(top_srcdir)/src/flash \
        -I$(top_srcdir)/src/helper \
        -I$(top_srcdir)/src/target \
        -I$(top_srcdir)/src/flash \
index 7416784c768b18bc1adec1cb3263b72600c0a702..92292eb59b7ee605727e16211d224c88833210f8 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "server.h"
 #include "target.h"
 
 #include "server.h"
 #include "target.h"
+#include "openocd.h"
 
 #include <signal.h>
 
 
 #include <signal.h>
 
@@ -285,9 +286,6 @@ int remove_services(void)
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
-extern void openocd_sleep_prelude(void);
-extern void openocd_sleep_postlude(void);
-
 int server_loop(struct command_context *command_context)
 {
        struct service *service;
 int server_loop(struct command_context *command_context)
 {
        struct service *service;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)