transport: add transport_is_hla()

and move declaration of all transport_is_xxx() functions to transport.h

Change-Id: Ib229115b5017507b49655bc43b517ab6fb32f7a6
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4469
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
Tomas Vanek 2018-03-15 20:02:10 +01:00 committed by Matthias Welwarsky
parent 828ee07657
commit 78a44055c5
6 changed files with 29 additions and 5 deletions

View File

@ -233,3 +233,11 @@ static void hl_constructor(void)
transport_register(&hl_jtag_transport);
transport_register(&stlink_swim_transport);
}
bool transport_is_hla(void)
{
struct transport *t;
t = get_current_transport();
return t == &hl_swd_transport || t == &hl_jtag_transport
|| t == &stlink_swim_transport;
}

View File

@ -642,8 +642,6 @@ void jtag_poll_set_enabled(bool value);
* level APIs that are used in inner loops. */
#include <jtag/minidriver.h>
bool transport_is_jtag(void);
int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
#endif /* OPENOCD_JTAG_JTAG_H */

View File

@ -211,6 +211,4 @@ struct swd_driver {
int swd_init_reset(struct command_context *cmd_ctx);
void swd_add_reset(int req_srst);
bool transport_is_swd(void);
#endif /* OPENOCD_JTAG_SWD_H */

View File

@ -42,6 +42,7 @@
#endif
#include <helper/time_support.h>
#include "transport/transport.h"
/**
* @file

View File

@ -54,7 +54,7 @@
#include "target_type.h"
#include "arm_opcodes.h"
#include "arm_semihosting.h"
#include "jtag/swd.h"
#include "transport/transport.h"
#include <helper/time_support.h>
static int cortex_a_poll(struct target *target);

View File

@ -19,6 +19,10 @@
#ifndef OPENOCD_TRANSPORT_TRANSPORT_H
#define OPENOCD_TRANSPORT_TRANSPORT_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "helper/command.h"
/**
@ -90,4 +94,19 @@ int allow_transports(struct command_context *ctx, const char * const *vector);
bool transports_are_declared(void);
bool transport_is_jtag(void);
bool transport_is_swd(void);
/* FIXME: ZY1000 test build on jenkins is configured with enabled hla adapters
* but jtag/hla/hla_*.c files are not compiled. To workaround the problem we assume hla
* is broken if BUILD_ZY1000 is set */
#if BUILD_HLADAPTER && !BUILD_ZY1000
bool transport_is_hla(void);
#else
static inline bool transport_is_hla(void)
{
return false;
}
#endif
#endif /* OPENOCD_TRANSPORT_TRANSPORT_H */