Curious as to why someone left an unused 'unsigned short i' in .../logi-apps/wishbone/sw/read_wishbone.c I figured it had to have been an original counter value (.i.e., number of words to read index).
So I modified the code (shown below) to be able to read (if specified) multiple words from the command line (i.e., "./read_wishbone 0x0000 20". )
Modified main() function from ../logi-apps/wishbone/sw/read_wishbone.c:
--------------------------------------------------------------------------------------------------------
int main(int argc, char ** argv){
int fd, address, words=1 ;
unsigned short i ;
unsigned short readVal[256];
if(argc < 1){
printf("not enough arguments \n");
return 0 ;
}
address = (int) strtol(argv[1], NULL, 0);
if ( argc > 2 ) words = (int) strtol(argv[2], NULL, 0);
if ( words > 256 ) words = 256;
wishbone_read((char*)readVal, words*2, address);
for( i=0; i < words; i++ )
{
printf("0x%x 0x%x \n", address+i, readVal[i]);
}
return 0 ;
}
Comments