From bc5bc0e45addcd1dcabbefd9120401a0c658109d Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Fri, 24 Apr 2009 09:28:47 +0000 Subject: [PATCH] src/flash/amd_flash.c, src/bus/ejtag.c, src/bus/ejtag_dma.c: fix erroneous reference to global variable 'bus' to be to a local variable/parameter git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1526 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 ++++ jtag/src/bus/ejtag.c | 6 +++--- jtag/src/bus/ejtag_dma.c | 20 ++++++++++---------- jtag/src/flash/amd_flash.c | 4 ++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 34e5f692..d551db14 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,7 @@ +2009-04-24 Rutger Hofman + * src/flash/amd_flash.c, src/bus/ejtag.c, src/bus/ejtag_dma.c: fix erroneous + reference to global variable 'bus' to be to a local variable/parameter. + 2009-04-17 Kolja Waschk * Makefile.am: Distribute UrJTAG.nsi in source tarball next time diff --git a/jtag/src/bus/ejtag.c b/jtag/src/bus/ejtag.c index 369df152..9c8933af 100644 --- a/jtag/src/bus/ejtag.c +++ b/jtag/src/bus/ejtag.c @@ -546,7 +546,7 @@ ejtag_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) } static int -ejtag_gen_read( uint32_t *code, uint32_t adr ) +ejtag_gen_read( bus_t *bus, uint32_t *code, uint32_t adr ) { uint16_t adr_hi, adr_lo; uint32_t *p = code; @@ -590,7 +590,7 @@ ejtag_bus_read_start( bus_t *bus, uint32_t adr ) { uint32_t code[3]; - ejtag_run_pracc( bus, code, ejtag_gen_read( code, adr )); + ejtag_run_pracc( bus, code, ejtag_gen_read( bus, code, adr )); // printf("bus_read_start: adr=0x%08x\n", adr); } @@ -605,7 +605,7 @@ ejtag_bus_read_next( bus_t *bus, uint32_t adr ) uint32_t code[4], *p = code; *p++ = 0xac820000; // sw $2,0($4) - p += ejtag_gen_read( p, adr ); + p += ejtag_gen_read( bus, p, adr ); d = ejtag_run_pracc( bus, code, p - code ); diff --git a/jtag/src/bus/ejtag_dma.c b/jtag/src/bus/ejtag_dma.c index 9881dba5..4d7c95d7 100644 --- a/jtag/src/bus/ejtag_dma.c +++ b/jtag/src/bus/ejtag_dma.c @@ -157,7 +157,7 @@ char siz_(int sz) * low-level dma write * */ -static void ejtag_dma_write(unsigned int addr, unsigned int data,int sz) +static void ejtag_dma_write(bus_t *bus, unsigned int addr, unsigned int data,int sz) { static data_register *ejctrl = NULL; static data_register *ejaddr = NULL; @@ -240,7 +240,7 @@ static void ejtag_dma_write(unsigned int addr, unsigned int data,int sz) * low level dma read operation * */ -static unsigned int ejtag_dma_read(unsigned int addr,int sz) +static unsigned int ejtag_dma_read(bus_t *bus, unsigned int addr,int sz) { static data_register *ejctrl = NULL; static data_register *ejaddr = NULL; @@ -444,15 +444,15 @@ int ejtag_dma_bus_init( 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")); @@ -542,7 +542,7 @@ int get_sz(uint32_t adr) void ejtag_dma_bus_write(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)); } /** * bus->driver->(*read) @@ -550,7 +550,7 @@ void ejtag_dma_bus_write(bus_t *bus, uint32_t adr, uint32_t data) */ unsigned int ejtag_dma_bus_read(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; } @@ -562,7 +562,7 @@ static unsigned int _data_read; */ void ejtag_dma_bus_read_start(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; } @@ -573,7 +573,7 @@ void ejtag_dma_bus_read_start(bus_t *bus, uint32_t adr) unsigned int ejtag_dma_bus_read_next(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; } diff --git a/jtag/src/flash/amd_flash.c b/jtag/src/flash/amd_flash.c index 65ce01f1..8217c0d9 100644 --- a/jtag/src/flash/amd_flash.c +++ b/jtag/src/flash/amd_flash.c @@ -255,8 +255,8 @@ static void amd_29xx040_read_array( cfi_array_t *cfi_array ) /* Read Array */ if(var_forced_detection.unlock_bypass == AMD_BYPASS_UNLOCK_MODE) { - bus_write( bus, cfi_array->address + 0x555, 0x90 ); - bus_write( bus, cfi_array->address + 0x2AA, 0x00 ); + bus_write( cfi_array->bus, cfi_array->address + 0x555, 0x90 ); + bus_write( cfi_array->bus, cfi_array->address + 0x2AA, 0x00 ); usleep(100); var_forced_detection.unlock_bypass = AMD_STANDARD_MODE; }