Skip to content

Commit

Permalink
jtag: update constant names to follow code style guidelines
Browse files Browse the repository at this point in the history
Change-Id: Ib081433c67f3be0e5be0b39469680bcce079e0cc
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8485
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
  • Loading branch information
aap-sc authored and borneoa committed Oct 5, 2024
1 parent 017e61f commit bd93b83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/jtag/drivers/cmsis_dap.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ static int cmsis_dap_cmd_dap_delay(uint16_t delay_us)
static int cmsis_dap_metacmd_targetsel(uint32_t instance_id)
{
uint8_t *command = cmsis_dap_handle->command;
const uint32_t SEQ_RD = 0x80, SEQ_WR = 0x00;
const uint32_t seq_rd = 0x80, seq_wr = 0x00;

/* SWD multi-drop requires a transfer ala CMD_DAP_TFER,
but with no expectation of an SWD ACK response. In
Expand All @@ -579,14 +579,14 @@ static int cmsis_dap_metacmd_targetsel(uint32_t instance_id)
command[idx++] = 3; /* sequence count */

/* sequence 0: packet request for TARGETSEL */
command[idx++] = SEQ_WR | 8;
command[idx++] = seq_wr | 8;
command[idx++] = SWD_CMD_START | swd_cmd(false, false, DP_TARGETSEL) | SWD_CMD_STOP | SWD_CMD_PARK;

/* sequence 1: read Trn ACK Trn, no expectation for target to ACK */
command[idx++] = SEQ_RD | 5;
command[idx++] = seq_rd | 5;

/* sequence 2: WDATA plus parity */
command[idx++] = SEQ_WR | (32 + 1);
command[idx++] = seq_wr | (32 + 1);
h_u32_to_le(command + idx, instance_id);
idx += 4;
command[idx++] = parity_u32(instance_id);
Expand Down
4 changes: 2 additions & 2 deletions src/jtag/drivers/jtag_vpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,14 @@ static int jtag_vpi_stableclocks(unsigned int num_cycles)
unsigned int cycles_remain = num_cycles;
int nb_bits;
int retval;
const unsigned int CYCLES_ONE_BATCH = sizeof(tms_bits) * 8;
const unsigned int cycles_one_batch = sizeof(tms_bits) * 8;

/* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */
memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits));

/* send the TMS bits */
while (cycles_remain > 0) {
nb_bits = (cycles_remain < CYCLES_ONE_BATCH) ? cycles_remain : CYCLES_ONE_BATCH;
nb_bits = (cycles_remain < cycles_one_batch) ? cycles_remain : cycles_one_batch;
retval = jtag_vpi_tms_seq(tms_bits, nb_bits);
if (retval != ERROR_OK)
return retval;
Expand Down
8 changes: 4 additions & 4 deletions src/jtag/drivers/xds110.c
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,7 @@ static int xds110_speed(int speed)

} else {

const double XDS110_TCK_PULSE_INCREMENT = 66.0;
const double xds110_tck_pulse_increment = 66.0;
freq_to_use = speed * 1000; /* Hz */
delay_count = 0;

Expand All @@ -1908,7 +1908,7 @@ static int xds110_speed(int speed)
double current_value = max_freq_pulse_duration;

while (current_value < freq_to_pulse_width_in_ns) {
current_value += XDS110_TCK_PULSE_INCREMENT;
current_value += xds110_tck_pulse_increment;
++delay_count;
}

Expand All @@ -1919,9 +1919,9 @@ static int xds110_speed(int speed)
if (delay_count) {
double diff_freq_1 = freq_to_use -
(one_giga / (max_freq_pulse_duration +
(XDS110_TCK_PULSE_INCREMENT * delay_count)));
(xds110_tck_pulse_increment * delay_count)));
double diff_freq_2 = (one_giga / (max_freq_pulse_duration +
(XDS110_TCK_PULSE_INCREMENT * (delay_count - 1)))) -
(xds110_tck_pulse_increment * (delay_count - 1)))) -
freq_to_use;

/* One less count value yields a better match */
Expand Down

0 comments on commit bd93b83

Please sign in to comment.