add openocd.h for top-level declarations
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.
This commit is contained in:
parent
ab3bdfb2cb
commit
4088b1e622
|
@ -16,6 +16,10 @@ libopenocd_la_SOURCES = \
|
||||||
hello.c \
|
hello.c \
|
||||||
openocd.c
|
openocd.c
|
||||||
|
|
||||||
|
noinst_HEADERS = \
|
||||||
|
openocd.h
|
||||||
|
|
||||||
|
|
||||||
# set the include path found by configure
|
# set the include path found by configure
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "telnet_server.h"
|
#include "telnet_server.h"
|
||||||
#include "gdb_server.h"
|
#include "gdb_server.h"
|
||||||
|
#include "openocd.h"
|
||||||
|
|
||||||
#include <time_support.h>
|
#include <time_support.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#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
|
* Those applications will have their own main() implementation
|
||||||
* and use bits and pieces from openocd.c. */
|
* and use bits and pieces from openocd.c. */
|
||||||
|
|
||||||
extern int openocd_main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return openocd_main(argc, argv);
|
return openocd_main(argc, argv);
|
||||||
|
|
|
@ -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
|
|
@ -1,4 +1,5 @@
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
|
-I$(top_srcdir)/src \
|
||||||
-I$(top_srcdir)/src/helper \
|
-I$(top_srcdir)/src/helper \
|
||||||
-I$(top_srcdir)/src/target \
|
-I$(top_srcdir)/src/target \
|
||||||
-I$(top_srcdir)/src/flash \
|
-I$(top_srcdir)/src/flash \
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "target.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)
|
int server_loop(struct command_context *command_context)
|
||||||
{
|
{
|
||||||
struct service *service;
|
struct service *service;
|
||||||
|
|
Loading…
Reference in New Issue