#endif
#include "bitq.h"
+#include "interface.h"
bitq_interface_t* bitq_interface; /* low level bit queue interface */
static bitq_state_t bitq_in_state; /* state of input queue */
-static u8* bitq_in_buffer; /* buffer dynamically reallocated as needed */
+static uint8_t* bitq_in_buffer; /* buffer dynamically reallocated as needed */
static int bitq_in_bufsize = 32; /* min. buffer size */
/*
void bitq_in_proc(void)
{
/* static information preserved between calls to increase performance */
- static u8* in_buff; /* pointer to buffer for scanned data */
+ static uint8_t* in_buff; /* pointer to buffer for scanned data */
static int in_idx; /* index of byte being scanned */
- static u8 in_mask; /* mask of next bit to be scanned */
+ static uint8_t in_mask; /* mask of next bit to be scanned */
scan_field_t* field;
int tdo;
void bitq_end_state(tap_state_t state)
{
- if (state==TAP_INVALID)
- return;
-
if (!tap_is_state_stable(state))
{
LOG_ERROR("BUG: %i is not a valid end state", state);
void bitq_state_move(tap_state_t new_state)
{
int i = 0;
- u8 tms_scan;
+ uint8_t tms_scan;
if (!tap_is_state_stable(tap_get_state()) || !tap_is_state_stable(new_state))
{
}
tms_scan = tap_get_tms_path(tap_get_state(), new_state);
+ int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
- for (i = 0; i<7; i++)
+ for (i = 0; i<tms_count; i++)
{
bitq_io(tms_scan & 1, 0, 0);
tms_scan >>= 1;
int bit_cnt;
int tdo_req;
- u8* out_ptr;
- u8 out_mask;
+ uint8_t* out_ptr;
+ uint8_t out_mask;
if (field->in_value)
tdo_req = 1;
{
switch (cmd->type)
{
- case JTAG_END_STATE:
-#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG("end_state: %i", cmd->cmd.end_state->end_state);
-#endif
- bitq_end_state(cmd->cmd.end_state->end_state);
- break;
-
case JTAG_RESET:
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
#endif
- if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST) ) )
+ if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST) ) )
{
tap_set_state(TAP_RESET);
}