@@ -135,6 +135,7 @@ static struct debug_command debug_commands[] = {
135
135
" -d Dump internal ram\n"
136
136
" -w addr:val Set RAM [addr] to value [val]\n"
137
137
" -i addr Invert RAM contents\n"
138
+ " -n addr Set register [addr] to random value\n"
138
139
" -r addr Read RAM [addr]\n"
139
140
" -x addr Read 32-bit register [addr]\n"
140
141
,
@@ -147,6 +148,7 @@ static struct debug_command debug_commands[] = {
147
148
" -d Dump special function registers\n"
148
149
" -w sfr:val Set SFR [sfr] to value [val]\n"
149
150
" -i addr Invert RAM contents\n"
151
+ " -n addr Set register [addr] to random value\n"
150
152
" -r sfr Read SFR [sfr]\n"
151
153
" -x sfr Read extended (quad-wide-wide) sfr\n"
152
154
,
@@ -173,7 +175,7 @@ static struct debug_command debug_commands[] = {
173
175
{
174
176
.name = "irq" ,
175
177
.func = dbg_do_irq ,
176
- .desc = "Manipulate IRQs on the AX215\n " ,
178
+ .desc = "Manipulate IRQs on the AX215" ,
177
179
.help = "Usage: irq [-r] [-m mask] [-p]\n"
178
180
" -r Reset IRQ statistics\n"
179
181
" -p Print IRQ statistics\n"
@@ -183,7 +185,7 @@ static struct debug_command debug_commands[] = {
183
185
{
184
186
.name = "gpio" ,
185
187
.func = dbg_do_gpio ,
186
- .desc = "Set/query GPIO values\n " ,
188
+ .desc = "Set/query GPIO values" ,
187
189
.help = "Usage: gpio [-d] [-i DATpin] [-o DATpin] [-s/-c DATpin]\n"
188
190
" -d Dump GPIO values\n"
189
191
" -i x Make DATx a GPIO input\n"
@@ -330,7 +332,7 @@ static int dbg_do_sfr(struct dbg *dbg, int argc, char **argv) {
330
332
if (!strcmp (argv [0 ], "sfr" ))
331
333
offset = 0x80 ;
332
334
333
- while ((ch = getopt (argc , argv , "di:w:r:x:" )) != -1 ) {
335
+ while ((ch = getopt (argc , argv , "di:w:r:x:n: " )) != -1 ) {
334
336
switch (ch ) {
335
337
case 'd' :
336
338
for (sfr = 0 ; sfr <= 127 ; sfr ++ ) {
@@ -392,6 +394,27 @@ static int dbg_do_sfr(struct dbg *dbg, int argc, char **argv) {
392
394
}
393
395
break ;
394
396
397
+ case 'n' : {
398
+ int sfr = strtoul (optarg , NULL , 0 );
399
+ int val ;
400
+ if (offset && (sfr < 0x80 || sfr > 0xff )) {
401
+ printf ("Invalid SFR. "
402
+ "SFR addresses go between 0x80 and 0xff\n" );
403
+ return - EINVAL ;
404
+ }
405
+ if (!offset && (sfr < 0x00 || sfr > 0x7f )) {
406
+ printf ("Invalid RAM address. "
407
+ "RAM addresses go between 0x00 and 0x7f\n" );
408
+ return - EINVAL ;
409
+ }
410
+
411
+ val = rand () & 0xff ;
412
+ printf ("Setting %s_%02x 0x%02x -> %02x\n" ,
413
+ offset ?"SFR" :"RAM" , sfr , ram_get (dbg , sfr ), val );
414
+ ram_set (dbg , sfr , val );
415
+ }
416
+ break ;
417
+
395
418
case 'x' :
396
419
case 'r' : {
397
420
uint8_t cmd [4 ];
@@ -1067,7 +1090,11 @@ static int install_isrs(struct dbg *dbg) {
1067
1090
ram_set (dbg , 0xfb , 0 ); // Reset count
1068
1091
printf ("UNK " );
1069
1092
1070
- printf ("] Okay\n" );
1093
+ printf ("] " );
1094
+ printf ("Enabling... " );
1095
+ ram_set (dbg , 0xa8 , 0xff );
1096
+
1097
+ printf ("Okay\n" );
1071
1098
return 0 ;
1072
1099
}
1073
1100
0 commit comments