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;
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 */