You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

336 lines
7.9 KiB
C

/*
* $Id$
*
* Copyright (C) 2002 ETC s.r.o.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by Marcel Telka <marcel@telka.sk>, 2002.
*
* Documentation:
* [1] Advanced Micro Devices, "Common Flash Memory Interface Specification Release 2.0",
* December 1, 2001
* [2] Intel Corporation, "Intel PXA250 and PXA210 Application Processors
* Developer's Manual", February 2002, Order Number: 278522-001
* [3] Intel Corporation, "Common Flash Interface (CFI) and Command Sets
* Application Note 646", April 2000, Order Number: 292204-004
* [4] Advanced Micro Devices, "Common Flash Memory Interface Publication 100 Vendor & Device
* ID Code Assignments", December 1, 2001, Volume Number: 96.1
*
*/
#include <config.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <flash/cfi.h>
#include <flash/intel.h>
#include <brux/cfi.h>
#include "bus.h"
#include "flash.h"
#include "jtag.h"
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
extern flash_driver_t amd_32_flash_driver;
extern flash_driver_t intel_32_flash_driver;
extern flash_driver_t intel_16_flash_driver;
flash_driver_t *flash_drivers[] = {
&amd_32_flash_driver,
&intel_32_flash_driver,
&intel_16_flash_driver,
NULL
};
flash_driver_t *flash_driver = NULL;
static void
set_flash_driver( cfi_array_t *cfi_array )
{
int i;
cfi_query_structure_t *cfi = &cfi_array->cfi_chips[0]->cfi;
flash_driver = NULL;
for (i = 0; flash_drivers[i] != NULL; i++)
if (flash_drivers[i]->autodetect( cfi_array )) {
flash_driver = flash_drivers[i];
return;
}
printf( _("unknown flash - vendor id: %d (0x%04x)\n"),
cfi->identification_string.pri_id_code,
cfi->identification_string.pri_id_code );
}
/* check for flashmem - set driver */
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
static void
flashcheck( bus_t *bus, cfi_array_t **cfi_array )
{
flash_driver = NULL;
2003-04-29 Marcel Telka <marcel@telka.sk> * data/MANUFACTURERS: Added new manufacturer: DEC. * src/jtag.c (jtag_create_jtagdir): Changed permissions for jtag directory. * include/part.h (part_alloc, read_part): Changed return type from `part *' to `part_t *'. (struct parts): Changed parts member type from `part **' to `part_t **'. (parts_alloc): Changed return type from `parts *' to `parts_t *'. * src/bus/ixp425.c (select_flash, unselect_flash, setup_address, set_data_in, setup_data): Changed first parameter type from `part *' to `part_t *'. * src/bus/pxa250.c (setup_address, set_data_in, setup_data): Ditto. * src/bus/sa1110.c (setup_address, set_data_in, setup_data): Ditto. * include/bus.h: Replaced static bus_driver_t architecture with dynamic bus_t. Removed direct chain_t dependency. Added `params' and `prepare' members. All related functions' parameter types changed. * src/bus/ixp425.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (ixp425_bus_prepare, ixp425_bus_free, new_ixp425_bus): New functions. (ixp425_bus_driver, ixp425_bus): Renamed `ixp425_bus_driver' to `ixp425_bus' and updated for new bus driver architecture. * src/bus/pxa250.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (pxa250_bus_prepare, pxa250_bus_free, new_pxa250_bus): New functions. (pxa250_bus_driver, pxa250_bus): Renamed `pxa250_bus_driver' to `pxa250_bus' and updated for new bus driver architecture. * src/bus/sa1110.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (sa1110_bus_prepare, sa1110_bus_free, new_sa1110_bus): New functions. (sa1110_bus_driver, sa1110_bus): Renamed `sa1110_bus_driver' to `sa1110_bus' and updated for new bus driver architecture. * src/readmem.c (detectflash, readmem): Moved JTAG chain initialization to bus->prepare(). * src/flash.c (flashcheck): Ditto. (flashmsbin, flashmem): Removed BYPASS instruction setup. * src/jtag.c (bus_driver, bus): Replaced `bus_driver' with `bus' global variable. (jtag_parse_line, main): Added `bus' deallocation. * src/flash.h (flash_driver_t): Changed parameter type for all function members from `chain_t*' to `bus_t *'. All function callers changed. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@423 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
bus_prepare( bus );
printf( _("Note: Supported configuration is 2 x 16 bit or 1 x 16 bit only\n") );
*cfi_array = NULL;
if (cfi_detect( bus, 0, cfi_array )) {
cfi_array_free( *cfi_array );
printf( _("Flash not found!\n") );
return;
}
set_flash_driver( *cfi_array );
if (!flash_driver) {
printf( _("Flash not supported!\n") );
return;
}
flash_driver->print_info( *cfi_array );
}
void
2003-04-29 Marcel Telka <marcel@telka.sk> * data/MANUFACTURERS: Added new manufacturer: DEC. * src/jtag.c (jtag_create_jtagdir): Changed permissions for jtag directory. * include/part.h (part_alloc, read_part): Changed return type from `part *' to `part_t *'. (struct parts): Changed parts member type from `part **' to `part_t **'. (parts_alloc): Changed return type from `parts *' to `parts_t *'. * src/bus/ixp425.c (select_flash, unselect_flash, setup_address, set_data_in, setup_data): Changed first parameter type from `part *' to `part_t *'. * src/bus/pxa250.c (setup_address, set_data_in, setup_data): Ditto. * src/bus/sa1110.c (setup_address, set_data_in, setup_data): Ditto. * include/bus.h: Replaced static bus_driver_t architecture with dynamic bus_t. Removed direct chain_t dependency. Added `params' and `prepare' members. All related functions' parameter types changed. * src/bus/ixp425.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (ixp425_bus_prepare, ixp425_bus_free, new_ixp425_bus): New functions. (ixp425_bus_driver, ixp425_bus): Renamed `ixp425_bus_driver' to `ixp425_bus' and updated for new bus driver architecture. * src/bus/pxa250.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (pxa250_bus_prepare, pxa250_bus_free, new_pxa250_bus): New functions. (pxa250_bus_driver, pxa250_bus): Renamed `pxa250_bus_driver' to `pxa250_bus' and updated for new bus driver architecture. * src/bus/sa1110.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (sa1110_bus_prepare, sa1110_bus_free, new_sa1110_bus): New functions. (sa1110_bus_driver, sa1110_bus): Renamed `sa1110_bus_driver' to `sa1110_bus' and updated for new bus driver architecture. * src/readmem.c (detectflash, readmem): Moved JTAG chain initialization to bus->prepare(). * src/flash.c (flashcheck): Ditto. (flashmsbin, flashmem): Removed BYPASS instruction setup. * src/jtag.c (bus_driver, bus): Replaced `bus_driver' with `bus' global variable. (jtag_parse_line, main): Added `bus' deallocation. * src/flash.h (flash_driver_t): Changed parameter type for all function members from `chain_t*' to `bus_t *'. All function callers changed. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@423 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
flashmsbin( bus_t *bus, FILE *f )
{
uint32_t adr;
cfi_query_structure_t *cfi;
cfi_array_t *cfi_array;
flashcheck( bus, &cfi_array );
if (!cfi_array || !flash_driver) {
printf( _("no flash driver found\n") );
return;
}
cfi = &cfi_array->cfi_chips[0]->cfi;
/* test sync bytes */
{
char sync[8];
fread( &sync, sizeof (char), 7, f );
sync[7] = '\0';
if (strcmp( "B000FF\n", sync ) != 0) {
printf( _("Invalid sync sequence!\n") );
return;
}
}
/* erase memory blocks */
{
uint32_t start;
uint32_t len;
int first, last;
fread( &start, sizeof start, 1, f );
fread( &len, sizeof len, 1, f );
first = start / (cfi->device_geometry.erase_block_regions[0].erase_block_size * 2);
last = (start + len - 1) / (cfi->device_geometry.erase_block_regions[0].erase_block_size * 2);
for (; first <= last; first++) {
adr = first * cfi->device_geometry.erase_block_regions[0].erase_block_size * 2;
flash_driver->unlock_block( cfi_array, adr );
printf( _("block %d unlocked\n"), first );
printf( _("erasing block %d: %d\n"), first, flash_driver->erase_block( cfi_array, adr ) );
}
}
printf( _("program:\n") );
for (;;) {
uint32_t a, l, c;
fread( &a, sizeof a, 1, f );
fread( &l, sizeof l, 1, f );
fread( &c, sizeof c, 1, f );
if (feof( f )) {
printf( _("Error: premature end of file\n") );
return;
}
printf( _("record: start = 0x%08X, len = 0x%08X, checksum = 0x%08X\n"), a, l, c );
if ((a == 0) && (c == 0))
break;
if (l & 3) {
printf( _("Error: Invalid record length!\n") );
return;
}
while (l) {
uint32_t data;
printf( _("addr: 0x%08X"), a );
printf( "\r" );
fflush(stdout);
fread( &data, sizeof data, 1, f );
if (flash_driver->program( cfi_array, a, data )) {
printf( _("\nflash error\n") );
return;
}
a += 4;
l -= 4;
}
}
printf( "\n" );
flash_driver->readarray( cfi_array );
fseek( f, 15, SEEK_SET );
printf( _("verify:\n") );
for (;;) {
uint32_t a, l, c;
fread( &a, sizeof a, 1, f );
fread( &l, sizeof l, 1, f );
fread( &c, sizeof c, 1, f );
if (feof( f )) {
printf( _("Error: premature end of file\n") );
return;
}
printf( _("record: start = 0x%08X, len = 0x%08X, checksum = 0x%08X\n"), a, l, c );
if ((a == 0) && (c == 0))
break;
if (l & 3) {
printf( _("Error: Invalid record length!\n") );
return;
}
while (l) {
uint32_t data, readed;
printf( _("addr: 0x%08X"), a );
printf( "\r" );
fflush( stdout );
fread( &data, sizeof data, 1, f );
2003-04-29 Marcel Telka <marcel@telka.sk> * data/MANUFACTURERS: Added new manufacturer: DEC. * src/jtag.c (jtag_create_jtagdir): Changed permissions for jtag directory. * include/part.h (part_alloc, read_part): Changed return type from `part *' to `part_t *'. (struct parts): Changed parts member type from `part **' to `part_t **'. (parts_alloc): Changed return type from `parts *' to `parts_t *'. * src/bus/ixp425.c (select_flash, unselect_flash, setup_address, set_data_in, setup_data): Changed first parameter type from `part *' to `part_t *'. * src/bus/pxa250.c (setup_address, set_data_in, setup_data): Ditto. * src/bus/sa1110.c (setup_address, set_data_in, setup_data): Ditto. * include/bus.h: Replaced static bus_driver_t architecture with dynamic bus_t. Removed direct chain_t dependency. Added `params' and `prepare' members. All related functions' parameter types changed. * src/bus/ixp425.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (ixp425_bus_prepare, ixp425_bus_free, new_ixp425_bus): New functions. (ixp425_bus_driver, ixp425_bus): Renamed `ixp425_bus_driver' to `ixp425_bus' and updated for new bus driver architecture. * src/bus/pxa250.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (pxa250_bus_prepare, pxa250_bus_free, new_pxa250_bus): New functions. (pxa250_bus_driver, pxa250_bus): Renamed `pxa250_bus_driver' to `pxa250_bus' and updated for new bus driver architecture. * src/bus/sa1110.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (sa1110_bus_prepare, sa1110_bus_free, new_sa1110_bus): New functions. (sa1110_bus_driver, sa1110_bus): Renamed `sa1110_bus_driver' to `sa1110_bus' and updated for new bus driver architecture. * src/readmem.c (detectflash, readmem): Moved JTAG chain initialization to bus->prepare(). * src/flash.c (flashcheck): Ditto. (flashmsbin, flashmem): Removed BYPASS instruction setup. * src/jtag.c (bus_driver, bus): Replaced `bus_driver' with `bus' global variable. (jtag_parse_line, main): Added `bus' deallocation. * src/flash.h (flash_driver_t): Changed parameter type for all function members from `chain_t*' to `bus_t *'. All function callers changed. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@423 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
readed = bus_read( bus, a );
if (data != readed) {
printf( _("\nverify error: 0x%08X vs. 0x%08X at addr %08X\n"),
readed, data, a );
return;
}
a += 4;
l -= 4;
}
}
printf( _("\nDone.\n") );
cfi_array_free( cfi_array );
}
void
2003-04-29 Marcel Telka <marcel@telka.sk> * data/MANUFACTURERS: Added new manufacturer: DEC. * src/jtag.c (jtag_create_jtagdir): Changed permissions for jtag directory. * include/part.h (part_alloc, read_part): Changed return type from `part *' to `part_t *'. (struct parts): Changed parts member type from `part **' to `part_t **'. (parts_alloc): Changed return type from `parts *' to `parts_t *'. * src/bus/ixp425.c (select_flash, unselect_flash, setup_address, set_data_in, setup_data): Changed first parameter type from `part *' to `part_t *'. * src/bus/pxa250.c (setup_address, set_data_in, setup_data): Ditto. * src/bus/sa1110.c (setup_address, set_data_in, setup_data): Ditto. * include/bus.h: Replaced static bus_driver_t architecture with dynamic bus_t. Removed direct chain_t dependency. Added `params' and `prepare' members. All related functions' parameter types changed. * src/bus/ixp425.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (ixp425_bus_prepare, ixp425_bus_free, new_ixp425_bus): New functions. (ixp425_bus_driver, ixp425_bus): Renamed `ixp425_bus_driver' to `ixp425_bus' and updated for new bus driver architecture. * src/bus/pxa250.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (pxa250_bus_prepare, pxa250_bus_free, new_pxa250_bus): New functions. (pxa250_bus_driver, pxa250_bus): Renamed `pxa250_bus_driver' to `pxa250_bus' and updated for new bus driver architecture. * src/bus/sa1110.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (sa1110_bus_prepare, sa1110_bus_free, new_sa1110_bus): New functions. (sa1110_bus_driver, sa1110_bus): Renamed `sa1110_bus_driver' to `sa1110_bus' and updated for new bus driver architecture. * src/readmem.c (detectflash, readmem): Moved JTAG chain initialization to bus->prepare(). * src/flash.c (flashcheck): Ditto. (flashmsbin, flashmem): Removed BYPASS instruction setup. * src/jtag.c (bus_driver, bus): Replaced `bus_driver' with `bus' global variable. (jtag_parse_line, main): Added `bus' deallocation. * src/flash.h (flash_driver_t): Changed parameter type for all function members from `chain_t*' to `bus_t *'. All function callers changed. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@423 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
flashmem( bus_t *bus, FILE *f, uint32_t addr )
{
uint32_t adr;
cfi_query_structure_t *cfi;
cfi_array_t *cfi_array;
int *erased;
int i;
flashcheck( bus, &cfi_array );
if (!cfi_array || !flash_driver) {
printf( _("no flash driver found\n") );
return;
}
cfi = &cfi_array->cfi_chips[0]->cfi;
erased = malloc( cfi->device_geometry.erase_block_regions[0].number_of_erase_blocks * 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++)
erased[i] = 0;
printf( _("program:\n") );
adr = addr;
while (!feof( f )) {
uint32_t data;
#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);
if (!erased[block_no]) {
flash_driver->unlock_block( cfi_array, adr );
printf( _("\nblock %d unlocked\n"), block_no );
printf( _("erasing block %d: %d\n"), block_no, flash_driver->erase_block( cfi_array, adr ) );
erased[block_no] = 1;
}
bn = fread( b, 1, BSIZE, f );
for (bc = 0; bc < bn; bc += flash_driver->bus_width) {
int j;
printf( _("addr: 0x%08X"), adr );
printf( "\r" );
fflush( stdout );
data = 0;
for (j = 0; j < flash_driver->bus_width; j++)
if (big_endian)
data = (data << 8) | b[bc + j];
else
data |= b[bc + j] << (j * 8);
if (flash_driver->program( cfi_array, adr, data )) {
printf( _("\nflash error\n") );
return;
}
adr += flash_driver->bus_width;
}
}
printf( "\n" );
flash_driver->readarray( cfi_array );
fseek( f, 0, SEEK_SET );
printf( _("verify:\n") );
fflush( stdout );
adr = addr;
while (!feof( f )) {
uint8_t buf[16];
uint32_t data;
uint32_t readed;
int j;
if (fread( buf, flash_driver->bus_width, 1, f ) != 1) {
if (feof(f))
break;
printf( _("Error during file read.\n") );
return;
}
data = 0;
for (j = 0; j < flash_driver->bus_width; j++)
if (big_endian)
data = (data << 8) | buf[j];
else
data |= buf[j] << (j * 8);
printf( _("addr: 0x%08X"), adr );
printf( "\r" );
fflush( stdout );
2003-04-29 Marcel Telka <marcel@telka.sk> * data/MANUFACTURERS: Added new manufacturer: DEC. * src/jtag.c (jtag_create_jtagdir): Changed permissions for jtag directory. * include/part.h (part_alloc, read_part): Changed return type from `part *' to `part_t *'. (struct parts): Changed parts member type from `part **' to `part_t **'. (parts_alloc): Changed return type from `parts *' to `parts_t *'. * src/bus/ixp425.c (select_flash, unselect_flash, setup_address, set_data_in, setup_data): Changed first parameter type from `part *' to `part_t *'. * src/bus/pxa250.c (setup_address, set_data_in, setup_data): Ditto. * src/bus/sa1110.c (setup_address, set_data_in, setup_data): Ditto. * include/bus.h: Replaced static bus_driver_t architecture with dynamic bus_t. Removed direct chain_t dependency. Added `params' and `prepare' members. All related functions' parameter types changed. * src/bus/ixp425.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (ixp425_bus_prepare, ixp425_bus_free, new_ixp425_bus): New functions. (ixp425_bus_driver, ixp425_bus): Renamed `ixp425_bus_driver' to `ixp425_bus' and updated for new bus driver architecture. * src/bus/pxa250.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (pxa250_bus_prepare, pxa250_bus_free, new_pxa250_bus): New functions. (pxa250_bus_driver, pxa250_bus): Renamed `pxa250_bus_driver' to `pxa250_bus' and updated for new bus driver architecture. * src/bus/sa1110.c (bus_params_t): New structure typedef. (CHAIN, PART): New macros. (sa1110_bus_prepare, sa1110_bus_free, new_sa1110_bus): New functions. (sa1110_bus_driver, sa1110_bus): Renamed `sa1110_bus_driver' to `sa1110_bus' and updated for new bus driver architecture. * src/readmem.c (detectflash, readmem): Moved JTAG chain initialization to bus->prepare(). * src/flash.c (flashcheck): Ditto. (flashmsbin, flashmem): Removed BYPASS instruction setup. * src/jtag.c (bus_driver, bus): Replaced `bus_driver' with `bus' global variable. (jtag_parse_line, main): Added `bus' deallocation. * src/flash.h (flash_driver_t): Changed parameter type for all function members from `chain_t*' to `bus_t *'. All function callers changed. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@423 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
readed = bus_read( bus, adr );
if (data != readed) {
printf( _("\nverify error:\nreaded: 0x%08X\nexpected: 0x%08X\n"), readed, data );
return;
}
adr += flash_driver->bus_width;
}
printf( _("\nDone.\n") );
free( erased );
cfi_array_free( cfi_array );
}