@ -167,8 +167,10 @@ siz_ (int sz)
* low - level dma write
*
*/
/* @@@@ RFHH Add a parameter bus on the assumption that the code doesn't
* really want to access the global variable urj_bus_t * bus */
static void
ejtag_dma_write ( unsigned int addr , unsigned int data , int sz )
ejtag_dma_write ( u rj_bus_t * bus , u nsigned int addr , unsigned int data , int sz )
{
static urj_data_register_t * ejctrl = NULL ;
static urj_data_register_t * ejaddr = NULL ;
@ -260,8 +262,10 @@ ejtag_dma_write (unsigned int addr, unsigned int data, int sz)
* low level dma read operation
*
*/
/* @@@@ RFHH Add a parameter bus on the assumption that the code doesn't
* really want to access the global variable urj_bus_t * bus */
static unsigned int
ejtag_dma_read ( unsigned int addr , int sz )
ejtag_dma_read ( u rj_bus_t * bus , u nsigned int addr , int sz )
{
static urj_data_register_t * ejctrl = NULL ;
static urj_data_register_t * ejaddr = NULL ;
@ -497,16 +501,16 @@ ejtag_dma_bus_init (urj_bus_t *bus)
// Clear Memory Protection Bit in DCR
printf ( _ ( " Clear memory protection bit in DCR \n " ) ) ;
unsigned int val = ejtag_dma_read ( 0xff300000 , DMA_WORD ) ;
ejtag_dma_write ( 0xff300000 , val & ~ ( 1 < < 2 ) , DMA_WORD ) ;
unsigned int val = ejtag_dma_read ( bus , 0xff300000 , DMA_WORD ) ;
ejtag_dma_write ( bus , 0xff300000 , val & ~ ( 1 < < 2 ) , DMA_WORD ) ;
// Clear watchdog, if any
printf ( _ ( " Clear Watchdog \n " ) ) ;
ejtag_dma_write ( 0xb8000080 , 0 , DMA_WORD ) ;
ejtag_dma_write ( bus , 0xb8000080 , 0 , DMA_WORD ) ;
printf ( _ ( " Potential flash base address: [0x%x], [0x%x] \n " ) ,
ejtag_dma_read ( 0xfffe2000 , DMA_WORD ) , ejtag_dma_read ( 0xfffe1000 ,
DMA_WORD ) ) ;
ejtag_dma_read ( bus , 0xfffe2000 , DMA_WORD ) ,
ejtag_dma_read ( bus , 0xfffe1000 , DMA_WORD ) ) ;
printf ( _ ( " Processor successfully switched in debug mode. \n " ) ) ;
@ -617,7 +621,7 @@ static void
ejtag_dma_bus_write ( urj_bus_t * bus , uint32_t adr , uint32_t data )
{
//printf("%s:adr=0x%x,data=0x%x\n",__FUNCTION__,adr,data);
ejtag_dma_write ( adr, data , get_sz ( adr ) ) ;
ejtag_dma_write ( bus, adr, data , get_sz ( adr ) ) ;
}
/**
@ -627,7 +631,7 @@ ejtag_dma_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
static unsigned int
ejtag_dma_bus_read ( urj_bus_t * bus , uint32_t adr )
{
int data = ejtag_dma_read ( adr, get_sz ( adr ) ) ;
int data = ejtag_dma_read ( bus, adr, get_sz ( adr ) ) ;
//printf("%s:adr=0x%x,got=0x%x\n",__FUNCTION__,adr,data);
return data ;
}
@ -640,7 +644,7 @@ static unsigned int _data_read;
static void
ejtag_dma_bus_read_start ( urj_bus_t * bus , uint32_t adr )
{
_data_read = ejtag_dma_read ( adr, get_sz ( adr ) ) ;
_data_read = ejtag_dma_read ( bus, adr, get_sz ( adr ) ) ;
//printf("%s:adr=0x%x, got=0x%x\n",__FUNCTION__,adr,_data_read);
return ;
}
@ -653,7 +657,7 @@ static unsigned int
ejtag_dma_bus_read_next ( urj_bus_t * bus , uint32_t adr )
{
unsigned int tmp_value = _data_read ;
_data_read = ejtag_dma_read ( adr, get_sz ( adr ) ) ;
_data_read = ejtag_dma_read ( bus, adr, get_sz ( adr ) ) ;
//printf("%s:adr=0x%x, got=0x%x\n",__FUNCTION__,adr,_data_read);
return tmp_value ;
}