summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-04-24 16:24:55 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-04-24 16:24:55 +0000
commit447a615dc33f324d44c73b282174be44e876cf41 (patch)
tree4a83cc7a9e18180900d58befae02d02932ca3a47
parent002fdcf016e89b4f77be3afe9884dfe886f3cdd1 (diff)
downloadopenocd+libswd-447a615dc33f324d44c73b282174be44e876cf41.tar.gz
openocd+libswd-447a615dc33f324d44c73b282174be44e876cf41.tar.bz2
openocd+libswd-447a615dc33f324d44c73b282174be44e876cf41.tar.xz
openocd+libswd-447a615dc33f324d44c73b282174be44e876cf41.zip
Zach Welch <zw@superlucidity.net> add TAP_SCAN_BYTES macro (1 of 2)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1524 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/jtag/jlink.c2
-rw-r--r--src/jtag/jtag.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/jtag/jlink.c b/src/jtag/jlink.c
index 8626b18c..1269fa84 100644
--- a/src/jtag/jlink.c
+++ b/src/jtag/jlink.c
@@ -672,7 +672,7 @@ static int jlink_tap_execute(void)
return ERROR_OK;
// number of full bytes (plus one if some would be left over)
- byte_length = tap_length / 8 + !!(tap_length % 8);
+ byte_length = TAP_SCAN_BYTES(tap_length);
usb_out_buffer[0] = EMU_CMD_HW_JTAG3;
usb_out_buffer[1] = 0;
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 2a7d8561..a14edb48 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -217,6 +217,9 @@ typedef void* error_handler_t; /* Later on we can delete error_handler_t, but k
struct scan_field_s;
typedef int (*in_handler_t)(u8* in_value, void* priv, struct scan_field_s* field);
+/// @brief calculates number of bytes required to hold @a n TAP scan bits
+#define TAP_SCAN_BYTES(n) (((n) / 8) + !!((n) % 8))
+
typedef struct scan_field_s
{
jtag_tap_t* tap; /* tap pointer this instruction refers to */