39
39
#include "server/ipdbg.h"
40
40
41
41
/** The number of JTAG queue flushes (for profiling and debugging purposes). */
42
- static int jtag_flush_queue_count ;
42
+ static unsigned int jtag_flush_queue_count ;
43
43
44
44
/* Sleep this # of ms after flushing the queue */
45
45
static int jtag_flush_queue_sleep ;
@@ -92,10 +92,10 @@ static bool jtag_verify = true;
92
92
93
93
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines
94
94
*deasserted (in ms) */
95
- static int adapter_nsrst_delay ; /* default to no nSRST delay */
96
- static int jtag_ntrst_delay ;/* default to no nTRST delay */
97
- static int adapter_nsrst_assert_width ; /* width of assertion */
98
- static int jtag_ntrst_assert_width ; /* width of assertion */
95
+ static unsigned int adapter_nsrst_delay ; /* default to no nSRST delay */
96
+ static unsigned int jtag_ntrst_delay ;/* default to no nTRST delay */
97
+ static unsigned int adapter_nsrst_assert_width ; /* width of assertion */
98
+ static unsigned int jtag_ntrst_assert_width ; /* width of assertion */
99
99
100
100
/**
101
101
* Contains a single callback along with a pointer that will be passed
@@ -186,21 +186,21 @@ struct jtag_tap *jtag_all_taps(void)
186
186
return __jtag_all_taps ;
187
187
};
188
188
189
- unsigned jtag_tap_count (void )
189
+ unsigned int jtag_tap_count (void )
190
190
{
191
191
struct jtag_tap * t = jtag_all_taps ();
192
- unsigned n = 0 ;
192
+ unsigned int n = 0 ;
193
193
while (t ) {
194
194
n ++ ;
195
195
t = t -> next_tap ;
196
196
}
197
197
return n ;
198
198
}
199
199
200
- unsigned jtag_tap_count_enabled (void )
200
+ unsigned int jtag_tap_count_enabled (void )
201
201
{
202
202
struct jtag_tap * t = jtag_all_taps ();
203
- unsigned n = 0 ;
203
+ unsigned int n = 0 ;
204
204
while (t ) {
205
205
if (t -> enabled )
206
206
n ++ ;
@@ -499,7 +499,7 @@ void jtag_add_tlr(void)
499
499
*
500
500
* @todo Update naming conventions to stop assuming everything is JTAG.
501
501
*/
502
- int jtag_add_tms_seq (unsigned nbits , const uint8_t * seq , enum tap_state state )
502
+ int jtag_add_tms_seq (unsigned int nbits , const uint8_t * seq , enum tap_state state )
503
503
{
504
504
int retval ;
505
505
@@ -567,12 +567,12 @@ int jtag_add_statemove(tap_state_t goal_state)
567
567
/* nothing to do */ ;
568
568
569
569
else if (tap_is_state_stable (cur_state ) && tap_is_state_stable (goal_state )) {
570
- unsigned tms_bits = tap_get_tms_path (cur_state , goal_state );
571
- unsigned tms_count = tap_get_tms_path_len (cur_state , goal_state );
570
+ unsigned int tms_bits = tap_get_tms_path (cur_state , goal_state );
571
+ unsigned int tms_count = tap_get_tms_path_len (cur_state , goal_state );
572
572
tap_state_t moves [8 ];
573
573
assert (tms_count < ARRAY_SIZE (moves ));
574
574
575
- for (unsigned i = 0 ; i < tms_count ; i ++ , tms_bits >>= 1 ) {
575
+ for (unsigned int i = 0 ; i < tms_count ; i ++ , tms_bits >>= 1 ) {
576
576
bool bit = tms_bits & 1 ;
577
577
578
578
cur_state = tap_state_transition (cur_state , bit );
@@ -1029,7 +1029,7 @@ void jtag_execute_queue_noclear(void)
1029
1029
}
1030
1030
}
1031
1031
1032
- int jtag_get_flush_queue_count (void )
1032
+ unsigned int jtag_get_flush_queue_count (void )
1033
1033
{
1034
1034
return jtag_flush_queue_count ;
1035
1035
}
@@ -1081,7 +1081,7 @@ void jtag_sleep(uint32_t us)
1081
1081
/* a larger IR length than we ever expect to autoprobe */
1082
1082
#define JTAG_IRLEN_MAX 60
1083
1083
1084
- static int jtag_examine_chain_execute (uint8_t * idcode_buffer , unsigned num_idcode )
1084
+ static int jtag_examine_chain_execute (uint8_t * idcode_buffer , unsigned int num_idcode )
1085
1085
{
1086
1086
struct scan_field field = {
1087
1087
.num_bits = num_idcode * 32 ,
@@ -1090,20 +1090,20 @@ static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned num_idcod
1090
1090
};
1091
1091
1092
1092
/* initialize to the end of chain ID value */
1093
- for (unsigned i = 0 ; i < num_idcode ; i ++ )
1093
+ for (unsigned int i = 0 ; i < num_idcode ; i ++ )
1094
1094
buf_set_u32 (idcode_buffer , i * 32 , 32 , END_OF_CHAIN_FLAG );
1095
1095
1096
1096
jtag_add_plain_dr_scan (field .num_bits , field .out_value , field .in_value , TAP_DRPAUSE );
1097
1097
jtag_add_tlr ();
1098
1098
return jtag_execute_queue ();
1099
1099
}
1100
1100
1101
- static bool jtag_examine_chain_check (uint8_t * idcodes , unsigned count )
1101
+ static bool jtag_examine_chain_check (uint8_t * idcodes , unsigned int count )
1102
1102
{
1103
1103
uint8_t zero_check = 0x0 ;
1104
1104
uint8_t one_check = 0xff ;
1105
1105
1106
- for (unsigned i = 0 ; i < count * 4 ; i ++ ) {
1106
+ for (unsigned int i = 0 ; i < count * 4 ; i ++ ) {
1107
1107
zero_check |= idcodes [i ];
1108
1108
one_check &= idcodes [i ];
1109
1109
}
@@ -1158,7 +1158,8 @@ static bool jtag_idcode_is_final(uint32_t idcode)
1158
1158
* with the JTAG chain earlier, gives more helpful/explicit error messages.
1159
1159
* Returns TRUE iff garbage was found.
1160
1160
*/
1161
- static bool jtag_examine_chain_end (uint8_t * idcodes , unsigned count , unsigned max )
1161
+ static bool jtag_examine_chain_end (uint8_t * idcodes , unsigned int count ,
1162
+ unsigned int max )
1162
1163
{
1163
1164
bool triggered = false;
1164
1165
for (; count < max - 31 ; count += 32 ) {
@@ -1185,26 +1186,26 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap)
1185
1186
uint32_t idcode = tap -> idcode & mask ;
1186
1187
1187
1188
/* Loop over the expected identification codes and test for a match */
1188
- for (unsigned ii = 0 ; ii < tap -> expected_ids_cnt ; ii ++ ) {
1189
- uint32_t expected = tap -> expected_ids [ii ] & mask ;
1189
+ for (unsigned int i = 0 ; i < tap -> expected_ids_cnt ; i ++ ) {
1190
+ uint32_t expected = tap -> expected_ids [i ] & mask ;
1190
1191
1191
1192
if (idcode == expected )
1192
1193
return true;
1193
1194
1194
1195
/* treat "-expected-id 0" as a "don't-warn" wildcard */
1195
- if (tap -> expected_ids [ii ] == 0 )
1196
+ if (tap -> expected_ids [i ] == 0 )
1196
1197
return true;
1197
1198
}
1198
1199
1199
1200
/* If none of the expected ids matched, warn */
1200
1201
jtag_examine_chain_display (LOG_LVL_WARNING , "UNEXPECTED" ,
1201
1202
tap -> dotted_name , tap -> idcode );
1202
- for (unsigned ii = 0 ; ii < tap -> expected_ids_cnt ; ii ++ ) {
1203
+ for (unsigned int i = 0 ; i < tap -> expected_ids_cnt ; i ++ ) {
1203
1204
char msg [32 ];
1204
1205
1205
- snprintf (msg , sizeof (msg ), "expected %u of %u" , ii + 1 , tap -> expected_ids_cnt );
1206
+ snprintf (msg , sizeof (msg ), "expected %u of %u" , i + 1 , tap -> expected_ids_cnt );
1206
1207
jtag_examine_chain_display (LOG_LVL_ERROR , msg ,
1207
- tap -> dotted_name , tap -> expected_ids [ii ]);
1208
+ tap -> dotted_name , tap -> expected_ids [i ]);
1208
1209
}
1209
1210
return false;
1210
1211
}
@@ -1215,7 +1216,7 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap)
1215
1216
static int jtag_examine_chain (void )
1216
1217
{
1217
1218
int retval ;
1218
- unsigned max_taps = jtag_tap_count ();
1219
+ unsigned int max_taps = jtag_tap_count ();
1219
1220
1220
1221
/* Autoprobe up to this many. */
1221
1222
if (max_taps < JTAG_MAX_AUTO_TAPS )
@@ -1243,9 +1244,9 @@ static int jtag_examine_chain(void)
1243
1244
/* Point at the 1st predefined tap, if any */
1244
1245
struct jtag_tap * tap = jtag_tap_next_enabled (NULL );
1245
1246
1246
- unsigned bit_count = 0 ;
1247
- unsigned autocount = 0 ;
1248
- for (unsigned i = 0 ; i < max_taps ; i ++ ) {
1247
+ unsigned int bit_count = 0 ;
1248
+ unsigned int autocount = 0 ;
1249
+ for (unsigned int i = 0 ; i < max_taps ; i ++ ) {
1249
1250
assert (bit_count < max_taps * 32 );
1250
1251
uint32_t idcode = buf_get_u32 (idcode_buffer , bit_count , 32 );
1251
1252
@@ -1445,8 +1446,8 @@ static int jtag_validate_ircapture(void)
1445
1446
1446
1447
void jtag_tap_init (struct jtag_tap * tap )
1447
1448
{
1448
- unsigned ir_len_bits ;
1449
- unsigned ir_len_bytes ;
1449
+ unsigned int ir_len_bits ;
1450
+ unsigned int ir_len_bytes ;
1450
1451
1451
1452
/* if we're autoprobing, cope with potentially huge ir_length */
1452
1453
ir_len_bits = tap -> ir_length ? tap -> ir_length : JTAG_IRLEN_MAX ;
@@ -1749,37 +1750,36 @@ int jtag_get_srst(void)
1749
1750
return jtag_srst == 1 ;
1750
1751
}
1751
1752
1752
- void jtag_set_nsrst_delay (unsigned delay )
1753
+ void jtag_set_nsrst_delay (unsigned int delay )
1753
1754
{
1754
1755
adapter_nsrst_delay = delay ;
1755
1756
}
1756
- unsigned jtag_get_nsrst_delay (void )
1757
+ unsigned int jtag_get_nsrst_delay (void )
1757
1758
{
1758
1759
return adapter_nsrst_delay ;
1759
1760
}
1760
- void jtag_set_ntrst_delay (unsigned delay )
1761
+ void jtag_set_ntrst_delay (unsigned int delay )
1761
1762
{
1762
1763
jtag_ntrst_delay = delay ;
1763
1764
}
1764
- unsigned jtag_get_ntrst_delay (void )
1765
+ unsigned int jtag_get_ntrst_delay (void )
1765
1766
{
1766
1767
return jtag_ntrst_delay ;
1767
1768
}
1768
1769
1769
-
1770
- void jtag_set_nsrst_assert_width (unsigned delay )
1770
+ void jtag_set_nsrst_assert_width (unsigned int delay )
1771
1771
{
1772
1772
adapter_nsrst_assert_width = delay ;
1773
1773
}
1774
- unsigned jtag_get_nsrst_assert_width (void )
1774
+ unsigned int jtag_get_nsrst_assert_width (void )
1775
1775
{
1776
1776
return adapter_nsrst_assert_width ;
1777
1777
}
1778
- void jtag_set_ntrst_assert_width (unsigned delay )
1778
+ void jtag_set_ntrst_assert_width (unsigned int delay )
1779
1779
{
1780
1780
jtag_ntrst_assert_width = delay ;
1781
1781
}
1782
- unsigned jtag_get_ntrst_assert_width (void )
1782
+ unsigned int jtag_get_ntrst_assert_width (void )
1783
1783
{
1784
1784
return jtag_ntrst_assert_width ;
1785
1785
}
0 commit comments