#define DIM(x) (sizeof(x)/sizeof((x)[0]))
/** Calculate the number of bytes required to hold @a n TAP scan bits */
-#define TAP_SCAN_BYTES(n) CEIL(n, 8)
+#define TAP_SCAN_BYTES(n) DIV_ROUND_UP(n, 8)
/*-----</Macros>-------------------------------------------------*/
*
* The allocated, modified, and intmp fields are internal work space.
*/
-typedef struct scan_field_s
-{
+struct scan_field {
/// A pointer to the tap structure to which this field refers.
struct jtag_tap* tap;
int modified;
/// temporary storage for performing value checks synchronously
uint8_t intmp[4];
-} scan_field_t;
-
-typedef struct jtag_tap_event_action_s jtag_tap_event_action_t;
+};
struct jtag_tap {
const char* chip;
/// Bypass register selected
int bypass;
- jtag_tap_event_action_t *event_action;
+ struct jtag_tap_event_action *event_action;
struct jtag_tap* next_tap;
};
JTAG_TAP_EVENT_DISABLE,
};
-struct jtag_tap_event_action_s
+struct jtag_tap_event_action
{
enum jtag_event event;
Jim_Obj* body;
- jtag_tap_event_action_t* next;
+ struct jtag_tap_event_action* next;
};
/**
* Initialize interface upon startup. Return a successful no-op upon
* subsequent invocations.
*/
-int jtag_interface_init(struct command_context_s* cmd_ctx);
+int jtag_interface_init(struct command_context* cmd_ctx);
/// Shutdown the JTAG interface upon program exit.
int jtag_interface_quit(void);
* Initialize JTAG chain using only a RESET reset. If init fails,
* try reset + init.
*/
-int jtag_init(struct command_context_s* cmd_ctx);
+int jtag_init(struct command_context* cmd_ctx);
/// reset, then initialize JTAG chain
-int jtag_init_reset(struct command_context_s* cmd_ctx);
-int jtag_register_commands(struct command_context_s* cmd_ctx);
-int jtag_init_inner(struct command_context_s *cmd_ctx);
+int jtag_init_reset(struct command_context* cmd_ctx);
+int jtag_register_commands(struct command_context* cmd_ctx);
+int jtag_init_inner(struct command_context *cmd_ctx);
/**
* @file
*
*/
void jtag_add_ir_scan(int num_fields,
- scan_field_t* fields, tap_state_t endstate);
+ struct scan_field* fields, tap_state_t endstate);
/**
* The same as jtag_add_ir_scan except no verification is performed out
* the output values.
*/
void jtag_add_ir_scan_noverify(int num_fields,
- const scan_field_t *fields, tap_state_t state);
+ const struct scan_field *fields, tap_state_t state);
/**
* Duplicate the scan fields passed into the function into an IR SCAN
* command. This function assumes that the caller handles extra fields
* for bypassed TAPs.
*/
void jtag_add_plain_ir_scan(int num_fields,
- const scan_field_t* fields, tap_state_t endstate);
+ const struct scan_field* fields, tap_state_t endstate);
/**
* allocation method is used, for the synchronous case the temporary 32
* bits come from the input field itself.
*/
-void jtag_alloc_in_value32(scan_field_t *field);
+void jtag_alloc_in_value32(struct scan_field *field);
/**
* Generate a DR SCAN using the fields passed to the function.
* 1-bit field. The bypass status of TAPs is set by jtag_add_ir_scan().
*/
void jtag_add_dr_scan(int num_fields,
- const scan_field_t* fields, tap_state_t endstate);
+ const struct scan_field* fields, tap_state_t endstate);
/// A version of jtag_add_dr_scan() that uses the check_value/mask fields
void jtag_add_dr_scan_check(int num_fields,
- scan_field_t* fields, tap_state_t endstate);
+ struct scan_field* fields, tap_state_t endstate);
/**
* Duplicate the scan fields passed into the function into a DR SCAN
* command. Unlike jtag_add_dr_scan(), this function assumes that the
* caller handles extra fields for bypassed TAPs.
*/
void jtag_add_plain_dr_scan(int num_fields,
- const scan_field_t* fields, tap_state_t endstate);
+ const struct scan_field* fields, tap_state_t endstate);
/**
* Defines the type of data passed to the jtag_callback_t interface.
* @param mask Pointer to scan mask; may be NULL.
* @returns Nothing, but calls jtag_set_error() on any error.
*/
-void jtag_check_value_mask(scan_field_t *field, uint8_t *value, uint8_t *mask);
+void jtag_check_value_mask(struct scan_field *field, uint8_t *value, uint8_t *mask);
void jtag_sleep(uint32_t us);