2003-09-23 Marcel Telka <marcel@telka.sk>

* src/flash.c (flash_drivers): Added amd_16_flash_driver (Bradley D. LaRonde).
	(find_block): New function (Bradley D. LaRonde).
	(flashmem): Added block calculations using exact CFI data (Bradley D. LaRonde).

	* src/tap/cable/triton.c (triton_init): Removed unused variable 'data'.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@570 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 21 years ago
parent 414b50e704
commit bd55feaba6

@ -1,3 +1,11 @@
2003-09-23 Marcel Telka <marcel@telka.sk>
* src/flash.c (flash_drivers): Added amd_16_flash_driver (Bradley D. LaRonde).
(find_block): New function (Bradley D. LaRonde).
(flashmem): Added block calculations using exact CFI data (Bradley D. LaRonde).
* src/tap/cable/triton.c (triton_init): Removed unused variable 'data'.
2003-09-15 Marcel Telka <marcel@telka.sk>
* configure.ac: Fixed spelling (patch 805108, Andreas Mohr).

@ -12,6 +12,7 @@ jtag-0.5.1:
* Used real data bus width for data reading in PXA2x0, SA1110, and SH7727 bus drivers
(based on patch 792591, thanks to Guennadi Liakhovetski).
* Added 'initbus' command to allow dynamic bus driver loading.
* Added support for flashes with multiple block erase regions for 'flashmem' (Bradley D. LaRonde).
* Added BOOT_DEF register emulation for PXA2x0 bus driver.
* Fixed inverted TRST signal for Macraigor Wiggler JTAG Cable see patch 799377 for more info,
thanks to Mike Tesch for reporting).

@ -12,6 +12,7 @@ Jachym Holecek
August Hörandl
Rojhalat Ibrahim
Stas Khirman
Bradley D. LaRonde
Guennadi Liakhovetski
Andreas Mohr
Brad Parker

@ -47,6 +47,7 @@
#include "jtag.h"
extern flash_driver_t amd_32_flash_driver;
extern flash_driver_t amd_16_flash_driver;
extern flash_driver_t amd_8_flash_driver;
extern flash_driver_t intel_32_flash_driver;
extern flash_driver_t intel_16_flash_driver;
@ -54,6 +55,7 @@ extern flash_driver_t intel_8_flash_driver;
flash_driver_t *flash_drivers[] = {
&amd_32_flash_driver,
&amd_16_flash_driver,
&amd_8_flash_driver,
&intel_32_flash_driver,
&intel_16_flash_driver,
@ -232,6 +234,26 @@ flashmsbin( bus_t *bus, FILE *f )
cfi_array_free( cfi_array );
}
static int
find_block( cfi_query_structure_t *cfi, int adr )
{
int i;
int b = 0;
int bb = 0;
for (i = 0; i < cfi->device_geometry.number_of_erase_regions; i++) {
const int region_blocks = cfi->device_geometry.erase_block_regions[i].number_of_erase_blocks;
const int region_block_size = cfi->device_geometry.erase_block_regions[i].erase_block_size;
const int region_size = region_blocks * region_block_size;
if (adr < (bb + region_size))
return b + ((adr - bb) / region_block_size);
b += region_blocks;
bb += region_size;
}
return -1;
}
void
flashmem( bus_t *bus, FILE *f, uint32_t addr )
{
@ -240,6 +262,7 @@ flashmem( bus_t *bus, FILE *f, uint32_t addr )
cfi_array_t *cfi_array;
int *erased;
int i;
int neb;
flashcheck( bus, &cfi_array );
if (!cfi_array || !flash_driver) {
@ -248,12 +271,15 @@ flashmem( bus_t *bus, FILE *f, uint32_t addr )
}
cfi = &cfi_array->cfi_chips[0]->cfi;
erased = malloc( cfi->device_geometry.erase_block_regions[0].number_of_erase_blocks * sizeof *erased );
for (i = 0, neb = 0; i < cfi->device_geometry.number_of_erase_regions; i++)
neb += cfi->device_geometry.erase_block_regions[i].number_of_erase_blocks;
erased = malloc( neb * sizeof *erased );
if (!erased) {
printf( _("Out of memory!\n") );
return;
}
for (i = 0; i < cfi->device_geometry.erase_block_regions[0].number_of_erase_blocks; i++)
for (i = 0; i < neb; i++)
erased[i] = 0;
printf( _("program:\n") );
@ -263,7 +289,7 @@ flashmem( bus_t *bus, FILE *f, uint32_t addr )
#define BSIZE 4096
uint8_t b[BSIZE];
int bc = 0, bn = 0;
int block_no = adr / (cfi->device_geometry.erase_block_regions[0].erase_block_size * flash_driver->bus_width / 2);
int block_no = find_block( cfi, adr );
if (!erased[block_no]) {
flash_driver->unlock_block( cfi_array, adr );

@ -68,8 +68,6 @@
static int
triton_init( cable_t *cable )
{
int data;
if (parport_open( cable->port ))
return -1;

Loading…
Cancel
Save