aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <jaylink-dev@marcschink.de>2016-10-11 20:41:56 +0200
committerMarc Schink <jaylink-dev@marcschink.de>2016-10-29 10:55:23 +0200
commit13ff1d93e0100b56a028107ba420d0210f7c8430 (patch)
tree605597a87b14c54aa946145f9d6132c6fbd00652
parentfbf16f81dd74b2bcd53741f7e9b265158725ce43 (diff)
Remove (__)JAYLINK_TIF_MAX
If necessary, a more general identifier which denotes the last element of an enum may be re-added later. Signed-off-by: Marc Schink <jaylink-dev@marcschink.de>
-rw-r--r--libjaylink/libjaylink.h6
-rw-r--r--libjaylink/target.c10
2 files changed, 9 insertions, 7 deletions
diff --git a/libjaylink/libjaylink.h b/libjaylink/libjaylink.h
index 7de13a4..1066d96 100644
--- a/libjaylink/libjaylink.h
+++ b/libjaylink/libjaylink.h
@@ -183,14 +183,8 @@ enum jaylink_target_interface {
JAYLINK_TIF_FINE = 3,
/** 2-wire JTAG for PIC32 compliant devices. */
JAYLINK_TIF_2W_JTAG_PIC32 = 4,
-
- /** <i>Helper which must be always the last element</i>. */
- __JAYLINK_TIF_MAX
};
-/** Maximum valid target interface number. */
-#define JAYLINK_TIF_MAX (__JAYLINK_TIF_MAX - 1)
-
/**
* JTAG command versions.
*
diff --git a/libjaylink/target.c b/libjaylink/target.c
index 69d2f1b..0260ccf 100644
--- a/libjaylink/target.c
+++ b/libjaylink/target.c
@@ -208,8 +208,16 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh,
if (!devh)
return JAYLINK_ERR_ARG;
- if (iface > JAYLINK_TIF_MAX)
+ switch (iface) {
+ case JAYLINK_TIF_JTAG:
+ case JAYLINK_TIF_SWD:
+ case JAYLINK_TIF_BDM3:
+ case JAYLINK_TIF_FINE:
+ case JAYLINK_TIF_2W_JTAG_PIC32:
+ break;
+ default:
return JAYLINK_ERR_ARG;
+ }
ctx = devh->dev->ctx;
ret = transport_start_write_read(devh, 2, 4, true);