adapter: use bitmask for driver's transports

In every driver, replace the array of strings with a bitmask that
lists the supported transports.
Add an extra field to carry the former first listed transport as a
"preferred" transport. It would be used as default when no command
'transport select' is used. This keeps backward compatibility with
scripts that do not define the transport, relying on such default.

Change-Id: I4976583f1a38fdcc1f85045023dc7c629001f743
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8675
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
Antonio Borneo
2025-02-12 16:39:18 +01:00
parent 236208a5ff
commit a500b2ce67
46 changed files with 129 additions and 113 deletions

View File

@@ -17,6 +17,7 @@
#include <jtag/jtag.h>
#include <jtag/swim.h>
#include <target/arm_tpiu_swo.h>
#include <transport/transport.h>
/* @file
* The "Cable Helper API" is what the cable drivers can use to help
@@ -208,8 +209,16 @@ struct adapter_driver {
/** The name of the interface driver. */
const char * const name;
/** transports supported in C code (NULL terminated vector) */
const char * const *transports;
/**
* Bitmask of transport IDs supported in C code.
*/
unsigned int transport_ids;
/**
* ID of transport that gets auto-selected when not specified by the user.
* The auto-selection of transport is DEPRECATED.
*/
unsigned int transport_preferred_id;
/**
* The interface driver may register additional commands to expose
@@ -354,8 +363,6 @@ struct adapter_driver {
const struct swim_driver *swim_ops;
};
extern const char * const jtag_only[];
int adapter_resets(int assert_trst, int assert_srst);
int adapter_assert_reset(void);
int adapter_deassert_reset(void);