@ -125,7 +125,7 @@ ejtag_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
if ( ! bus )
{
urj_error_set ( URJ_ERROR_OUT_OF_MEMORY , " calloc(%zd,%zd) fails " ,
1 , sizeof ( urj_bus_t ) ) ;
( size_t ) 1 , sizeof ( urj_bus_t ) ) ;
return NULL ;
}
@ -135,7 +135,7 @@ ejtag_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
{
free ( bus ) ;
urj_error_set ( URJ_ERROR_OUT_OF_MEMORY , " calloc(%zd,%zd) fails " ,
1 , sizeof ( bus_params_t ) ) ;
( size_t ) 1 , sizeof ( bus_params_t ) ) ;
return NULL ;
}
@ -230,8 +230,8 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len)
addr = reg_value ( ejaddr - > out ) ;
if ( addr & 3 )
{
printf ( _ ( " %s(%d) PrAcc bad alignment: addr=0x%08 x\n " ) ,
__FILE__ , __LINE__ , addr ) ;
printf ( _ ( " %s(%d) PrAcc bad alignment: addr=0x%08 l x\n " ) ,
__FILE__ , __LINE__ , ( long unsigned ) addr ) ;
addr & = ~ 3 ;
}
@ -245,7 +245,7 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len)
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ;
data = reg_value ( ejdata - > out ) ;
#if 0
printf ( _ ( " %s(%d) PrAcc write: addr=0x%08 x data=0x%08x\n " ) ,
printf ( _ ( " %s(%d) PrAcc write: addr=0x%08 l x data=0x%08l x\n " ) ,
__FILE__ , __LINE__ , addr , data ) ;
# endif
if ( addr = = UINT32_C ( 0xff200000 ) )
@ -255,8 +255,9 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len)
}
else
{
printf ( _ ( " %s(%d) Unknown write addr=0x%08x data=0x%08x \n " ) ,
__FILE__ , __LINE__ , addr , data ) ;
printf ( _ ( " %s(%d) Unknown write addr=0x%08lx data=0x%08lx \n " ) ,
__FILE__ , __LINE__ , ( long unsigned ) addr ,
( long unsigned ) data ) ;
}
}
else
@ -273,7 +274,7 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len)
ejdata - > in - > data [ i ] = ( data > > i ) & 1 ;
}
#if 0
printf ( " %s(%d) PrAcc read: addr=0x%08 x data=0x%08x\n " ,
printf ( " %s(%d) PrAcc read: addr=0x%08 l x data=0x%08l x\n " ,
__FILE__ , __LINE__ , addr , data ) ;
# endif
urj_tap_chain_shift_data_registers ( bus - > chain , 0 ) ;
@ -324,8 +325,8 @@ ejtag_bus_init (urj_bus_t *bus)
urj_tap_chain_shift_instructions ( bus - > chain ) ;
urj_tap_chain_shift_data_registers ( bus - > chain , 0 ) ; //Write
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //Read
printf ( " ImpCode=%s %08 X\n " , urj_tap_register_get_string ( ejimpl - > out ) ,
reg_value ( ejimpl - > out ) ) ;
printf ( " ImpCode=%s %08 l X\n " , urj_tap_register_get_string ( ejimpl - > out ) ,
( long unsigned ) reg_value ( ejimpl - > out ) ) ;
BP - > impcode = reg_value ( ejimpl - > out ) ;
switch ( EJTAG_VER )
@ -343,7 +344,7 @@ ejtag_bus_init (urj_bus_t *bus)
printf ( " EJTAG version: 3.1 \n " ) ;
break ;
default :
printf ( " EJTAG version: unknown (% d )\n " , EJTAG_VER ) ;
printf ( " EJTAG version: unknown (% lu )\n " , EJTAG_VER ) ;
}
printf ( " EJTAG Implementation flags:%s%s%s%s%s%s%s \n " ,
( BP - > impcode & ( 1 < < 28 ) ) ? " R3k " : " R4k " ,
@ -382,7 +383,7 @@ ejtag_bus_init (urj_bus_t *bus)
//Set to Debug Control Register Address, 0xFF300000
urj_tap_register_init ( ejaddr - > in ,
" 11111111001100000000000000000000 " ) ;
// printf("Write to ejaddr->in =%s %08 X\n",urj_tap_register_get_string( ejaddr->in),reg_value( ejaddr->in ) );
// printf("Write to ejaddr->in =%s %08 l X\n",urj_tap_register_get_string( ejaddr->in),reg_value( ejaddr->in ) );
urj_tap_chain_shift_data_registers ( bus - > chain , 0 ) ; //Write
// printf("Select EJTAG CONTROL Register\n");
urj_part_set_instruction ( bus - > part , " EJTAG_CONTROL " ) ;
@ -396,8 +397,8 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl - > in - > data [ DrWn ] = 1 ; // 9-------|
ejctrl - > in - > data [ Dsz1 ] = 1 ; // 8-------| DMA_WORD = 0x00000100 = Bit8
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //WriteRead
// printf("Write To ejctrl->in =%s %08 X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
// printf("Write To ejctrl->in =%s %08 l X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 l X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
do
{
// printf("Wait for DStrt to clear\n");
@ -409,8 +410,8 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl - > in - > data [ DmaAcc ] = 1 ; // 17----||
ejctrl - > in - > data [ ProbEn ] = 1 ; // 15-----|
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //WriteRead
// printf("Write To ejctrl->in =%s %08 X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
// printf("Write To ejctrl->in =%s %08 l X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 l X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
}
while ( ejctrl - > out - > data [ DStrt ] = = 1 ) ;
// printf("Select EJTAG DATA Register\n");
@ -418,8 +419,8 @@ ejtag_bus_init (urj_bus_t *bus)
urj_tap_chain_shift_instructions ( bus - > chain ) ;
urj_tap_register_fill ( ejdata - > in , 0 ) ; // Clear Register
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //WriteRead
// printf( "Write To ejdata->in =%s %08 X\n", urj_tap_register_get_string( ejdata->in), reg_value( ejdata->in ) );
// printf( "Read From ejdata->out =%s %08 X\n", urj_tap_register_get_string( ejdata->out),reg_value( ejdata->out ) );
// printf( "Write To ejdata->in =%s %08 l X\n", urj_tap_register_get_string( ejdata->in), reg_value( ejdata->in ) );
// printf( "Read From ejdata->out =%s %08 l X\n", urj_tap_register_get_string( ejdata->out),reg_value( ejdata->out ) );
// printf("Select EJTAG CONTROL Register\n");
urj_part_set_instruction ( bus - > part , " EJTAG_CONTROL " ) ;
urj_tap_chain_shift_instructions ( bus - > chain ) ;
@ -428,8 +429,8 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl - > in - > data [ PrAcc ] = 1 ; // 18----||
ejctrl - > in - > data [ ProbEn ] = 1 ; // 15-----|
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //WriteRead
// printf("Write To ejctrl->in =%s %08 X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
// printf("Write To ejctrl->in =%s %08 l X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 l X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
if ( ejctrl - > out - > data [ DeRR ] = = 1 )
{
printf ( " DMA READ ERROR \n " ) ;
@ -438,7 +439,7 @@ ejtag_bus_init (urj_bus_t *bus)
urj_tap_register_init ( ejdata - > in ,
urj_tap_register_get_string ( ejdata - > out ) ) ;
ejdata - > in - > data [ MemProt ] = 0 ;
// printf( "Need to Write ejdata-> =%s %08 X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) );
// printf( "Need to Write ejdata-> =%s %08 l X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) );
// Now the Write
// printf("Set Address To Write To\n");
@ -447,14 +448,14 @@ ejtag_bus_init (urj_bus_t *bus)
urj_tap_chain_shift_instructions ( bus - > chain ) ;
urj_tap_register_init ( ejaddr - > in ,
" 11111111001100000000000000000000 " ) ;
// printf("Write to ejaddr->in =%s %08 X\n",urj_tap_register_get_string( ejaddr->in), reg_value( ejaddr->in ) );
// printf("Write to ejaddr->in =%s %08 l X\n",urj_tap_register_get_string( ejaddr->in), reg_value( ejaddr->in ) );
//This appears to be a write with NO Read
urj_tap_chain_shift_data_registers ( bus - > chain , 0 ) ; //Write
// printf("Select EJTAG DATA Register\n");
urj_part_set_instruction ( bus - > part , " EJTAG_DATA " ) ;
urj_tap_chain_shift_instructions ( bus - > chain ) ;
//The value is already in ejdata->in, so write it
// printf("Write To ejdata->in =%s %08 X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) );
// printf("Write To ejdata->in =%s %08 l X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) );
urj_tap_chain_shift_data_registers ( bus - > chain , 0 ) ; //Write
// printf("Select EJTAG CONTROL Register\n");
urj_part_set_instruction ( bus - > part , " EJTAG_CONTROL " ) ;
@ -468,8 +469,8 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl - > in - > data [ ProbEn ] = 1 ; // 15
ejctrl - > in - > data [ PrAcc ] = 1 ; // 18
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //Write/Read
// printf("Write to ejctrl->in =%s %08 X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08 X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) );
// printf("Write to ejctrl->in =%s %08 l X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08 l X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) );
do
{
// printf("Wait for DStrt to clear\n");
@ -480,8 +481,8 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl - > in - > data [ ProbEn ] = 1 ; // 15
ejctrl - > in - > data [ PrAcc ] = 1 ; // 18
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //Write/Read
// printf("Write to ejctrl->in =%s %08 X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08 X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) );
// printf("Write to ejctrl->in =%s %08 l X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08 l X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) );
}
while ( ejctrl - > out - > data [ DStrt ] = = 1 ) ;
// printf("Select EJTAG CONTROL Register\n");
@ -492,8 +493,8 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl - > in - > data [ PrAcc ] = 1 ; // 18----||
ejctrl - > in - > data [ ProbEn ] = 1 ; // 15-----|
urj_tap_chain_shift_data_registers ( bus - > chain , 1 ) ; //Write/Read
// printf("Write To ejctrl->in =%s %08 X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
// printf("Write To ejctrl->in =%s %08 l X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08 l X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
if ( ejctrl - > out - > data [ DeRR ] = = 1 )
{
printf ( " DMA WRITE ERROR \n " ) ;
@ -648,7 +649,7 @@ ejtag_bus_read_start (urj_bus_t *bus, uint32_t adr)
uint32_t code [ 3 ] ;
ejtag_run_pracc ( bus , code , ejtag_gen_read ( bus , code , adr ) ) ;
// printf("URJ_BUS_READ_START: adr=0x%08 x\n", adr);
// printf("URJ_BUS_READ_START: adr=0x%08 l x\n", adr);
}
/**
@ -666,7 +667,7 @@ ejtag_bus_read_next (urj_bus_t *bus, uint32_t adr)
d = ejtag_run_pracc ( bus , code , p - code ) ;
// printf("URJ_BUS_READ_NEXT: adr=0x%08 x data=0x%08x\n", adr, d);
// printf("URJ_BUS_READ_NEXT: adr=0x%08 l x data=0x%08l x\n", adr, d);
return d ;
}
@ -685,7 +686,7 @@ ejtag_bus_read_end (urj_bus_t *bus)
d = ejtag_run_pracc ( bus , code , 2 ) ;
// printf("URJ_BUS_READ_END: data=0x%08 x\n", d);
// printf("URJ_BUS_READ_END: data=0x%08 l x\n", d);
return d ;
}
@ -728,7 +729,7 @@ ejtag_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
ejtag_run_pracc ( bus , code , p - code ) ;
// printf("URJ_BUS_WRITE: adr=0x%08 x data=0x%08x\n", adr, data);
// printf("URJ_BUS_WRITE: adr=0x%08 l x data=0x%08l x\n", adr, data);
}
const urj_bus_driver_t urj_bus_ejtag_bus = {