Renamed global variables to carry urj_ prefix. Redid indent.

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1525 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent 4ee78e6020
commit 40aab582ec

@ -37,7 +37,7 @@ typedef struct
} urj_buses_t;
extern urj_buses_t urj_buses;
extern const urj_bus_driver_t *bus_drivers[];
extern const urj_bus_driver_t *urj_bus_drivers[];
void urj_bus_buses_free (void);
void urj_bus_buses_add (urj_bus_t *abus);

@ -160,6 +160,6 @@ int urj_tap_cable_add_queue_item (urj_cable_t *cable,
int urj_tap_cable_get_queue_item (urj_cable_t *cable,
urj_cable_queue_info_t *q);
extern urj_cable_driver_t *cable_drivers[];
extern urj_cable_driver_t *urj_tap_cable_drivers[];
#endif /* URJ_CABLE_H */

@ -57,9 +57,9 @@ typedef struct
urj_flash_cfi_chip_t **cfi_chips;
} urj_flash_cfi_array_t;
void urj_flash_cfi_array_free (urj_flash_cfi_array_t *cfi_array);
void urj_flash_cfi_array_free (urj_flash_cfi_array_t *urj_flash_cfi_array);
int urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
urj_flash_cfi_array_t **urj_flash_cfi_array);
/* End of brux/cfi.h */
@ -68,13 +68,15 @@ typedef struct
unsigned int bus_width; /* 1 for 8 bits, 2 for 16 bits, 4 for 32 bits, etc. */
const char *name;
const char *description;
int (*autodetect) (urj_flash_cfi_array_t *cfi_array);
void (*print_info) (urj_flash_cfi_array_t *cfi_array);
int (*erase_block) (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
int (*unlock_block) (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
int (*program) (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
int (*autodetect) (urj_flash_cfi_array_t *urj_flash_cfi_array);
void (*print_info) (urj_flash_cfi_array_t *urj_flash_cfi_array);
int (*erase_block) (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr);
int (*unlock_block) (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr);
int (*program) (urj_flash_cfi_array_t *urj_flash_cfi_array, uint32_t adr,
uint32_t *buffer, int count);
void (*readarray) (urj_flash_cfi_array_t *cfi_array);
void (*readarray) (urj_flash_cfi_array_t *urj_flash_cfi_array);
} urj_flash_driver_t;
#define URJ_FLASH_ERROR_NOERROR 0
@ -90,6 +92,6 @@ void urj_flashmsbin (urj_bus_t *bus, FILE * f, int);
/* end of original brux/flash.h */
extern urj_flash_driver_t *flash_drivers[];
extern urj_flash_driver_t *urj_flash_flash_drivers[];
#endif /* URJ_FLASH_H */

@ -39,22 +39,22 @@
typedef enum jim_tap_state
{
URJ_JIM_RESET = 0,
URJ_JIM_SELECT_DR = 0 + 1,
URJ_JIM_CAPTURE_DR = 0 + 2,
URJ_JIM_SHIFT_DR = 0 + 3,
URJ_JIM_EXIT1_DR = 0 + 4,
URJ_JIM_PAUSE_DR = 0 + 5,
URJ_JIM_EXIT2_DR = 0 + 6,
URJ_JIM_UPDATE_DR = 0 + 7,
URJ_JIM_IDLE = 8,
URJ_JIM_SELECT_IR = 8 + 1,
URJ_JIM_CAPTURE_IR = 8 + 2,
URJ_JIM_SHIFT_IR = 8 + 3,
URJ_JIM_EXIT1_IR = 8 + 4,
URJ_JIM_PAUSE_IR = 8 + 5,
URJ_JIM_EXIT2_IR = 8 + 6,
URJ_JIM_UPDATE_IR = 8 + 7,
URJ_JIM_RESET = 0,
URJ_JIM_SELECT_DR = 0 + 1,
URJ_JIM_CAPTURE_DR = 0 + 2,
URJ_JIM_SHIFT_DR = 0 + 3,
URJ_JIM_EXIT1_DR = 0 + 4,
URJ_JIM_PAUSE_DR = 0 + 5,
URJ_JIM_EXIT2_DR = 0 + 6,
URJ_JIM_UPDATE_DR = 0 + 7,
URJ_JIM_IDLE = 8,
URJ_JIM_SELECT_IR = 8 + 1,
URJ_JIM_CAPTURE_IR = 8 + 2,
URJ_JIM_SHIFT_IR = 8 + 3,
URJ_JIM_EXIT1_IR = 8 + 4,
URJ_JIM_PAUSE_IR = 8 + 5,
URJ_JIM_EXIT2_IR = 8 + 6,
URJ_JIM_UPDATE_IR = 8 + 7,
}
urj_jim_tap_state_t;

@ -59,6 +59,6 @@ int urj_tap_parport_get_data (urj_parport_t *port);
int urj_tap_parport_get_status (urj_parport_t *port);
int urj_tap_parport_set_control (urj_parport_t *port, uint8_t data);
extern urj_parport_driver_t *parport_drivers[];
extern urj_parport_driver_t *urj_tap_parport_drivers[];
#endif /* URJ_PARPORT_H */

@ -67,6 +67,6 @@ int urj_tap_usbconn_close (urj_usbconn_t *conn);
int urj_tap_usbconn_read (urj_usbconn_t *conn, uint8_t *buf, int len);
int urj_tap_usbconn_write (urj_usbconn_t *conn, uint8_t *buf, int len,
int recv);
extern urj_usbconn_driver_t *usbconn_drivers[];
extern urj_usbconn_driver_t *urj_tap_usbconn_drivers[];
#endif /* URJ_USBCONN_H */

@ -304,7 +304,7 @@ au1500_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t au1500_bus = {
const urj_bus_driver_t urj_bus_au1500_bus = {
"au1500",
N_("AU1500 BUS Driver via BSR"),
au1500_bus_new,

@ -763,7 +763,7 @@ avr32_bus_write (urj_bus_t *bus, uint32_t addr, uint32_t data)
}
}
const urj_bus_driver_t avr32_bus_driver = {
const urj_bus_driver_t urj_bus_avr32_bus_driver = {
"avr32",
N_("Atmel AVR32 multi-mode bus driver, requires <mode> parameter\n"
" valid <mode> parameters:\n"

@ -536,7 +536,7 @@ bcm1250_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
#endif /* #else #ifndef USE_BCM_EJTAG */
const urj_bus_driver_t bcm1250_bus = {
const urj_bus_driver_t urj_bus_bcm1250_bus = {
"bcm1250",
N_("Broadcom BCM1250 compatible bus driver via BSR"),
bcm1250_bus_new,

@ -328,7 +328,7 @@ bf533_ezkit_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t bf533_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf533_ezkit_bus = {
"bf533_ezkit",
N_("Blackfin BF533 EZKit board bus driver"),
bf533_ezkit_bus_new,

@ -330,7 +330,7 @@ bf533_stamp_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t bf533_stamp_bus = {
const urj_bus_driver_t urj_bus_bf533_stamp_bus = {
"bf533_stamp",
N_("Blackfin BF533 Stamp board bus driver"),
bf533_stamp_bus_new,

@ -339,7 +339,7 @@ bf537_stamp_bus_printinfo (urj_bus_t *bus)
#ifdef ENABLE_BUS_BF537_STAMP
const urj_bus_driver_t bf537_stamp_bus = {
const urj_bus_driver_t urj_bus_bf537_stamp_bus = {
"bf537_stamp",
N_("Blackfin BF537 Stamp board bus driver via BSR"),
BF537_STAMP_BUS_FUNCTIONS
@ -349,7 +349,7 @@ const urj_bus_driver_t bf537_stamp_bus = {
#ifdef ENABLE_BUS_BF537_EZKIT
const urj_bus_driver_t bf537_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf537_ezkit_bus = {
"bf537_ezkit",
N_("Blackfin BF537 EZ-KIT board bus driver via BSR"),
BF537_STAMP_BUS_FUNCTIONS
@ -359,7 +359,7 @@ const urj_bus_driver_t bf537_ezkit_bus = {
#ifdef ENABLE_BUS_BF527_EZKIT
const urj_bus_driver_t bf527_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf527_ezkit_bus = {
"bf527_ezkit",
N_("Blackfin BF527 EZ-KIT board bus driver via BSR"),
BF537_STAMP_BUS_FUNCTIONS
@ -369,7 +369,7 @@ const urj_bus_driver_t bf527_ezkit_bus = {
#ifdef ENABLE_BUS_BF538F_EZKIT
const urj_bus_driver_t bf538f_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf538f_ezkit_bus = {
"bf538f_ezkit",
N_("Blackfin BF538F EZ-KIT board bus driver"),
BF537_STAMP_BUS_FUNCTIONS
@ -379,7 +379,7 @@ const urj_bus_driver_t bf538f_ezkit_bus = {
#ifdef ENABLE_BUS_BF526_EZKIT
const urj_bus_driver_t bf526_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf526_ezkit_bus = {
"bf526_ezkit",
N_("Blackfin BF526 EZ-KIT board bus driver"),
BF537_STAMP_BUS_FUNCTIONS

@ -319,7 +319,7 @@ bf548_ezkit_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t bf548_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf548_ezkit_bus = {
"bf548_ezkit",
N_("Blackfin BF548 EZ-KIT board bus driver"),
bf548_ezkit_bus_new,

@ -342,7 +342,7 @@ bf561_ezkit_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t bf561_ezkit_bus = {
const urj_bus_driver_t urj_bus_bf561_ezkit_bus = {
"bf561_ezkit",
N_("Blackfin BF561 EZ-KIT board bus driver"),
bf561_ezkit_bus_new,

@ -386,7 +386,7 @@ flashbscoach_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t bscoach_bus = {
const urj_bus_driver_t urj_bus_bscoach_bus = {
"flashbscoach",
N_("Goepel Boundary Scan Coach compatible bus driver for flash programming via BSR"),
flashbscoach_bus_new,

@ -29,112 +29,112 @@
#include "bus.h"
#include "buses.h"
const urj_bus_driver_t *bus_drivers[] = {
const urj_bus_driver_t *urj_bus_drivers[] = {
#ifdef ENABLE_BUS_AU1500
&au1500_bus,
&urj_bus_au1500_bus,
#endif
#ifdef ENABLE_BUS_AVR32
&avr32_bus_driver,
&urj_bus_avr32_bus_driver,
#endif
#ifdef ENABLE_BUS_BCM1250
&bcm1250_bus,
&urj_bus_bcm1250_bus,
#endif
#ifdef ENABLE_BUS_BF526_EZKIT
&bf526_ezkit_bus,
&urj_bus_bf526_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BF527_EZKIT
&bf527_ezkit_bus,
&urj_bus_bf527_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BF533_STAMP
&bf533_stamp_bus,
&urj_bus_bf533_stamp_bus,
#endif
#ifdef ENABLE_BUS_BF533_EZKIT
&bf533_ezkit_bus,
&urj_bus_bf533_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BF537_STAMP
&bf537_stamp_bus,
&urj_bus_bf537_stamp_bus,
#endif
#ifdef ENABLE_BUS_BF537_EZKIT
&bf537_ezkit_bus,
&urj_bus_bf537_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BF538F_EZKIT
&bf538f_ezkit_bus,
&urj_bus_bf538f_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BF548_EZKIT
&bf548_ezkit_bus,
&urj_bus_bf548_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BF561_EZKIT
&bf561_ezkit_bus,
&urj_bus_bf561_ezkit_bus,
#endif
#ifdef ENABLE_BUS_BSCOACH
&bscoach_bus,
&urj_bus_bscoach_bus,
#endif
#ifdef ENABLE_BUS_EJTAG
&ejtag_bus,
&ejtag_dma_bus,
&urj_bus_ejtag_bus,
&urj_bus_ejtag_dma_bus,
#endif
#ifdef ENABLE_BUS_FJMEM
&fjmem_bus,
&urj_bus_fjmem_bus,
#endif
#ifdef ENABLE_BUS_IXP425
&ixp425_bus,
&urj_bus_ixp425_bus,
#endif
#ifdef ENABLE_BUS_JOPCYC
&jopcyc_bus,
&urj_bus_jopcyc_bus,
#endif
#ifdef ENABLE_BUS_H7202
&h7202_bus,
&urj_bus_h7202_bus,
#endif
#ifdef ENABLE_BUS_LH7A400
&lh7a400_bus,
&urj_bus_lh7a400_bus,
#endif
#ifdef ENABLE_BUS_MPC5200
&mpc5200_bus,
&urj_bus_mpc5200_bus,
#endif
#ifdef ENABLE_BUS_MPC824X
&mpc824x_bus,
&urj_bus_mpc824x_bus,
#endif
#ifdef ENABLE_BUS_PPC405EP
&ppc405ep_bus,
&urj_bus_ppc405ep_bus,
#endif
#ifdef ENABLE_BUS_PPC440GX_EBC8
&ppc440gx_ebc8_bus,
&urj_bus_ppc440gx_ebc8_bus,
#endif
#ifdef ENABLE_BUS_PROTOTYPE
&prototype_bus,
&urj_bus_prototype_bus,
#endif
#ifdef ENABLE_BUS_PXA2X0
&pxa2x0_bus,
&urj_bus_pxa2x0_bus,
#endif
#ifdef ENABLE_BUS_PXA27X
&pxa27x_bus,
&urj_bus_pxa27x_bus,
#endif
#ifdef ENABLE_BUS_S3C4510
&s3c4510_bus,
&urj_bus_s3c4510_bus,
#endif
#ifdef ENABLE_BUS_SA1110
&sa1110_bus,
&urj_bus_sa1110_bus,
#endif
#ifdef ENABLE_BUS_SH7727
&sh7727_bus,
&urj_bus_sh7727_bus,
#endif
#ifdef ENABLE_BUS_SH7750R
&sh7750r_bus,
&urj_bus_sh7750r_bus,
#endif
#ifdef ENABLE_BUS_SH7751R
&sh7751r_bus,
&urj_bus_sh7751r_bus,
#endif
#ifdef ENABLE_BUS_SHARC_21065L
&sharc_21065L_bus,
&urj_bus_sharc_21065L_bus,
#endif
#ifdef ENABLE_BUS_SLSUP3
&slsup3_bus,
&urj_bus_slsup3_bus,
#endif
#ifdef ENABLE_BUS_TX4925
&tx4925_bus,
&urj_bus_tx4925_bus,
#endif
#ifdef ENABLE_BUS_ZEFANT_XS3
&zefant_xs3_bus,
&urj_bus_zefant_xs3_bus,
#endif
NULL /* last must be NULL */
};

@ -25,40 +25,40 @@
#ifndef URJ_BUS_BUSES_H
#define URJ_BUS_BUSES_H
extern const urj_bus_driver_t au1500_bus;
extern const urj_bus_driver_t avr32_bus_driver;
extern const urj_bus_driver_t bcm1250_bus;
extern const urj_bus_driver_t bf526_ezkit_bus;
extern const urj_bus_driver_t bf527_ezkit_bus;
extern const urj_bus_driver_t bf533_stamp_bus;
extern const urj_bus_driver_t bf533_ezkit_bus;
extern const urj_bus_driver_t bf537_stamp_bus;
extern const urj_bus_driver_t bf537_ezkit_bus;
extern const urj_bus_driver_t bf538f_ezkit_bus;
extern const urj_bus_driver_t bf548_ezkit_bus;
extern const urj_bus_driver_t bf561_ezkit_bus;
extern const urj_bus_driver_t bscoach_bus;
extern const urj_bus_driver_t ejtag_bus;
extern const urj_bus_driver_t fjmem_bus;
extern const urj_bus_driver_t h7202_bus;
extern const urj_bus_driver_t ixp425_bus;
extern const urj_bus_driver_t jopcyc_bus;
extern const urj_bus_driver_t lh7a400_bus;
extern const urj_bus_driver_t mpc5200_bus;
extern const urj_bus_driver_t mpc824x_bus;
extern const urj_bus_driver_t ppc405ep_bus;
extern const urj_bus_driver_t ppc440gx_ebc8_bus;
extern const urj_bus_driver_t prototype_bus;
extern const urj_bus_driver_t pxa2x0_bus;
extern const urj_bus_driver_t pxa27x_bus;
extern const urj_bus_driver_t s3c4510_bus;
extern const urj_bus_driver_t sa1110_bus;
extern const urj_bus_driver_t sh7727_bus;
extern const urj_bus_driver_t sh7750r_bus;
extern const urj_bus_driver_t sh7751r_bus;
extern const urj_bus_driver_t sharc_21065L_bus;
extern const urj_bus_driver_t slsup3_bus;
extern const urj_bus_driver_t tx4925_bus;
extern const urj_bus_driver_t zefant_xs3_bus;
extern const urj_bus_driver_t ejtag_dma_bus;
extern const urj_bus_driver_t urj_bus_au1500_bus;
extern const urj_bus_driver_t urj_bus_avr32_bus_driver;
extern const urj_bus_driver_t urj_bus_bcm1250_bus;
extern const urj_bus_driver_t urj_bus_bf526_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bf527_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bf533_stamp_bus;
extern const urj_bus_driver_t urj_bus_bf533_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bf537_stamp_bus;
extern const urj_bus_driver_t urj_bus_bf537_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bf538f_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bf548_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bf561_ezkit_bus;
extern const urj_bus_driver_t urj_bus_bscoach_bus;
extern const urj_bus_driver_t urj_bus_ejtag_bus;
extern const urj_bus_driver_t urj_bus_fjmem_bus;
extern const urj_bus_driver_t urj_bus_h7202_bus;
extern const urj_bus_driver_t urj_bus_ixp425_bus;
extern const urj_bus_driver_t urj_bus_jopcyc_bus;
extern const urj_bus_driver_t urj_bus_lh7a400_bus;
extern const urj_bus_driver_t urj_bus_mpc5200_bus;
extern const urj_bus_driver_t urj_bus_mpc824x_bus;
extern const urj_bus_driver_t urj_bus_ppc405ep_bus;
extern const urj_bus_driver_t urj_bus_ppc440gx_ebc8_bus;
extern const urj_bus_driver_t urj_bus_prototype_bus;
extern const urj_bus_driver_t urj_bus_pxa2x0_bus;
extern const urj_bus_driver_t urj_bus_pxa27x_bus;
extern const urj_bus_driver_t urj_bus_s3c4510_bus;
extern const urj_bus_driver_t urj_bus_sa1110_bus;
extern const urj_bus_driver_t urj_bus_sh7727_bus;
extern const urj_bus_driver_t urj_bus_sh7750r_bus;
extern const urj_bus_driver_t urj_bus_sh7751r_bus;
extern const urj_bus_driver_t urj_bus_sharc_21065L_bus;
extern const urj_bus_driver_t urj_bus_slsup3_bus;
extern const urj_bus_driver_t urj_bus_tx4925_bus;
extern const urj_bus_driver_t urj_bus_zefant_xs3_bus;
extern const urj_bus_driver_t urj_bus_ejtag_dma_bus;
#endif /* URJ_BUS_BUSES_H */

@ -726,7 +726,7 @@ ejtag_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
// printf("URJ_BUS_WRITE: adr=0x%08x data=0x%08x\n", adr, data);
}
const urj_bus_driver_t ejtag_bus = {
const urj_bus_driver_t urj_bus_ejtag_bus = {
"ejtag",
N_("EJTAG compatible bus driver via PrAcc"),
ejtag_bus_new,

@ -672,7 +672,7 @@ ejtag_dma_bus_read_end (urj_bus_t *bus)
return _data_read;
}
const urj_bus_driver_t ejtag_dma_bus = {
const urj_bus_driver_t urj_bus_ejtag_dma_bus = {
"ejtag_dma",
N_("EJTAG compatible bus driver via DMA"),
ejtag_dma_bus_new,

@ -763,7 +763,7 @@ fjmem_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t fjmem_bus = {
const urj_bus_driver_t urj_bus_fjmem_bus = {
"fjmem",
N_("FPGA JTAG memory bus driver via USER register, requires parameters:\n"
" opcode=<USERx OPCODE> [len=<FJMEM REG LEN>]"),

@ -300,7 +300,7 @@ h7202_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t h7202_bus = {
const urj_bus_driver_t urj_bus_h7202_bus = {
"h7202",
"H7202 compatible bus driver via BSR",
h7202_bus_new,

@ -295,7 +295,7 @@ ixp425_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t ixp425_bus = {
const urj_bus_driver_t urj_bus_ixp425_bus = {
"ixp425",
N_("Intel IXP425 compatible bus driver via BSR"),
ixp425_bus_new,

@ -699,7 +699,7 @@ jopcyc_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t jopcyc_bus = {
const urj_bus_driver_t urj_bus_jopcyc_bus = {
"jopcyc",
N_("JOP.design Cyclone Board compatible bus driver via BSR"),
jopcyc_bus_new,

@ -330,7 +330,7 @@ lh7a400_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t lh7a400_bus = {
const urj_bus_driver_t urj_bus_lh7a400_bus = {
"lh7a400",
N_("Sharp LH7A400 compatible bus driver via BSR (flash access only!)"),
lh7a400_bus_new,

@ -393,7 +393,7 @@ mpc5200_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t mpc5200_bus = {
const urj_bus_driver_t urj_bus_mpc5200_bus = {
"mpc5200",
N_("Freescale MPC5200 compatible bus driver via BSR, parameter: [mux]"),
mpc5200_bus_new,

@ -565,7 +565,7 @@ mpc824x_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
}
const urj_bus_driver_t mpc824x_bus = {
const urj_bus_driver_t urj_bus_mpc824x_bus = {
"mpc824x",
N_("Motorola MPC824x compatible bus driver via BSR"),
mpc824x_bus_new,

@ -270,7 +270,7 @@ ppc405ep_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t ppc405ep_bus = {
const urj_bus_driver_t urj_bus_ppc405ep_bus = {
"ppc405ep",
N_("IBM PowerPC 405EP compatible bus driver via BSR"),
ppc405ep_bus_new,

@ -276,7 +276,7 @@ ppc440gx_ebc8_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t ppc440gx_ebc8_bus = {
const urj_bus_driver_t urj_bus_ppc440gx_ebc8_bus = {
"ppc440gx_ebc8",
N_("IBM PowerPC 440GX 8-bit EBC compatible bus driver via BSR"),
ppc440gx_ebc8_bus_new,

@ -485,7 +485,7 @@ prototype_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t prototype_bus = {
const urj_bus_driver_t urj_bus_prototype_bus = {
"prototype",
N_("Configurable prototype bus driver via BSR, requires parameters:\n"
" amsb=<addr MSB> alsb=<addr LSB> dmsb=<data MSB> dlsb=<data LSB>\n"

@ -748,7 +748,7 @@ pxa2xx_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t pxa2x0_bus = {
const urj_bus_driver_t urj_bus_pxa2x0_bus = {
"pxa2x0",
N_("Intel PXA2x0 compatible bus driver via BSR"),
pxa2xx_bus_new,
@ -764,7 +764,7 @@ const urj_bus_driver_t pxa2x0_bus = {
pxa2xx_bus_init
};
const urj_bus_driver_t pxa27x_bus = {
const urj_bus_driver_t urj_bus_pxa27x_bus = {
"pxa27x",
N_("Intel PXA27x compatible bus driver via BSR"),
pxa2xx_bus_new,

@ -433,7 +433,7 @@ s3c4510_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
DEBUG_LVL2 (printf ("URJ_BUS_WRITE %08x @ %08x\n", data, adr);)}
const urj_bus_driver_t s3c4510_bus = {
const urj_bus_driver_t urj_bus_s3c4510_bus = {
"s3c4510x",
N_("Samsung S3C4510B compatible bus driver via BSR"),
s3c4510_bus_new,
@ -458,64 +458,64 @@ const urj_bus_driver_t s3c4510_bus = {
** Revision 1.5 2003/09/10 12:38:01 telka
** 2003-09-10 Marcel Telka <marcel@telka.sk>
**
** * src/bus/bcm1250.c (bcm1250_bus_printinfo, bcm1250_bus): Fixed typo (compatibile->compatible) in
** * src/bus/bcm1250.c (bcm1250_bus_printinfo, urj_bus_bcm1250_bus): Fixed typo (compatibile->compatible) in
** output message (thanks to Andreas Mohr).
** * src/bus/ixp425.c (ixp425_bus_printinfo, ixp425_bus): Ditto.
** * src/bus/pxa2x0.c (pxa2x0_bus_printinfo, pxa2x0_bus): Ditto.
** * src/bus/s3c4510x.c (s3c4510_bus_printinfo, s3c4510_bus): Ditto.
** * src/bus/sa1110.c (sa1110_bus_printinfo, sa1110_bus): Ditto.
** * src/bus/sh7727.c (sh7727_bus_printinfo, sh7727_bus): Ditto.
** * src/bus/sh7750r.c (sh7750r_bus_printinfo, sh7750r_bus): Ditto.
** * src/bus/sh7751r.c (sh7751r_bus_printinfo, sh7751r_bus): Ditto.
** * src/bus/ixp425.c (ixp425_bus_printinfo, urj_bus_ixp425_bus): Ditto.
** * src/bus/pxa2x0.c (pxa2x0_bus_printinfo, urj_bus_pxa2x0_bus): Ditto.
** * src/bus/s3c4510x.c (s3c4510_bus_printinfo, urj_bus_s3c4510_bus): Ditto.
** * src/bus/sa1110.c (sa1110_bus_printinfo, urj_bus_sa1110_bus): Ditto.
** * src/bus/sh7727.c (sh7727_bus_printinfo, urj_bus_sh7727_bus): Ditto.
** * src/bus/sh7750r.c (sh7750r_bus_printinfo, urj_bus_sh7750r_bus): Ditto.
** * src/bus/sh7751r.c (sh7751r_bus_printinfo, urj_bus_sh7751r_bus): Ditto.
**
** Revision 1.4 2003/09/05 21:09:14 telka
** 2003-09-05 Marcel Telka <marcel@telka.sk>
**
** * include/bus.h (bus_drivers): Added constant declaration.
** * include/bus.h (urj_bus_drivers): Added constant declaration.
** (new_sa1110_bus, new_pxa250_bus, new_ixp425_bus, new_sh7727_bus, new_sh7750r_bus, new_sh7751r_bus)
** (new_bcm1250_bus): Function declarations removed.
** * src/bus/buses.c (bus_drivers): New constant definition.
** * src/bus/buses.c (urj_bus_drivers): New constant definition.
** * src/bus/buses.h: New file.
** * src/bus/Makefile.am (libbus_a_SOURCES): Added buses.h.
**
** * src/bus/bcm1250.c (bcm1250_bus_printinfo): Added new function parameter 'bus'.
** (bcm1250_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_bcm1250_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_bcm1250_bus): Function renamed ...
** (bcm1250_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/ixp425.c (ixp425_bus_printinfo): Added new function parameter 'bus'.
** (ixp425_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_ixp425_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_ixp425_bus): Function renamed ...
** (ixp425_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/pxa2x0.c (pxa2x0_bus_printinfo): Added new function parameter 'bus'.
** (pxa250_bus): Structure transformed ...
** (pxa2x0_bus): ... to this constant (changed type to urj_bus_driver_t, changed members).
** (urj_bus_pxa2x0_bus): ... to this constant (changed type to urj_bus_driver_t, changed members).
** (new_pxa250_bus): Function renamed ...
** (pxa2x0_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/s3c4510x.c (s3c4510_bus_printinfo): Added new function parameter 'bus'.
** (s3c4510_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_s3c4510_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_s3c4510_bus): Function renamed ...
** (s3c4510_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/sa1110.c (sa1110_bus_printinfo): Added new function parameter 'bus'.
** (sa1110_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_sa1110_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_sa1110_bus): Function renamed ...
** (sa1110_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/sh7727.c (sh7727_bus_printinfo): Added new function parameter 'bus'.
** (sh7727_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_sh7727_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_sh7727_bus): Function renamed ...
** (sh7727_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/sh7750r.c (sh7750r_bus_printinfo): Added new function parameter 'bus'.
** (sh7750r_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_sh7750r_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_sh7750r_bus): Function renamed ...
** (sh7750r_bus_new): ... to this one. Changed parameter list to void (and function body updated).
** * src/bus/sh7751r.c (sh7751r_bus_printinfo): Added new function parameter 'bus'.
** (sh7751r_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (urj_bus_sh7751r_bus): Changed structure type to urj_bus_driver_t. Changed members.
** (new_sh7751r_bus): Function renamed ...
** (sh7751r_bus_new): ... to this one. Changed parameter list to void (and function body updated).
**
** * src/cmd/cable.c (cmd_cable_run): Replaced bus->free() call with URJ_BUS_FREE().
** * src/jtag.c (main): Ditto.
**
** * src/cmd/cmd.c (cmds): Added cmd_initbus.
** * src/cmd/cmd.c (cmds): Added urj_cmd_initbus.
** * src/cmd/detect.c (cmd_detect_run): Removed explicit bus driver detection.
** * src/cmd/initbus.c: New file.
** * src/cmd/Makefile.am (libcmd_a_SOURCES): Added initbus.c.

@ -312,7 +312,7 @@ sa1110_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t sa1110_bus = {
const urj_bus_driver_t urj_bus_sa1110_bus = {
"sa1110",
N_("Intel SA-1110 compatible bus driver via BSR"),
sa1110_bus_new,

@ -352,7 +352,7 @@ sh7727_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t sh7727_bus = {
const urj_bus_driver_t urj_bus_sh7727_bus = {
"sh7727",
N_("Hitachi SH7727 compatible bus driver via BSR"),
sh7727_bus_new,

@ -333,7 +333,7 @@ sh7750r_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t sh7750r_bus = {
const urj_bus_driver_t urj_bus_sh7750r_bus = {
"sh7750r",
N_("Hitachi SH7750R compatible bus driver via BSR"),
sh7750r_bus_new,

@ -321,7 +321,7 @@ sh7751r_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t sh7751r_bus = {
const urj_bus_driver_t urj_bus_sh7751r_bus = {
"sh7751r",
N_("Hitachi SH7751R compatible bus driver via BSR"),
sh7751r_bus_new,

@ -317,7 +317,7 @@ sharc_21065L_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t sharc_21065L_bus = {
const urj_bus_driver_t urj_bus_sharc_21065L_bus = {
"SHARC_21065L",
N_("SHARC_21065L compatible bus driver via BSR"),
sharc_21065L_bus_new,

@ -444,7 +444,7 @@ slsup3_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
}
}
const urj_bus_driver_t slsup3_bus = {
const urj_bus_driver_t urj_bus_slsup3_bus = {
"slsup3",
N_("SLS UP3 compatible bus driver via BSR"),
slsup3_bus_new,

@ -316,7 +316,7 @@ tx4925_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_tap_chain_shift_data_registers (chain, 0);
}
const urj_bus_driver_t tx4925_bus = {
const urj_bus_driver_t urj_bus_tx4925_bus = {
"tx4925",
N_("Toshiba TX4925 compatible bus driver via BSR"),
tx4925_bus_new,

@ -990,7 +990,7 @@ zefant_xs3_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
}
}
const urj_bus_driver_t zefant_xs3_bus = {
const urj_bus_driver_t urj_bus_zefant_xs3_bus = {
"zefant-xs3",
N_("Simple Solutions Zefant-XS3 Board compatible bus driver via BSR"),
zefant_xs3_bus_new,

@ -73,7 +73,7 @@ cmd_addpart_help (void)
}
urj_cmd_t cmd_addpart = {
urj_cmd_t urj_cmd_addpart = {
"addpart",
N_("manually adds parts on the JTAG chain"),
cmd_addpart_help,

@ -226,7 +226,7 @@ cmd_bit_help (void)
"CSTATE Control state, valid state is only Z\n"), "bit");
}
urj_cmd_t cmd_bit = {
urj_cmd_t urj_cmd_bit = {
"bit",
N_("define new BSR bit"),
cmd_bit_help,

@ -118,7 +118,7 @@ cmd_bsdl_help (void)
"bsdl", "bsdl", "bsdl", "bsdl");
}
urj_cmd_t cmd_bsdl = {
urj_cmd_t urj_cmd_bsdl = {
"bsdl",
N_("manage BSDL files"),
cmd_bsdl_help,

@ -70,7 +70,7 @@ cmd_bus_help (void)
"\n" "BUS bus number\n"), "bus");
}
urj_cmd_t cmd_bus = {
urj_cmd_t urj_cmd_bus = {
"bus",
N_("change active bus"),
cmd_bus_help,

@ -49,11 +49,11 @@ cmd_cable_run (urj_chain_t *chain, char *params[])
return -1;
/* maybe old syntax was used? search connection type driver */
for (i = 0; parport_drivers[i]; i++)
if (strcasecmp (params[1], parport_drivers[i]->type) == 0)
for (i = 0; urj_tap_parport_drivers[i]; i++)
if (strcasecmp (params[1], urj_tap_parport_drivers[i]->type) == 0)
break;
if (parport_drivers[i] != 0)
if (urj_tap_parport_drivers[i] != 0)
{
/* Old syntax was used. Swap params. */
printf (_
@ -71,10 +71,10 @@ cmd_cable_run (urj_chain_t *chain, char *params[])
}
/* search cable driver list */
for (i = 0; cable_drivers[i]; i++)
if (strcasecmp (params[1], cable_drivers[i]->name) == 0)
for (i = 0; urj_tap_cable_drivers[i]; i++)
if (strcasecmp (params[1], urj_tap_cable_drivers[i]->name) == 0)
break;
if (!cable_drivers[i])
if (!urj_tap_cable_drivers[i])
{
printf (_("Unknown cable type: %s\n"), params[1]);
return 1;
@ -84,7 +84,7 @@ cmd_cable_run (urj_chain_t *chain, char *params[])
{
if (strcasecmp (params[2], "help") == 0)
{
cable_drivers[i]->help (cable_drivers[i]->name);
urj_tap_cable_drivers[i]->help (urj_tap_cable_drivers[i]->name);
return 1;
}
}
@ -104,7 +104,7 @@ cmd_cable_run (urj_chain_t *chain, char *params[])
return 1;
}
cable->driver = cable_drivers[i];
cable->driver = urj_tap_cable_drivers[i];
if (cable->driver->connect (++params, cable))
{
@ -142,12 +142,12 @@ cmd_cable_help (void)
"Type \"cable DRIVER help\" for info about options for cable DRIVER.\n"
"\n" "List of supported cables:\n"), "cable");
for (i = 0; cable_drivers[i]; i++)
printf (_("%-13s %s\n"), cable_drivers[i]->name,
_(cable_drivers[i]->description));
for (i = 0; urj_tap_cable_drivers[i]; i++)
printf (_("%-13s %s\n"), urj_tap_cable_drivers[i]->name,
_(urj_tap_cable_drivers[i]->description));
}
urj_cmd_t cmd_cable = {
urj_cmd_t urj_cmd_cable = {
"cable",
N_("select JTAG cable"),
cmd_cable_help,

@ -34,96 +34,96 @@
#include "cmd.h"
extern urj_cmd_t cmd_quit;
extern urj_cmd_t cmd_help;
extern urj_cmd_t cmd_frequency;
extern urj_cmd_t cmd_cable;
extern urj_cmd_t cmd_reset;
extern urj_cmd_t cmd_discovery;
extern urj_cmd_t cmd_idcode;
extern urj_cmd_t cmd_detect;
extern urj_cmd_t cmd_signal;
extern urj_cmd_t cmd_scan;
extern const urj_cmd_t cmd_salias;
extern urj_cmd_t cmd_bit;
extern urj_cmd_t cmd_register;
extern const urj_cmd_t cmd_initbus;
extern urj_cmd_t cmd_print;
extern urj_cmd_t cmd_part;
extern urj_cmd_t cmd_bus;
extern urj_cmd_t cmd_instruction;
extern urj_cmd_t cmd_shift;
extern urj_cmd_t cmd_dr;
extern urj_cmd_t cmd_get;
extern urj_cmd_t cmd_test;
extern urj_cmd_t cmd_shell;
extern urj_cmd_t cmd_set;
extern urj_cmd_t cmd_endian;
extern urj_cmd_t cmd_peek;
extern urj_cmd_t cmd_poke;
extern urj_cmd_t cmd_pod;
extern urj_cmd_t cmd_readmem;
extern urj_cmd_t cmd_writemem;
extern urj_cmd_t cmd_detectflash;
extern urj_cmd_t cmd_flashmem;
extern urj_cmd_t cmd_eraseflash;
extern urj_cmd_t cmd_script;
extern urj_cmd_t cmd_include;
extern urj_cmd_t cmd_addpart;
extern urj_cmd_t cmd_usleep;
extern urj_cmd_t urj_cmd_quit;
extern urj_cmd_t urj_cmd_help;
extern urj_cmd_t urj_cmd_frequency;
extern urj_cmd_t urj_cmd_cable;
extern urj_cmd_t urj_cmd_reset;
extern urj_cmd_t urj_cmd_discovery;
extern urj_cmd_t urj_cmd_idcode;
extern urj_cmd_t urj_cmd_detect;
extern urj_cmd_t urj_cmd_signal;
extern urj_cmd_t urj_cmd_scan;
extern const urj_cmd_t urj_cmd_salias;
extern urj_cmd_t urj_cmd_bit;
extern urj_cmd_t urj_cmd_register;
extern const urj_cmd_t urj_cmd_initbus;
extern urj_cmd_t urj_cmd_print;
extern urj_cmd_t urj_cmd_part;
extern urj_cmd_t urj_cmd_bus;
extern urj_cmd_t urj_cmd_instruction;
extern urj_cmd_t urj_cmd_shift;
extern urj_cmd_t urj_cmd_dr;
extern urj_cmd_t urj_cmd_get;
extern urj_cmd_t urj_cmd_test;
extern urj_cmd_t urj_cmd_shell;
extern urj_cmd_t urj_cmd_set;
extern urj_cmd_t urj_cmd_endian;
extern urj_cmd_t urj_cmd_peek;
extern urj_cmd_t urj_cmd_poke;
extern urj_cmd_t urj_cmd_pod;
extern urj_cmd_t urj_cmd_readmem;
extern urj_cmd_t urj_cmd_writemem;
extern urj_cmd_t urj_cmd_detectflash;
extern urj_cmd_t urj_cmd_flashmem;
extern urj_cmd_t urj_cmd_eraseflash;
extern urj_cmd_t urj_cmd_script;
extern urj_cmd_t urj_cmd_include;
extern urj_cmd_t urj_cmd_addpart;
extern urj_cmd_t urj_cmd_usleep;
#ifdef ENABLE_SVF
extern urj_cmd_t cmd_svf;
extern urj_cmd_t urj_cmd_svf;
#endif
#ifdef ENABLE_BSDL
extern urj_cmd_t cmd_bsdl;
extern urj_cmd_t urj_cmd_bsdl;
#endif
extern urj_cmd_t cmd_debug;
extern urj_cmd_t urj_cmd_debug;
const urj_cmd_t *urj_cmds[] = {
&cmd_quit,
&cmd_help,
&cmd_frequency,
&cmd_cable,
&cmd_reset,
&cmd_discovery,
&cmd_idcode,
&cmd_detect,
&cmd_signal,
&cmd_scan,
&cmd_salias,
&cmd_bit,
&cmd_register,
&cmd_initbus,
&cmd_print,
&cmd_part,
&cmd_bus,
&cmd_instruction,
&cmd_shift,
&cmd_dr,
&cmd_get,
&cmd_test,
&cmd_shell,
&cmd_set,
&cmd_endian,
&cmd_peek,
&cmd_poke,
&cmd_pod,
&cmd_readmem,
&cmd_writemem,
&cmd_detectflash,
&cmd_flashmem,
&cmd_eraseflash,
&cmd_script,
&cmd_include,
&cmd_addpart,
&cmd_usleep,
&urj_cmd_quit,
&urj_cmd_help,
&urj_cmd_frequency,
&urj_cmd_cable,
&urj_cmd_reset,
&urj_cmd_discovery,
&urj_cmd_idcode,
&urj_cmd_detect,
&urj_cmd_signal,
&urj_cmd_scan,
&urj_cmd_salias,
&urj_cmd_bit,
&urj_cmd_register,
&urj_cmd_initbus,
&urj_cmd_print,
&urj_cmd_part,
&urj_cmd_bus,
&urj_cmd_instruction,
&urj_cmd_shift,
&urj_cmd_dr,
&urj_cmd_get,
&urj_cmd_test,
&urj_cmd_shell,
&urj_cmd_set,
&urj_cmd_endian,
&urj_cmd_peek,
&urj_cmd_poke,
&urj_cmd_pod,
&urj_cmd_readmem,
&urj_cmd_writemem,
&urj_cmd_detectflash,
&urj_cmd_flashmem,
&urj_cmd_eraseflash,
&urj_cmd_script,
&urj_cmd_include,
&urj_cmd_addpart,
&urj_cmd_usleep,
#ifdef ENABLE_SVF
&cmd_svf,
&urj_cmd_svf,
#endif
#ifdef ENABLE_BSDL
&cmd_bsdl,
&urj_cmd_bsdl,
#endif
&cmd_debug,
&urj_cmd_debug,
NULL /* last must be NULL */
};

@ -57,7 +57,7 @@ cmd_debug_help (void)
"\n" "n =1 fileio, 2=tap commands, 4 =?\n"), "debug n");
}
urj_cmd_t cmd_debug = {
urj_cmd_t urj_cmd_debug = {
"debug",
N_("debug jtag program"),
cmd_debug_help,

@ -88,7 +88,7 @@ cmd_detect_help (void)
"detect");
}
urj_cmd_t cmd_detect = {
urj_cmd_t urj_cmd_detect = {
"detect",
N_("detect parts on the JTAG chain"),
cmd_detect_help,

@ -62,7 +62,7 @@ cmd_detectflash_help (void)
"urj_flash_detectflash");
}
urj_cmd_t cmd_detectflash = {
urj_cmd_t urj_cmd_detectflash = {
"urj_flash_detectflash",
N_("detect parameters of flash chips attached to a part"),
cmd_detectflash_help,

@ -60,7 +60,7 @@ cmd_discovery_help (void)
"urj_tap_discovery");
}
urj_cmd_t cmd_discovery = {
urj_cmd_t urj_cmd_discovery = {
"urj_tap_discovery",
N_("urj_tap_discovery of unknown parts in the JTAG chain"),
cmd_discovery_help,

@ -122,7 +122,7 @@ cmd_dr_help (void)
"dr", "dr");
}
urj_cmd_t cmd_dr = {
urj_cmd_t urj_cmd_dr = {
"dr",
N_("display active data register for a part"),
cmd_dr_help,

@ -69,7 +69,7 @@ cmd_endian_help (void)
"endian [little|big]");
}
urj_cmd_t cmd_endian = {
urj_cmd_t urj_cmd_endian = {
"endian",
N_("set/print endianess"),
cmd_endian_help,

@ -71,12 +71,12 @@ cmd_eraseflash_help (void)
"ADDR and BLOCKS could be in decimal or hexadecimal (prefixed with 0x) form.\n"
"\n" "Supported Flash Memories:\n"), "eraseflash");
for (i = 0; flash_drivers[i]; i++)
printf (_("%s\n %s\n"), _(flash_drivers[i]->name),
_(flash_drivers[i]->description));
for (i = 0; urj_flash_flash_drivers[i]; i++)
printf (_("%s\n %s\n"), _(urj_flash_flash_drivers[i]->name),
_(urj_flash_flash_drivers[i]->description));
}
urj_cmd_t cmd_eraseflash = {
urj_cmd_t urj_cmd_eraseflash = {
"eraseflash",
N_("erase flash memory by number of blocks"),
cmd_eraseflash_help,

@ -94,12 +94,12 @@ cmd_flashmem_help (void)
"Supported Flash Memories:\n"), "urj_flashmem",
"urj_flashmem msbin", "msbin", "noverify");
for (i = 0; flash_drivers[i]; i++)
printf (_("%s\n %s\n"), _(flash_drivers[i]->name),
_(flash_drivers[i]->description));
for (i = 0; urj_flash_flash_drivers[i]; i++)
printf (_("%s\n %s\n"), _(urj_flash_flash_drivers[i]->name),
_(urj_flash_flash_drivers[i]->description));
}
urj_cmd_t cmd_flashmem = {
urj_cmd_t urj_cmd_flashmem = {
"urj_flashmem",
N_("burn flash memory with data from a file"),
cmd_flashmem_help,

@ -73,7 +73,7 @@ cmd_frequency_help (void)
"Use 0 for FREQ to disable frequency limit.\n"), "frequency");
}
urj_cmd_t cmd_frequency = {
urj_cmd_t urj_cmd_frequency = {
"frequency",
N_("setup JTAG frequency"),
cmd_frequency_help,

@ -84,7 +84,7 @@ cmd_get_help (void)
"get signal");
}
urj_cmd_t cmd_get = {
urj_cmd_t urj_cmd_get = {
"get",
N_("get external signal value"),
cmd_get_help,

@ -72,7 +72,7 @@ cmd_help_help (void)
"help");
}
urj_cmd_t cmd_help = {
urj_cmd_t urj_cmd_help = {
"help",
N_("display this help"),
cmd_help_help,

@ -63,7 +63,7 @@ cmd_idcode_help (void)
"idcode");
}
urj_cmd_t cmd_idcode = {
urj_cmd_t urj_cmd_idcode = {
"idcode",
N_("Read IDCODEs of all parts in a JTAG chain"),
cmd_idcode_help,

@ -132,7 +132,7 @@ cmd_include_help (void)
cmd_include_or_script_help ("include");
}
urj_cmd_t cmd_include = {
urj_cmd_t urj_cmd_include = {
"include",
N_("include command sequence from external repository"),
cmd_include_help,
@ -151,7 +151,7 @@ cmd_script_help (void)
cmd_include_or_script_help ("script");
}
urj_cmd_t cmd_script = {
urj_cmd_t urj_cmd_script = {
"script",
N_("run command sequence from external file"),
cmd_script_help,

@ -54,12 +54,13 @@ cmd_initbus_run (urj_chain_t *chain, char *params[])
return 1;
}
for (i = 0; bus_drivers[i] != NULL; i++)
for (i = 0; urj_bus_drivers[i] != NULL; i++)
{
if (strcasecmp (bus_drivers[i]->name, params[1]) == 0)
if (strcasecmp (urj_bus_drivers[i]->name, params[1]) == 0)
{
urj_bus_t *abus =
bus_drivers[i]->new_bus (chain, bus_drivers[i], params);
urj_bus_t *abus = urj_bus_drivers[i]->new_bus (chain,
urj_bus_drivers[i],
params);
if (abus == NULL)
{
printf (_("bus alloc/attach failed!\n"));
@ -96,12 +97,12 @@ cmd_initbus_help (void)
"BUSNAME Name of the bus\n"
"\n" "List of available buses:\n"), "initbus");
for (i = 0; bus_drivers[i] != NULL; i++)
printf (_("%-10s %s\n"), bus_drivers[i]->name,
bus_drivers[i]->description);
for (i = 0; urj_bus_drivers[i] != NULL; i++)
printf (_("%-10s %s\n"), urj_bus_drivers[i]->name,
urj_bus_drivers[i]->description);
}
const urj_cmd_t cmd_initbus = {
const urj_cmd_t urj_cmd_initbus = {
"initbus",
N_("initialize bus driver for active part"),
cmd_initbus_help,

@ -138,7 +138,7 @@ cmd_instruction_help (void)
"instruction", "instruction", "instruction");
}
urj_cmd_t cmd_instruction = {
urj_cmd_t urj_cmd_instruction = {
"instruction",
N_("change active instruction for a part or declare new instruction"),
cmd_instruction_help,

@ -104,7 +104,7 @@ cmd_part_help (void)
"\n" "bus->part part number | alias\n"), "part");
}
urj_cmd_t cmd_part = {
urj_cmd_t urj_cmd_part = {
"part",
N_("change active part for current JTAG chain"),
cmd_part_help,

@ -88,7 +88,7 @@ cmd_peek_help (void)
"\n"), "peek");
}
urj_cmd_t cmd_peek = {
urj_cmd_t urj_cmd_peek = {
"peek",
N_("read a single word"),
cmd_peek_help,
@ -141,7 +141,7 @@ cmd_poke_help (void)
"\n"), "poke");
}
urj_cmd_t cmd_poke = {
urj_cmd_t urj_cmd_poke = {
"poke",
N_("write a single word"),
cmd_poke_help,

@ -87,7 +87,7 @@ cmd_pod_help (void)
"# 0 or 1\n"), "pod");
}
urj_cmd_t cmd_pod = {
urj_cmd_t urj_cmd_pod = {
"pod",
N_("Set state of POD signal(s)"),
cmd_pod_help,

@ -252,7 +252,7 @@ cmd_print_help (void)
"print");
}
urj_cmd_t cmd_print = {
urj_cmd_t urj_cmd_print = {
"print",
N_("display JTAG chain list/status"),
cmd_print_help,

@ -43,7 +43,7 @@ cmd_quit_help (void)
printf (_("Usage: %s\n" "Exit from %s.\n"), "quit", PACKAGE);
}
urj_cmd_t cmd_quit = {
urj_cmd_t urj_cmd_quit = {
"quit",
N_("exit and terminate this session"),
cmd_quit_help,

@ -77,7 +77,7 @@ cmd_readmem_help (void)
"urj_bus_readmem");
}
urj_cmd_t cmd_readmem = {
urj_cmd_t urj_cmd_readmem = {
"urj_bus_readmem",
N_("read content of the memory and write it to file"),
cmd_readmem_help,

@ -113,7 +113,7 @@ cmd_register_help (void)
"LENGTH Data register length\n"), "register");
}
urj_cmd_t cmd_register = {
urj_cmd_t urj_cmd_register = {
"register",
N_("define new data register for a part"),
cmd_register_help,

@ -52,7 +52,7 @@ cmd_reset_help (void)
printf (_("Usage: %s\n" "Reset current JTAG chain.\n"), "reset");
}
urj_cmd_t cmd_reset = {
urj_cmd_t urj_cmd_reset = {
"reset",
N_("reset JTAG chain"),
cmd_reset_help,

@ -94,7 +94,7 @@ cmd_salias_help (void)
"SIGNAL Existing signal name\n"), "signal");
}
const urj_cmd_t cmd_salias = {
const urj_cmd_t urj_cmd_salias = {
"salias",
N_("define an alias for a signal"),
cmd_salias_help,

@ -134,7 +134,7 @@ cmd_scan_help (void)
"Read BSR and show changes since last scan.\n"), "scan");
}
urj_cmd_t cmd_scan = {
urj_cmd_t urj_cmd_scan = {
"scan",
N_("read BSR and show changes since last scan"),
cmd_scan_help,

@ -101,7 +101,7 @@ cmd_set_help (void)
" is 'out'\n"), "set signal");
}
urj_cmd_t cmd_set = {
urj_cmd_t urj_cmd_set = {
"set",
N_("set external signal value"),
cmd_set_help,

@ -86,7 +86,7 @@ cmd_shell_help (void)
"\n" "CMMD OS Shell Command\n"), "shell cmmd");
}
urj_cmd_t cmd_shell = {
urj_cmd_t urj_cmd_shell = {
"shell",
N_("shell cmmd"),
cmd_shell_help,

@ -64,7 +64,7 @@ cmd_shift_help (void)
"shift ir", "shift dr");
}
urj_cmd_t cmd_shift = {
urj_cmd_t urj_cmd_shift = {
"shift",
N_("shift data/instruction registers through JTAG chain"),
cmd_shift_help,

@ -113,7 +113,7 @@ cmd_signal_help (void)
"PIN# List of pin # for a signal\n"), "signal");
}
urj_cmd_t cmd_signal = {
urj_cmd_t urj_cmd_signal = {
"signal",
N_("define new signal for a part"),
cmd_signal_help,

@ -86,7 +86,7 @@ cmd_svf_help (void)
"\n" "FILE file containing SVF commands\n"), "svf");
}
urj_cmd_t cmd_svf = {
urj_cmd_t urj_cmd_svf = {
"svf",
N_("execute svf commands from file"),
cmd_svf_help,

@ -98,7 +98,7 @@ cmd_test_help (void)
"get signal");
}
urj_cmd_t cmd_test = {
urj_cmd_t urj_cmd_test = {
"test",
N_("test external signal value"),
cmd_test_help,

@ -55,7 +55,7 @@ cmd_usleep_help (void)
"Sleep some number of microseconds.\n"), "usleep");
}
urj_cmd_t cmd_usleep = {
urj_cmd_t urj_cmd_usleep = {
"usleep",
N_("Sleep some number of microseconds"),
cmd_usleep_help,

@ -76,7 +76,7 @@ cmd_writemem_help (void)
"urj_bus_writemem");
}
urj_cmd_t cmd_writemem = {
urj_cmd_t urj_cmd_writemem = {
"urj_bus_writemem",
N_("write content of file to the memory"),
cmd_writemem_help,

@ -47,20 +47,21 @@
static int dbg = 0;
static int amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array,
static int amd_flash_erase_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr);
static int amd_flash_unlock_block (urj_flash_cfi_array_t *cfi_array,
static int amd_flash_unlock_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr);
static int amd_flash_program_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer,
int count);
static int amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int amd_flash_program32 (urj_flash_cfi_array_t *cfi_array,
static int amd_flash_program_single (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr,
uint32_t data);
static int amd_flash_program_buffer (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int amd_flash_program (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static int amd_flash_program32 (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static void amd_flash_read_array (urj_flash_cfi_array_t *cfi_array);
static void amd_flash_read_array (urj_flash_cfi_array_t *urj_flash_cfi_array);
/* The code below assumes a connection of the flash chip address LSB (A0)
* to A0, A1 or A2 of the byte-addressed CPU bus dependent on the bus width.
@ -80,14 +81,15 @@ static void amd_flash_read_array (urj_flash_cfi_array_t *cfi_array);
* driver has to deal with this. - kawk 2008-01 */
static int
amd_flash_address_shift (urj_flash_cfi_array_t *cfi_array)
amd_flash_address_shift (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
if (cfi_array->bus_width == 4)
if (urj_flash_cfi_array->bus_width == 4)
return 2;
/* else: cfi_array->bus_width is 2 (16 bit) or 1 (8 bit): */
/* else: urj_flash_cfi_array->bus_width is 2 (16 bit) or 1 (8 bit): */
switch (cfi_array->cfi_chips[0]->cfi.device_geometry.device_interface)
switch (urj_flash_cfi_array->cfi_chips[0]->cfi.device_geometry.
device_interface)
{
case CFI_INTERFACE_X8_X16: /* regardless whether 8 or 16 bit mode */
case CFI_INTERFACE_X16: /* native */
@ -101,7 +103,7 @@ amd_flash_address_shift (urj_flash_cfi_array_t *cfi_array)
break;
}
if (cfi_array->bus_width == 2)
if (urj_flash_cfi_array->bus_width == 2)
return 1;
return 0;
@ -109,30 +111,30 @@ amd_flash_address_shift (urj_flash_cfi_array_t *cfi_array)
/* autodetect, we can handle this chip */
static int
amd_flash_autodetect32 (urj_flash_cfi_array_t *cfi_array)
amd_flash_autodetect32 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
if (cfi_array->bus_width != 4)
if (urj_flash_cfi_array->bus_width != 4)
return 0;
return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code ==
CFI_VENDOR_AMD_SCS);
return (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_AMD_SCS);
}
static int
amd_flash_autodetect16 (urj_flash_cfi_array_t *cfi_array)
amd_flash_autodetect16 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
if (cfi_array->bus_width != 2)
if (urj_flash_cfi_array->bus_width != 2)
return 0;
return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code ==
CFI_VENDOR_AMD_SCS);
return (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_AMD_SCS);
}
static int
amd_flash_autodetect8 (urj_flash_cfi_array_t *cfi_array)
amd_flash_autodetect8 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
if (cfi_array->bus_width != 1)
if (urj_flash_cfi_array->bus_width != 1)
return 0;
return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code ==
CFI_VENDOR_AMD_SCS);
return (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_AMD_SCS);
}
/*
@ -145,10 +147,11 @@ amd_flash_autodetect8 (urj_flash_cfi_array_t *cfi_array)
*/
#if 0
static int
amdstatus29 (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data)
amdstatus29 (urj_flash_cfi_array_t *urj_flash_cfi_array, uint32_t adr,
int data)
{
urj_bus_t *bus = cfi_array->bus;
int o = amd_flash_address_shift (cfi_array);
urj_bus_t *bus = urj_flash_cfi_array->bus;
int o = amd_flash_address_shift (urj_flash_cfi_array);
int timeout;
uint32_t dq7mask = ((1 << 7) << 16) + (1 << 7);
uint32_t dq5mask = ((1 << 5) << 16) + (1 << 5);
@ -184,9 +187,9 @@ amdstatus29 (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data)
* second implementation: see [1], page 30
*/
static int
amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data)
amdstatus (urj_flash_cfi_array_t *urj_flash_cfi_array, uint32_t adr, int data)
{
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
int timeout;
uint32_t togglemask = ((1 << 6) << 16) + (1 << 6); /* DQ 6 */
@ -221,10 +224,10 @@ amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data)
* second implementation: see [1], page 30
*/
static int
amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data)
amdstatus (urj_flash_cfi_array_t *urj_flash_cfi_array, uint32_t adr, int data)
{
urj_bus_t *bus = cfi_array->bus;
int o = amd_flash_address_shift (cfi_array);
urj_bus_t *bus = urj_flash_cfi_array->bus;
int o = amd_flash_address_shift (urj_flash_cfi_array);
int timeout;
uint32_t togglemask = ((1 << 6) << 16) + (1 << 6); /* DQ 6 */
/* int dq5mask = ((1 << 5) << 16) + (1 << 5); DQ5 */
@ -266,14 +269,17 @@ amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data)
#if 0
static int
amdisprotected (parts * ps, urj_flash_cfi_array_t *cfi_array, uint32_t adr)
amdisprotected (parts * ps, urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
uint32_t data;
int o = amd_flash_address_shift (cfi_array);
int o = amd_flash_address_shift (urj_flash_cfi_array);
URJ_BUS_WRITE (ps, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (ps, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (ps, cfi_array->address + (0x0555 << o), 0x00900090);
URJ_BUS_WRITE (ps, urj_flash_cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (ps, urj_flash_cfi_array->address + (0x02aa << o),
0x00550055);
URJ_BUS_WRITE (ps, urj_flash_cfi_array->address + (0x0555 << o),
0x00900090);
data = URJ_BUS_READ (ps, adr + (0x0002 << 2));
/* Read Array */
@ -284,19 +290,26 @@ amdisprotected (parts * ps, urj_flash_cfi_array_t *cfi_array, uint32_t adr)
#endif /* 0 */
static void
amd_flash_print_info (urj_flash_cfi_array_t *cfi_array)
amd_flash_print_info (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
int mid, cid, prot;
urj_bus_t *bus = cfi_array->bus;
int o = amd_flash_address_shift (cfi_array);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29 */
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00900090);
mid = URJ_BUS_READ (bus, cfi_array->address + (0x00 << o)) & 0xFFFF;
cid = URJ_BUS_READ (bus, cfi_array->address + (0x01 << o)) & 0xFFFF;
prot = URJ_BUS_READ (bus, cfi_array->address + (0x02 << o)) & 0xFF;
amd_flash_read_array (cfi_array); /* AMD reset */
urj_bus_t *bus = urj_flash_cfi_array->bus;
int o = amd_flash_address_shift (urj_flash_cfi_array);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29 */
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x02aa << o),
0x00550055);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o),
0x00900090);
mid =
URJ_BUS_READ (bus,
urj_flash_cfi_array->address + (0x00 << o)) & 0xFFFF;
cid =
URJ_BUS_READ (bus,
urj_flash_cfi_array->address + (0x01 << o)) & 0xFFFF;
prot =
URJ_BUS_READ (bus, urj_flash_cfi_array->address + (0x02 << o)) & 0xFF;
amd_flash_read_array (urj_flash_cfi_array); /* AMD reset */
printf (_("Chip: AMD Flash\n\tManufacturer: "));
switch (mid)
{
@ -388,76 +401,85 @@ amd_flash_print_info (urj_flash_cfi_array_t *cfi_array)
printf (_("\n\tProtected: %04x\n"), prot);
/* Read Array */
URJ_BUS_WRITE (bus, cfi_array->address + (0x0000 << o), 0x00ff00ff);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0000 << o),
0x00ff00ff);
}
static int
amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
amd_flash_erase_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
urj_bus_t *bus = cfi_array->bus;
int o = amd_flash_address_shift (cfi_array);
urj_bus_t *bus = urj_flash_cfi_array->bus;
int o = amd_flash_address_shift (urj_flash_cfi_array);
printf ("flash_erase_block 0x%08X\n", adr);
/* printf("protected: %d\n", amdisprotected(ps, cfi_array, adr)); */
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00800080);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa);
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
/* printf("protected: %d\n", amdisprotected(ps, urj_flash_cfi_array, adr)); */
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x02aa << o),
0x00550055);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o),
0x00800080);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o),
0x00aa00aa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x02aa << o),
0x00550055);
URJ_BUS_WRITE (bus, adr, 0x00300030);
if (amdstatus (cfi_array, adr, 0xffff))
if (amdstatus (urj_flash_cfi_array, adr, 0xffff))
{
printf ("flash_erase_block 0x%08X DONE\n", adr);
amd_flash_read_array (cfi_array); /* AMD reset */
amd_flash_read_array (urj_flash_cfi_array); /* AMD reset */
return 0;
}
printf ("flash_erase_block 0x%08X FAILED\n", adr);
/* Read Array */
amd_flash_read_array (cfi_array); /* AMD reset */
amd_flash_read_array (urj_flash_cfi_array); /* AMD reset */
return URJ_FLASH_ERROR_UNKNOWN;
}
static int
amd_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
amd_flash_unlock_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
printf ("flash_unlock_block 0x%08X IGNORE\n", adr);
return 0;
}
static int
amd_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data)
amd_flash_program_single (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t data)
{
int status;
urj_bus_t *bus = cfi_array->bus;
int o = amd_flash_address_shift (cfi_array);
urj_bus_t *bus = urj_flash_cfi_array->bus;
int o = amd_flash_address_shift (urj_flash_cfi_array);
if (dbg)
printf ("\nflash_program 0x%08X = 0x%08X\n", adr, data);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, program */
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00A000A0);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, program */
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x02aa << o),
0x00550055);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o),
0x00A000A0);
URJ_BUS_WRITE (bus, adr, data);
status = amdstatus (cfi_array, adr, data);
status = amdstatus (urj_flash_cfi_array, adr, data);
/* amd_flash_read_array(ps); */
return !status;
}
static int
amd_program_buffer_status (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data)
amd_program_buffer_status (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t data)
{
/* NOTE: Status polling according to [3], Figure 1.
The current method for status polling is not compatible with 32 bit (2x16) configurations
since it only checks the DQ7 bit of the lower chip. */
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
int timeout;
const uint32_t dq7mask = (1 << 7);
const uint32_t dq5mask = (1 << 5);
@ -486,14 +508,14 @@ amd_program_buffer_status (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
amd_flash_program_buffer (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count)
{
/* NOTE: Write buffer programming operation according to [3], Figure 1. */
int status;
urj_bus_t *bus = cfi_array->bus;
urj_flash_cfi_chip_t *cfi_chip = cfi_array->cfi_chips[0];
int o = amd_flash_address_shift (cfi_array);
urj_bus_t *bus = urj_flash_cfi_array->bus;
urj_flash_cfi_chip_t *cfi_chip = urj_flash_cfi_array->cfi_chips[0];
int o = amd_flash_address_shift (urj_flash_cfi_array);
int wb_bytes = cfi_chip->cfi.device_geometry.max_bytes_write;
int chip_width = cfi_chip->width;
int offset = 0;
@ -512,8 +534,10 @@ amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
if (wcount > count)
wcount = count;
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa);
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x0555 << o),
0x00aa00aa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0x02aa << o),
0x00550055);
URJ_BUS_WRITE (bus, adr, 0x00250025);
URJ_BUS_WRITE (bus, sa, wcount - 1);
@ -521,7 +545,7 @@ amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
for (idx = 0; idx < wcount; idx++)
{
URJ_BUS_WRITE (bus, adr, buffer[offset + idx]);
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
offset += wcount;
@ -529,7 +553,8 @@ amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
URJ_BUS_WRITE (bus, sa, 0x00290029);
status =
amd_program_buffer_status (cfi_array, adr - cfi_array->bus_width,
amd_program_buffer_status (urj_flash_cfi_array,
adr - urj_flash_cfi_array->bus_width,
buffer[offset - 1]);
/* amd_flash_read_array(ps); */
if (status != 1)
@ -542,10 +567,11 @@ amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
amd_flash_program (urj_flash_cfi_array_t *urj_flash_cfi_array, uint32_t adr,
uint32_t *buffer, int count)
{
urj_flash_cfi_query_structure_t *cfi = &(cfi_array->cfi_chips[0]->cfi);
urj_flash_cfi_query_structure_t *cfi =
&(urj_flash_cfi_array->cfi_chips[0]->cfi);
int max_bytes_write = cfi->device_geometry.max_bytes_write;
#ifndef FLASH_MULTI_BYTE
@ -554,7 +580,8 @@ amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
/* multi-byte writes supported? */
if (max_bytes_write > 1)
return amd_flash_program_buffer (cfi_array, adr, buffer, count);
return amd_flash_program_buffer (urj_flash_cfi_array, adr, buffer,
count);
else
{
@ -563,11 +590,11 @@ amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
for (idx = 0; idx < count; idx++)
{
int status =
amd_flash_program_single (cfi_array, adr, buffer[idx]);
int status = amd_flash_program_single (urj_flash_cfi_array, adr,
buffer[idx]);
if (status)
return status;
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
}
@ -575,8 +602,8 @@ amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
amd_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
amd_flash_program32 (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count)
{
/* Single byte programming is forced for 32 bit (2x16) flash configuration.
a) lack of testing capbilities for 2x16 multi-byte write operation
@ -588,23 +615,24 @@ amd_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
/* unroll buffer to single writes */
for (idx = 0; idx < count; idx++)
{
int status = amd_flash_program_single (cfi_array, adr, buffer[idx]);
int status =
amd_flash_program_single (urj_flash_cfi_array, adr, buffer[idx]);
if (status)
return status;
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
return 0;
}
static void
amd_flash_read_array (urj_flash_cfi_array_t *cfi_array)
amd_flash_read_array (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
/* Read Array */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address, 0x00F000F0); /* AMD reset */
URJ_BUS_WRITE (urj_flash_cfi_array->bus, urj_flash_cfi_array->address, 0x00F000F0); /* AMD reset */
}
urj_flash_driver_t amd_32_flash_driver = {
urj_flash_driver_t urj_flash_amd_32_flash_driver = {
4, /* buswidth */
N_("AMD/Fujitsu Standard Command Set"),
N_("supported: AMD 29LV640D, 29LV641D, 29LV642D; 2x16 Bit"),
@ -616,7 +644,7 @@ urj_flash_driver_t amd_32_flash_driver = {
amd_flash_read_array,
};
urj_flash_driver_t amd_16_flash_driver = {
urj_flash_driver_t urj_flash_amd_16_flash_driver = {
2, /* buswidth */
N_("AMD/Fujitsu Standard Command Set"),
N_("supported: AMD 29LV800B, S92GLxxxN; MX29LV640B; 1x16 Bit"),
@ -628,7 +656,7 @@ urj_flash_driver_t amd_16_flash_driver = {
amd_flash_read_array,
};
urj_flash_driver_t amd_8_flash_driver = {
urj_flash_driver_t urj_flash_amd_8_flash_driver = {
1, /* buswidth */
N_("AMD/Fujitsu Standard Command Set"),
N_("supported: AMD 29LV160, AMD 29LV065D, AMD 29LV040B, S92GLxxxN; 1x8 Bit"),

@ -75,35 +75,39 @@ static struct
var_forced_detection;
int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
static int amd_29xx040_autodetect (urj_flash_cfi_array_t *cfi_array);
urj_flash_cfi_array_t **urj_flash_cfi_array);
static int amd_29xx040_autodetect (urj_flash_cfi_array_t
*urj_flash_cfi_array);
static int amd_29xx040_status (urj_bus_t *bus, uint32_t adr,
unsigned short data);
static void amd_29xx040_print_info (urj_flash_cfi_array_t *cfi_array);
static void amd_29xx040_read_array (urj_flash_cfi_array_t *cfi_array);
static int amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int amd_29xx040_program (urj_flash_cfi_array_t *cfi_array,
static void amd_29xx040_print_info (urj_flash_cfi_array_t
*urj_flash_cfi_array);
static void amd_29xx040_read_array (urj_flash_cfi_array_t
*urj_flash_cfi_array);
static int amd_29xx040_erase_block (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr);
static int amd_29xx040_program_single (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr,
uint32_t data);
static int amd_29xx040_program (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static int amd_29xx040_unlock_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int amd_29xx040_unlock_block (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr);
int
urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
urj_flash_cfi_array_t **urj_flash_cfi_array)
{
int mid;
int did;
urj_bus_area_t area;
urj_flash_cfi_query_structure_t *cfi;
if (!cfi_array || !bus)
if (!urj_flash_cfi_array || !bus)
return -1; /* invalid parameters */
*cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*cfi_array)
*urj_flash_cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*urj_flash_cfi_array)
return -2; /* out of memory */
URJ_BUS_WRITE (bus, adr + 0x0, 0xf0);
@ -131,26 +135,27 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
break;
}
(*cfi_array)->bus = bus;
(*cfi_array)->address = 0;
(*urj_flash_cfi_array)->bus = bus;
(*urj_flash_cfi_array)->address = 0;
if (URJ_BUS_AREA (bus, adr + 0, &area) != URJ_STATUS_OK)
return -8; /* bus width detection failed */
unsigned int bw = area.width;
int ba, i;
if (bw != 8 && bw != 16 && bw != 32)
return -3; /* invalid bus width */
(*cfi_array)->bus_width = ba = bw / 8;
(*cfi_array)->cfi_chips = calloc (ba, sizeof (urj_flash_cfi_chip_t *));
if (!(*cfi_array)->cfi_chips)
(*urj_flash_cfi_array)->bus_width = ba = bw / 8;
(*urj_flash_cfi_array)->cfi_chips =
calloc (ba, sizeof (urj_flash_cfi_chip_t *));
if (!(*urj_flash_cfi_array)->cfi_chips)
return -2;
for (i = 0; i < ba; i++)
{
(*cfi_array)->cfi_chips[i] =
(*urj_flash_cfi_array)->cfi_chips[i] =
calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*cfi_array)->cfi_chips[i])
if (!(*urj_flash_cfi_array)->cfi_chips[i])
return -2; /* out of memory */
(*cfi_array)->cfi_chips[i]->width = 1; //ba;
cfi = &(*cfi_array)->cfi_chips[i]->cfi;
(*urj_flash_cfi_array)->cfi_chips[i]->width = 1; //ba;
cfi = &(*urj_flash_cfi_array)->cfi_chips[i]->cfi;
cfi->identification_string.pri_id_code = CFI_VENDOR_NULL;
cfi->identification_string.pri_vendor_tbl = NULL;
@ -178,7 +183,7 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
static int
amd_29xx040_autodetect (urj_flash_cfi_array_t *cfi_array)
amd_29xx040_autodetect (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
return (var_forced_detection.flash == AMD_29xx040B); //Non-CFI Am29xx040B flash
}
@ -221,23 +226,23 @@ amd_29xx040_status (urj_bus_t *bus, uint32_t adr, unsigned short data)
static void
amd_29xx040_print_info (urj_flash_cfi_array_t *cfi_array)
amd_29xx040_print_info (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
int mid, did, prot;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address + 0x0, 0xf0);
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x90);
mid = URJ_BUS_READ (bus, cfi_array->address + 0x0);
did = URJ_BUS_READ (bus, cfi_array->address + 0x1);
prot = URJ_BUS_READ (bus, cfi_array->address + 0x2);
URJ_BUS_WRITE (bus, cfi_array->address + 0x0, 0xf0);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x0, 0xf0);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0x90);
mid = URJ_BUS_READ (bus, urj_flash_cfi_array->address + 0x0);
did = URJ_BUS_READ (bus, urj_flash_cfi_array->address + 0x1);
prot = URJ_BUS_READ (bus, urj_flash_cfi_array->address + 0x2);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x0, 0xf0);
printf ("%s: mid %x, did %x\n", __FUNCTION__, mid, did);
// amd_29xx040_read_array( cfi_array ); /* AMD reset */
// amd_29xx040_read_array( urj_flash_cfi_array ); /* AMD reset */
switch (mid)
{
@ -267,26 +272,29 @@ amd_29xx040_print_info (urj_flash_cfi_array_t *cfi_array)
}
static void
amd_29xx040_read_array (urj_flash_cfi_array_t *cfi_array)
amd_29xx040_read_array (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
/* Read Array */
if (var_forced_detection.unlock_bypass == AMD_BYPASS_UNLOCK_MODE)
{
/* @@@@ RFHH: changed this without understanding */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x555, 0x90);
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x2AA, 0x00);
URJ_BUS_WRITE (urj_flash_cfi_array->bus,
urj_flash_cfi_array->address + 0x555, 0x90);
URJ_BUS_WRITE (urj_flash_cfi_array->bus,
urj_flash_cfi_array->address + 0x2AA, 0x00);
usleep (100);
var_forced_detection.unlock_bypass = AMD_STANDARD_MODE;
}
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x0, 0x0F0); /* AMD reset */
URJ_BUS_WRITE (urj_flash_cfi_array->bus, urj_flash_cfi_array->address + 0x0, 0x0F0); /* AMD reset */
}
static int
amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
amd_29xx040_erase_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
printf ("flash_erase_block 0x%08X\n", adr);
@ -294,41 +302,41 @@ amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
if (var_forced_detection.unlock_bypass == AMD_BYPASS_UNLOCK_MODE)
{
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x90);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x00);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0x90);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x2AA, 0x00);
usleep (100);
var_forced_detection.unlock_bypass = AMD_STANDARD_MODE;
}
URJ_BUS_WRITE (bus, cfi_array->address + 0x0, 0xf0);
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x80);
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55);
// URJ_BUS_WRITE( bus, cfi_array->address + 0x555, 0x10 ); //Chip Erase
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x0, 0xf0);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0x80);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x2AA, 0x55);
// URJ_BUS_WRITE( bus, urj_flash_cfi_array->address + 0x555, 0x10 ); //Chip Erase
URJ_BUS_WRITE (bus, adr, 0x30); //Sector erase
if (amd_29xx040_status (bus, adr, 0xff))
{
printf ("flash_erase_block 0x%08X DONE\n", adr);
amd_29xx040_read_array (cfi_array); /* AMD reset */
amd_29xx040_read_array (urj_flash_cfi_array); /* AMD reset */
return ERASE_FLASH_SUCCESS;
}
printf ("flash_erase_block 0x%08X FAILED\n", adr);
/* Read Array */
amd_29xx040_read_array (cfi_array); /* AMD reset */
amd_29xx040_read_array (urj_flash_cfi_array); /* AMD reset */
return FLASH_ERASE_ERROR;
}
static int
amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data)
amd_29xx040_program_single (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t data)
{
int status;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
if (0)
printf ("\nflash_program 0x%08X = 0x%08X\n", adr, data);
@ -336,54 +344,56 @@ amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
{
if (var_forced_detection.unlock_bypass != AMD_BYPASS_UNLOCK_MODE)
{
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x20);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0x20);
usleep (1000);
var_forced_detection.unlock_bypass = AMD_BYPASS_UNLOCK_MODE;
}
}
else
{
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x2AA, 0x55);
}
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xA0);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + 0x555, 0xA0);
URJ_BUS_WRITE (bus, adr, data);
status = amd_29xx040_status (bus, adr, data);
/* amd_29xx040_read_array(cfi_array); */
/* amd_29xx040_read_array(urj_flash_cfi_array); */
return !status;
}
static int
amd_29xx040_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
amd_29xx040_program (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count)
{
int idx;
/* unroll buffer to single writes */
for (idx = 0; idx < count; idx++)
{
int status = amd_29xx040_program_single (cfi_array, adr, buffer[idx]);
int status = amd_29xx040_program_single (urj_flash_cfi_array, adr,
buffer[idx]);
if (status)
return status;
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
return 0;
}
static int
amd_29xx040_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
amd_29xx040_unlock_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
printf ("flash_unlock_block 0x%08X IGNORE\n", adr);
return 0;
}
urj_flash_driver_t amd_29xx040_flash_driver = {
urj_flash_driver_t urj_flash_amd_29xx040_flash_driver = {
1, /* buswidth */
N_("AMD Standard Command Set"),
N_("supported: AMD 29LV040B, 29C040B, 1x8 Bit"),

@ -39,37 +39,37 @@
#include <bus.h>
void
urj_flash_cfi_array_free (urj_flash_cfi_array_t *cfi_array)
urj_flash_cfi_array_free (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
if (!cfi_array)
if (!urj_flash_cfi_array)
return;
if (cfi_array->cfi_chips)
if (urj_flash_cfi_array->cfi_chips)
{
int i;
for (i = 0; i < cfi_array->bus_width; i++)
for (i = 0; i < urj_flash_cfi_array->bus_width; i++)
{
if (!cfi_array->cfi_chips[i])
if (!urj_flash_cfi_array->cfi_chips[i])
continue;
free (cfi_array->cfi_chips[i]->cfi.device_geometry.
free (urj_flash_cfi_array->cfi_chips[i]->cfi.device_geometry.
erase_block_regions);
if (cfi_array->cfi_chips[i]->cfi.identification_string.
if (urj_flash_cfi_array->cfi_chips[i]->cfi.identification_string.
pri_vendor_tbl)
free (cfi_array->cfi_chips[i]->cfi.identification_string.
pri_vendor_tbl);
free (cfi_array->cfi_chips[i]);
free (urj_flash_cfi_array->cfi_chips[i]->cfi.
identification_string.pri_vendor_tbl);
free (urj_flash_cfi_array->cfi_chips[i]);
}
free (cfi_array->cfi_chips);
free (urj_flash_cfi_array->cfi_chips);
}
free (cfi_array);
free (urj_flash_cfi_array);
}
int
urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
urj_flash_cfi_array_t **urj_flash_cfi_array)
{
unsigned int bw; /* bus width */
unsigned int d; /* data offset */
@ -77,23 +77,24 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
int ma; /* flash mode address multiplier */
urj_bus_area_t area;
if (!cfi_array || !bus)
if (!urj_flash_cfi_array || !bus)
return -1; /* invalid parameters */
*cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*cfi_array)
*urj_flash_cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*urj_flash_cfi_array)
return -2; /* out of memory */
(*cfi_array)->bus = bus;
(*cfi_array)->address = adr;
(*urj_flash_cfi_array)->bus = bus;
(*urj_flash_cfi_array)->address = adr;
if (URJ_BUS_AREA (bus, adr, &area) != URJ_STATUS_OK)
return -8; /* bus width detection failed */
bw = area.width;
if (bw != 8 && bw != 16 && bw != 32)
return -3; /* invalid bus width */
(*cfi_array)->bus_width = ba = bw / 8;
(*cfi_array)->cfi_chips = calloc (ba, sizeof (urj_flash_cfi_chip_t *));
if (!(*cfi_array)->cfi_chips)
(*urj_flash_cfi_array)->bus_width = ba = bw / 8;
(*urj_flash_cfi_array)->cfi_chips =
calloc (ba, sizeof (urj_flash_cfi_chip_t *));
if (!(*urj_flash_cfi_array)->cfi_chips)
return -2; /* out of memory */
for (d = 0; d < bw; d += 8)
@ -134,14 +135,14 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
return -6; /* CFI not detected (Y) */
}
(*cfi_array)->cfi_chips[d / 8] =
(*urj_flash_cfi_array)->cfi_chips[d / 8] =
calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*cfi_array)->cfi_chips[d / 8])
if (!(*urj_flash_cfi_array)->cfi_chips[d / 8])
{
write1 (0, CFI_CMD_READ_ARRAY1);
return -2; /* out of memory */
}
cfi = &(*cfi_array)->cfi_chips[d / 8]->cfi;
cfi = &(*urj_flash_cfi_array)->cfi_chips[d / 8]->cfi;
/* Identification string - see Table 6 in [1] */
cfi->identification_string.pri_id_code = read2 (PRI_VENDOR_ID_OFFSET);
@ -408,31 +409,31 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
case CFI_INTERFACE_X8:
if (ma != 1)
return -7; /* error in device detection */
(*cfi_array)->cfi_chips[d / 8]->width = 1;
(*urj_flash_cfi_array)->cfi_chips[d / 8]->width = 1;
break;
case CFI_INTERFACE_X16:
if (ma != 1)
return -7; /* error in device detection */
(*cfi_array)->cfi_chips[d / 8]->width = 2;
(*urj_flash_cfi_array)->cfi_chips[d / 8]->width = 2;
d += 8;
break;
case CFI_INTERFACE_X8_X16:
if (ma != 1 && ma != 2)
return -7; /* error in device detection */
(*cfi_array)->cfi_chips[d / 8]->width = 2 / ma;
(*urj_flash_cfi_array)->cfi_chips[d / 8]->width = 2 / ma;
if (ma == 1)
d += 8;
break;
case CFI_INTERFACE_X32:
if (ma != 1)
return -7; /* error in device detection */
(*cfi_array)->cfi_chips[d / 8]->width = 4;
(*urj_flash_cfi_array)->cfi_chips[d / 8]->width = 4;
d += 24;
break;
case CFI_INTERFACE_X16_X32:
if (ma != 1 && ma != 2)
return -7; /* error in device detection */
(*cfi_array)->cfi_chips[d / 8]->width = 4 / ma;
(*urj_flash_cfi_array)->cfi_chips[d / 8]->width = 4 / ma;
if (ma == 1)
d += 24;
else

@ -41,7 +41,7 @@
#include "jedec.h"
urj_flash_cfi_array_t *cfi_array = NULL;
urj_flash_cfi_array_t *urj_flash_cfi_array = NULL;
void
urj_flash_detectflash (urj_bus_t *bus, uint32_t adr)
@ -55,41 +55,42 @@ urj_flash_detectflash (urj_bus_t *bus, uint32_t adr)
return;
}
urj_flash_cfi_array_free (cfi_array);
cfi_array = NULL;
urj_flash_cfi_array_free (urj_flash_cfi_array);
urj_flash_cfi_array = NULL;
URJ_BUS_PREPARE (bus);
if (urj_flash_cfi_detect (bus, adr, &cfi_array))
if (urj_flash_cfi_detect (bus, adr, &urj_flash_cfi_array))
{
urj_flash_cfi_array_free (cfi_array);
cfi_array = NULL;
if (urj_flash_jedec_detect (bus, adr, &cfi_array) != 0)
urj_flash_cfi_array_free (urj_flash_cfi_array);
urj_flash_cfi_array = NULL;
if (urj_flash_jedec_detect (bus, adr, &urj_flash_cfi_array) != 0)
{
urj_flash_cfi_array_free (cfi_array);
cfi_array = NULL;
if (urj_flash_amd_detect (bus, adr, &cfi_array) != 0)
urj_flash_cfi_array_free (urj_flash_cfi_array);
urj_flash_cfi_array = NULL;
if (urj_flash_amd_detect (bus, adr, &urj_flash_cfi_array) != 0)
{
urj_flash_cfi_array_free (cfi_array);
cfi_array = NULL;
urj_flash_cfi_array_free (urj_flash_cfi_array);
urj_flash_cfi_array = NULL;
#ifdef JEDEC_EXP
if (urj_flash_jedec_exp_detect (bus, adr, &cfi_array))
if (urj_flash_jedec_exp_detect
(bus, adr, &urj_flash_cfi_array))
{
urj_flash_cfi_array_free (cfi_array);
cfi_array = NULL;
urj_flash_cfi_array_free (urj_flash_cfi_array);
urj_flash_cfi_array = NULL;
}
#endif
}
}
}
if (cfi_array == NULL)
if (urj_flash_cfi_array == NULL)
{
printf (_("Flash not found!\n"));
return;
}
cfi = &cfi_array->cfi_chips[0]->cfi;
cfi = &urj_flash_cfi_array->cfi_chips[0]->cfi;
/* detect CFI capable devices */
/* TODO: Low chip only */

@ -46,26 +46,26 @@
#include "flash.h"
#include "jtag.h"
extern urj_flash_driver_t amd_32_flash_driver;
extern urj_flash_driver_t amd_16_flash_driver;
extern urj_flash_driver_t amd_8_flash_driver;
extern urj_flash_driver_t intel_32_flash_driver;
extern urj_flash_driver_t intel_16_flash_driver;
extern urj_flash_driver_t intel_8_flash_driver;
extern urj_flash_driver_t amd_29xx040_flash_driver; //20/09/2006
urj_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,
&intel_8_flash_driver,
&amd_29xx040_flash_driver, //20/09/2006
extern urj_flash_driver_t urj_flash_amd_32_flash_driver;
extern urj_flash_driver_t urj_flash_amd_16_flash_driver;
extern urj_flash_driver_t urj_flash_amd_8_flash_driver;
extern urj_flash_driver_t urj_flash_intel_32_flash_driver;
extern urj_flash_driver_t urj_flash_intel_16_flash_driver;
extern urj_flash_driver_t urj_flash_intel_8_flash_driver;
extern urj_flash_driver_t urj_flash_amd_29xx040_flash_driver; //20/09/2006
urj_flash_driver_t *urj_flash_flash_drivers[] = {
&urj_flash_amd_32_flash_driver,
&urj_flash_amd_16_flash_driver,
&urj_flash_amd_8_flash_driver,
&urj_flash_intel_32_flash_driver,
&urj_flash_intel_16_flash_driver,
&urj_flash_intel_8_flash_driver,
&urj_flash_amd_29xx040_flash_driver, //20/09/2006
NULL
};
extern urj_flash_cfi_array_t *cfi_array;
extern urj_flash_cfi_array_t *urj_flash_cfi_array;
static urj_flash_driver_t *flash_driver = NULL;
static void
@ -75,15 +75,15 @@ set_flash_driver (void)
urj_flash_cfi_query_structure_t *cfi;
flash_driver = NULL;
if (cfi_array == NULL)
if (urj_flash_cfi_array == NULL)
return;
cfi = &cfi_array->cfi_chips[0]->cfi;
cfi = &urj_flash_cfi_array->cfi_chips[0]->cfi;
for (i = 0; flash_drivers[i] != NULL; i++)
if (flash_drivers[i]->autodetect (cfi_array))
for (i = 0; urj_flash_flash_drivers[i] != NULL; i++)
if (urj_flash_flash_drivers[i]->autodetect (urj_flash_cfi_array))
{
flash_driver = flash_drivers[i];
flash_driver->print_info (cfi_array);
flash_driver = urj_flash_flash_drivers[i];
flash_driver->print_info (urj_flash_cfi_array);
return;
}
@ -101,12 +101,12 @@ urj_flashmsbin (urj_bus_t *bus, FILE * f, int noverify)
urj_flash_cfi_query_structure_t *cfi;
set_flash_driver ();
if (!cfi_array || !flash_driver)
if (!urj_flash_cfi_array || !flash_driver)
{
printf (_("no flash driver found\n"));
return;
}
cfi = &cfi_array->cfi_chips[0]->cfi;
cfi = &urj_flash_cfi_array->cfi_chips[0]->cfi;
/* test sync bytes */
{
@ -143,10 +143,10 @@ urj_flashmsbin (urj_bus_t *bus, FILE * f, int noverify)
first *
cfi->device_geometry.erase_block_regions[0].erase_block_size *
2;
flash_driver->unlock_block (cfi_array, adr);
flash_driver->unlock_block (urj_flash_cfi_array, adr);
printf (_("block %d unlocked\n"), first);
printf (_("erasing block %d: %d\n"), first,
flash_driver->erase_block (cfi_array, adr));
flash_driver->erase_block (urj_flash_cfi_array, adr));
}
}
@ -182,7 +182,7 @@ urj_flashmsbin (urj_bus_t *bus, FILE * f, int noverify)
printf ("\r");
fflush (stdout);
fread (&data, sizeof data, 1, f);
if (flash_driver->program (cfi_array, a, &data, 1))
if (flash_driver->program (urj_flash_cfi_array, a, &data, 1))
{
printf (_("\nflash error\n"));
return;
@ -193,7 +193,7 @@ urj_flashmsbin (urj_bus_t *bus, FILE * f, int noverify)
}
printf ("\n");
flash_driver->readarray (cfi_array);
flash_driver->readarray (urj_flash_cfi_array);
if (noverify)
{
@ -298,15 +298,15 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
uint32_t write_buffer_adr;
set_flash_driver ();
if (!cfi_array || !flash_driver)
if (!urj_flash_cfi_array || !flash_driver)
{
printf (_("no flash driver found\n"));
return;
}
cfi = &cfi_array->cfi_chips[0]->cfi;
cfi = &urj_flash_cfi_array->cfi_chips[0]->cfi;
bus_width = cfi_array->bus_width;
chip_width = cfi_array->cfi_chips[0]->width;
bus_width = urj_flash_cfi_array->bus_width;
chip_width = urj_flash_cfi_array->cfi_chips[0]->width;
for (i = 0, neb = 0; i < cfi->device_geometry.number_of_erase_regions;
i++)
@ -331,7 +331,8 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
uint8_t b[BSIZE];
int bc = 0, bn = 0, btr = BSIZE;
int block_no =
find_block (cfi, adr - cfi_array->address, bus_width, chip_width,
find_block (cfi, adr - urj_flash_cfi_array->address, bus_width,
chip_width,
&btr);
write_buffer_count = 0;
@ -343,10 +344,10 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
if (bn > 0 && !erased[block_no])
{
flash_driver->unlock_block (cfi_array, adr);
flash_driver->unlock_block (urj_flash_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));
flash_driver->erase_block (urj_flash_cfi_array, adr));
erased[block_no] = 1;
}
@ -375,7 +376,7 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
if (write_buffer_count > 0)
if (flash_driver->
program (cfi_array, write_buffer_adr, write_buffer,
program (urj_flash_cfi_array, write_buffer_adr, write_buffer,
write_buffer_count))
{
printf (_("\nflash error\n"));
@ -387,7 +388,7 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
printf (_("addr: 0x%08X\n"), adr - flash_driver->bus_width);
flash_driver->readarray (cfi_array);
flash_driver->readarray (urj_flash_cfi_array);
if (noverify)
{
@ -448,15 +449,15 @@ urj_flasherase (urj_bus_t *bus, uint32_t addr, int number)
int chip_width;
set_flash_driver ();
if (!cfi_array || !flash_driver)
if (!urj_flash_cfi_array || !flash_driver)
{
printf (_("no flash driver found\n"));
return;
}
cfi = &cfi_array->cfi_chips[0]->cfi;
cfi = &urj_flash_cfi_array->cfi_chips[0]->cfi;
bus_width = cfi_array->bus_width;
chip_width = cfi_array->cfi_chips[0]->width;
bus_width = urj_flash_cfi_array->bus_width;
chip_width = urj_flash_cfi_array->cfi_chips[0]->width;
printf (_("\nErasing %d Flash block%s from address 0x%x\n"), number,
number > 1 ? "s" : "", addr);
@ -465,7 +466,8 @@ urj_flasherase (urj_bus_t *bus, uint32_t addr, int number)
{
int btr = 0;
int block_no =
find_block (cfi, addr - cfi_array->address, bus_width, chip_width,
find_block (cfi, addr - urj_flash_cfi_array->address, bus_width,
chip_width,
&btr);
if (block_no < 0)
@ -477,10 +479,10 @@ urj_flasherase (urj_bus_t *bus, uint32_t addr, int number)
printf (_("(%d%% Completed) FLASH Block %d : Unlocking ... "),
i * 100 / number, block_no);
fflush (stdout);
flash_driver->unlock_block (cfi_array, addr);
flash_driver->unlock_block (urj_flash_cfi_array, addr);
printf (_("Erasing ... "));
fflush (stdout);
status = flash_driver->erase_block (cfi_array, addr);
status = flash_driver->erase_block (urj_flash_cfi_array, addr);
if (status == 0)
{
if (i == number)

@ -48,91 +48,98 @@
#include <flash.h>
#include <bus.h>
static int intel_flash_erase_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_unlock_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_program_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer,
int count);
static int intel_flash_program (urj_flash_cfi_array_t *cfi_array,
static int intel_flash_erase_block (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr);
static int intel_flash_unlock_block (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr);
static int intel_flash_program_single (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr,
uint32_t data);
static int intel_flash_program_buffer (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int intel_flash_program (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static int intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_program32_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int intel_flash_program32 (urj_flash_cfi_array_t *cfi_array,
static int intel_flash_erase_block32 (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr);
static int intel_flash_unlock_block32 (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr);
static int intel_flash_program32_single (urj_flash_cfi_array_t
*urj_flash_cfi_array, uint32_t adr,
uint32_t data);
static int intel_flash_program32 (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count);
/* autodetect, we can handle this chip */
static int
intel_flash_autodetect32 (urj_flash_cfi_array_t *cfi_array)
intel_flash_autodetect32 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
urj_bus_area_t area;
if (URJ_BUS_AREA (cfi_array->bus, cfi_array->address, &area) !=
URJ_STATUS_OK)
if (URJ_BUS_AREA
(urj_flash_cfi_array->bus, urj_flash_cfi_array->address,
&area) != URJ_STATUS_OK)
return 0;
return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code ==
CFI_VENDOR_MITSUBISHI_SCS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
return ((urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_MITSUBISHI_SCS)
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_MITSUBISHI_ECS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_INTEL_ECS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_INTEL_SCS)) && (area.width == 32);
}
static int
intel_flash_autodetect (urj_flash_cfi_array_t *cfi_array)
intel_flash_autodetect (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
urj_bus_area_t area;
if (URJ_BUS_AREA (cfi_array->bus, cfi_array->address, &area) !=
URJ_STATUS_OK)
if (URJ_BUS_AREA
(urj_flash_cfi_array->bus, urj_flash_cfi_array->address,
&area) != URJ_STATUS_OK)
return 0;
return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code ==
CFI_VENDOR_MITSUBISHI_SCS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
return ((urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_MITSUBISHI_SCS)
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_MITSUBISHI_ECS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_INTEL_ECS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_INTEL_SCS)) && (area.width == 16);
}
static int
intel_flash_autodetect8 (urj_flash_cfi_array_t *cfi_array)
intel_flash_autodetect8 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
urj_bus_area_t area;
if (URJ_BUS_AREA (cfi_array->bus, cfi_array->address, &area) !=
URJ_STATUS_OK)
if (URJ_BUS_AREA
(urj_flash_cfi_array->bus, urj_flash_cfi_array->address,
&area) != URJ_STATUS_OK)
return 0;
return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code ==
CFI_VENDOR_MITSUBISHI_SCS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
return ((urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_MITSUBISHI_SCS)
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_MITSUBISHI_ECS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_INTEL_ECS)
|| (cfi_array->cfi_chips[0]->cfi.identification_string.
|| (urj_flash_cfi_array->cfi_chips[0]->cfi.identification_string.
pri_id_code == CFI_VENDOR_INTEL_SCS)) && (area.width == 8);
}
static void
_intel_flash_print_info (urj_flash_cfi_array_t *cfi_array, int o)
_intel_flash_print_info (urj_flash_cfi_array_t *urj_flash_cfi_array, int o)
{
uint32_t mid, cid;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
mid = (URJ_BUS_READ (bus, cfi_array->address + (0x00 << o)) & 0xFF);
mid =
(URJ_BUS_READ (bus, urj_flash_cfi_array->address + (0x00 << o)) &
0xFF);
switch (mid)
{
case STD_MIC_INTEL:
@ -150,7 +157,9 @@ _intel_flash_print_info (urj_flash_cfi_array_t *cfi_array, int o)
}
printf (_("Chip: "));
cid = (URJ_BUS_READ (bus, cfi_array->address + (0x01 << o)) & 0xFFFF);
cid =
(URJ_BUS_READ (bus, urj_flash_cfi_array->address + (0x01 << o)) &
0xFFFF);
switch (cid)
{
case 0x0016:
@ -207,56 +216,57 @@ _intel_flash_print_info (urj_flash_cfi_array_t *cfi_array, int o)
}
/* Read Array */
URJ_BUS_WRITE (bus, cfi_array->address + (0 << o), 0x00FF00FF);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0 << o), 0x00FF00FF);
}
static void
intel_flash_print_info (urj_flash_cfi_array_t *cfi_array)
intel_flash_print_info (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
int o = 1;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
/* Intel Primary Algorithm Extended Query Table - see Table 5. in [3] */
/* TODO */
/* Clear Status Register */
URJ_BUS_WRITE (bus, cfi_array->address + (0 << o), 0x0050);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0 << o), 0x0050);
/* Read Identifier Command */
URJ_BUS_WRITE (bus, cfi_array->address + (0 << 0), 0x0090);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0 << 0), 0x0090);
_intel_flash_print_info (cfi_array, o);
_intel_flash_print_info (urj_flash_cfi_array, o);
}
static void
intel_flash_print_info32 (urj_flash_cfi_array_t *cfi_array)
intel_flash_print_info32 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
int o = 2;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
/* Intel Primary Algorithm Extended Query Table - see Table 5. in [3] */
/* TODO */
/* Clear Status Register */
URJ_BUS_WRITE (bus, cfi_array->address + (0 << o), 0x00500050);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0 << o), 0x00500050);
/* Read Identifier Command */
URJ_BUS_WRITE (bus, cfi_array->address + (0 << 0), 0x00900090);
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address + (0 << 0), 0x00900090);
_intel_flash_print_info (cfi_array, o);
_intel_flash_print_info (urj_flash_cfi_array, o);
}
static int
intel_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
intel_flash_erase_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_BLOCK_ERASE);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_CONFIRM);
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
switch (sr & ~CFI_INTEL_SR_READY)
{
@ -279,17 +289,18 @@ intel_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
}
static int
intel_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
intel_flash_unlock_block (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_LOCK_SETUP);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_UNLOCK_BLOCK);
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != CFI_INTEL_SR_READY)
{
@ -301,18 +312,18 @@ intel_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
}
static int
intel_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data)
intel_flash_program_single (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t data)
{
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_PROGRAM1);
URJ_BUS_WRITE (bus, adr, data);
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != CFI_INTEL_SR_READY)
{
@ -324,13 +335,13 @@ intel_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
intel_flash_program_buffer (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count)
{
/* NOTE: Write-to-buffer programming operation according to [5], Figure 9 */
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_flash_cfi_chip_t *cfi_chip = cfi_array->cfi_chips[0];
urj_bus_t *bus = urj_flash_cfi_array->bus;
urj_flash_cfi_chip_t *cfi_chip = urj_flash_cfi_array->cfi_chips[0];
int wb_bytes = cfi_chip->cfi.device_geometry.max_bytes_write;
int chip_width = cfi_chip->width;
int offset = 0;
@ -347,11 +358,11 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
wcount = count;
/* issue command WRITE_TO_BUFFER */
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_WRITE_TO_BUFFER);
/* poll XSR7 == 1 */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
/* write count value (number of upcoming writes - 1) */
URJ_BUS_WRITE (bus, adr, wcount - 1);
@ -360,7 +371,7 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
for (idx = 0; idx < wcount; idx++)
{
URJ_BUS_WRITE (bus, adr, buffer[offset + idx]);
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
offset += wcount;
@ -371,7 +382,7 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
/* poll SR7 == 1 */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != CFI_INTEL_SR_READY)
{
printf (_("flash: unknown error while programming\n"));
@ -382,10 +393,11 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
intel_flash_program (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count)
{
urj_flash_cfi_query_structure_t *cfi = &(cfi_array->cfi_chips[0]->cfi);
urj_flash_cfi_query_structure_t *cfi =
&(urj_flash_cfi_array->cfi_chips[0]->cfi);
int max_bytes_write = cfi->device_geometry.max_bytes_write;
#ifndef FLASH_MULTI_BYTE
@ -394,7 +406,8 @@ intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
/* multi-byte writes supported? */
if (max_bytes_write > 1)
return intel_flash_program_buffer (cfi_array, adr, buffer, count);
return intel_flash_program_buffer (urj_flash_cfi_array, adr, buffer,
count);
else
{
@ -403,11 +416,11 @@ intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
for (idx = 0; idx < count; idx++)
{
int status =
intel_flash_program_single (cfi_array, adr, buffer[idx]);
int status = intel_flash_program_single (urj_flash_cfi_array, adr,
buffer[idx]);
if (status)
return status;
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
}
@ -415,12 +428,13 @@ intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
intel_flash_erase_block32 (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
uint32_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr,
@ -429,7 +443,7 @@ intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_CONFIRM << 16) | CFI_INTEL_CMD_CONFIRM);
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY))
{
@ -441,12 +455,13 @@ intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
}
static int
intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
intel_flash_unlock_block32 (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr)
{
uint32_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr,
@ -456,7 +471,7 @@ intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
(CFI_INTEL_CMD_UNLOCK_BLOCK << 16) |
CFI_INTEL_CMD_UNLOCK_BLOCK);
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY))
{
@ -468,20 +483,20 @@ intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
}
static int
intel_flash_program32_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data)
intel_flash_program32_single (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t data)
{
uint32_t sr;
urj_bus_t *bus = cfi_array->bus;
urj_bus_t *bus = urj_flash_cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
URJ_BUS_WRITE (bus, urj_flash_cfi_array->address,
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_PROGRAM1 << 16) | CFI_INTEL_CMD_PROGRAM1);
URJ_BUS_WRITE (bus, adr, data);
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (((sr = URJ_BUS_READ (bus, urj_flash_cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY))
{
@ -493,8 +508,8 @@ intel_flash_program32_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
intel_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
intel_flash_program32 (urj_flash_cfi_array_t *urj_flash_cfi_array,
uint32_t adr, uint32_t *buffer, int count)
{
/* Single byte programming is forced for 32 bit (2x16) flash configuration.
a) lack of testing capbilities for 2x16 multi-byte write operation
@ -505,31 +520,33 @@ intel_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
/* unroll buffer to single writes */
for (idx = 0; idx < count; idx++)
{
int status =
intel_flash_program32_single (cfi_array, adr, buffer[idx]);
int status = intel_flash_program32_single (urj_flash_cfi_array, adr,
buffer[idx]);
if (status)
return status;
adr += cfi_array->bus_width;
adr += urj_flash_cfi_array->bus_width;
}
return 0;
}
static void
intel_flash_readarray32 (urj_flash_cfi_array_t *cfi_array)
intel_flash_readarray32 (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
/* Read Array */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address, 0x00FF00FF);
URJ_BUS_WRITE (urj_flash_cfi_array->bus, urj_flash_cfi_array->address,
0x00FF00FF);
}
static void
intel_flash_readarray (urj_flash_cfi_array_t *cfi_array)
intel_flash_readarray (urj_flash_cfi_array_t *urj_flash_cfi_array)
{
/* Read Array */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address, 0x00FF00FF);
URJ_BUS_WRITE (urj_flash_cfi_array->bus, urj_flash_cfi_array->address,
0x00FF00FF);
}
urj_flash_driver_t intel_32_flash_driver = {
urj_flash_driver_t urj_flash_intel_32_flash_driver = {
4, /* buswidth */
N_("Intel Standard Command Set"),
N_("supported: 28Fxxxx, 2 x 16 bit"),
@ -541,7 +558,7 @@ urj_flash_driver_t intel_32_flash_driver = {
intel_flash_readarray32,
};
urj_flash_driver_t intel_16_flash_driver = {
urj_flash_driver_t urj_flash_intel_16_flash_driver = {
2, /* buswidth */
N_("Intel Standard Command Set"),
N_("supported: 28Fxxxx, 1 x 16 bit"),
@ -553,7 +570,7 @@ urj_flash_driver_t intel_16_flash_driver = {
intel_flash_readarray,
};
urj_flash_driver_t intel_8_flash_driver = {
urj_flash_driver_t urj_flash_intel_8_flash_driver = {
1, /* buswidth */
N_("Intel Standard Command Set"),
N_("supported: 28Fxxxx, 1 x 8 bit"),

@ -709,7 +709,7 @@ static const struct amd_flash_info table[] = {
int
urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
urj_flash_cfi_array_t **urj_flash_cfi_array)
{
/* Temporary containers for manufacturer and device id while
probing with different Autoselect methods. */
@ -720,26 +720,27 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_query_structure_t *cfi;
urj_bus_area_t area;
*cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*cfi_array)
*urj_flash_cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*urj_flash_cfi_array)
return -2; /* out of memory */
(*cfi_array)->bus = bus;
(*cfi_array)->address = adr;
(*urj_flash_cfi_array)->bus = bus;
(*urj_flash_cfi_array)->address = adr;
if (URJ_BUS_AREA (bus, adr, &area) != URJ_STATUS_OK)
return -8; /* bus width detection failed */
bw = area.width;
if (bw != 8 && bw != 16 && bw != 32)
return -3; /* invalid bus width */
(*cfi_array)->bus_width = ba = bw / 8;
(*urj_flash_cfi_array)->bus_width = ba = bw / 8;
(*cfi_array)->cfi_chips =
(*urj_flash_cfi_array)->cfi_chips =
calloc (1, sizeof (urj_flash_cfi_chip_t *) * ba);
if (!(*cfi_array)->cfi_chips)
if (!(*urj_flash_cfi_array)->cfi_chips)
return -2; /* out of memory */
(*cfi_array)->cfi_chips[0] = calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*cfi_array)->cfi_chips[0])
(*urj_flash_cfi_array)->cfi_chips[0] =
calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*urj_flash_cfi_array)->cfi_chips[0])
return -2; /* out of memory */
/* probe device with Autoselect method 1 */
@ -776,7 +777,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
if (i == sizeof (table) / sizeof (struct amd_flash_info))
return -4;
cfi = &(*cfi_array)->cfi_chips[0]->cfi;
cfi = &(*urj_flash_cfi_array)->cfi_chips[0]->cfi;
cfi->identification_string.pri_id_code = CFI_VENDOR_AMD_SCS;
cfi->identification_string.pri_vendor_tbl = NULL;
@ -789,26 +790,26 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
switch (table[i].interface_width)
{
case CFI_INTERFACE_X8:
(*cfi_array)->cfi_chips[0]->width = 1;
(*urj_flash_cfi_array)->cfi_chips[0]->width = 1;
break;
case CFI_INTERFACE_X16:
(*cfi_array)->cfi_chips[0]->width = 2;
(*urj_flash_cfi_array)->cfi_chips[0]->width = 2;
break;
case CFI_INTERFACE_X8_X16:
fprintf (stderr,
"Warning: Unsupported interface geometry %s, falling back to %s\n",
"CFI_INTERFACE_X8_X16", "CFI_INTERFACE_X16");
(*cfi_array)->cfi_chips[0]->width = 2;
(*urj_flash_cfi_array)->cfi_chips[0]->width = 2;
cfi->device_geometry.device_interface = CFI_INTERFACE_X16;
break;
case CFI_INTERFACE_X32:
(*cfi_array)->cfi_chips[0]->width = 4;
(*urj_flash_cfi_array)->cfi_chips[0]->width = 4;
break;
case CFI_INTERFACE_X16_X32:
fprintf (stderr,
"Warning: Unsupported interface geometry %s, falling back to %s\n",
"CFI_INTERFACE_X16_X32", "CFI_INTERFACE_X32");
(*cfi_array)->cfi_chips[0]->width = 4;
(*urj_flash_cfi_array)->cfi_chips[0]->width = 4;
cfi->device_geometry.device_interface = CFI_INTERFACE_X32;
break;
default:
@ -816,7 +817,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
fprintf (stderr,
"Error: Unsupported interface geometry %d, bailing out\n",
table[i].interface_width);
(*cfi_array)->cfi_chips[0]->width = 1;
(*urj_flash_cfi_array)->cfi_chips[0]->width = 1;
cfi->device_geometry.device_interface = CFI_INTERFACE_X8;
return -5;
break;

@ -29,12 +29,12 @@
#include <flash.h>
int urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
urj_flash_cfi_array_t **urj_flash_cfi_array);
#ifdef JEDEC_EXP
int urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
urj_flash_cfi_array_t **urj_flash_cfi_array);
#endif
int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
urj_flash_cfi_array_t **urj_flash_cfi_array);
#endif /* ndef URJ_FLASH_JEDEC_H */

@ -61,7 +61,7 @@ urj_flash_jedec_exp_read_id (urj_bus_t *bus, uint32_t adr, uint32_t dmask,
int
urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
urj_flash_cfi_array_t **urj_flash_cfi_array)
{
/* Temporary containers for manufacturer and device id while
probing with different Autoselect methods. */
@ -69,12 +69,12 @@ urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr,
int det_buswidth;
urj_bus_area_t area;
*cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*cfi_array)
*urj_flash_cfi_array = calloc (1, sizeof (urj_flash_cfi_array_t));
if (!*urj_flash_cfi_array)
return -2; /* out of memory */
(*cfi_array)->bus = bus;
(*cfi_array)->address = adr;
(*urj_flash_cfi_array)->bus = bus;
(*urj_flash_cfi_array)->address = adr;
if (URJ_BUS_AREA (bus, adr, &area) != URJ_STATUS_OK)
return -8; /* bus width detection failed */
bw = area.width;
@ -84,14 +84,16 @@ urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr,
if (bw != 8 && bw != 16 && bw != 32)
return -3; /* invalid bus width */
(*cfi_array)->bus_width = ba = bw / 8;
(*urj_flash_cfi_array)->bus_width = ba = bw / 8;
(*cfi_array)->cfi_chips = calloc (1, sizeof (urj_flash_cfi_chip_t *));
if (!(*cfi_array)->cfi_chips)
(*urj_flash_cfi_array)->cfi_chips =
calloc (1, sizeof (urj_flash_cfi_chip_t *));
if (!(*urj_flash_cfi_array)->cfi_chips)
return -2; /* out of memory */
(*cfi_array)->cfi_chips[0] = calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*cfi_array)->cfi_chips[0])
(*urj_flash_cfi_array)->cfi_chips[0] =
calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*urj_flash_cfi_array)->cfi_chips[0])
return -2; /* out of memory */
printf

@ -411,7 +411,7 @@ urj_jim_intel_28fxxxb3_update (urj_jim_bus_device_t *d,
}
}
urj_jim_bus_device_t intel_28f800b3b = {
urj_jim_bus_device_t urj_jim_intel_28f800b3b = {
2, /* width [bytes] */
0x80000, /* size [words, each <width> bytes] */
NULL, /* state */

@ -30,7 +30,7 @@
#undef VERBOSE
extern urj_jim_bus_device_t intel_28f800b3b;
extern urj_jim_bus_device_t urj_jim_intel_28f800b3b;
static urj_jim_attached_part_t some_cpu_attached[] = {
/* 1. Address offset: base offset [bytes]
@ -38,7 +38,7 @@ static urj_jim_attached_part_t some_cpu_attached[] = {
* 3. Data shift: Distance between D0 of device and CPU e.g. 0, 8, 16 or 24 bits
* 4. Part: Pointer to part structure */
{0x00000000, 1, 0, &intel_28f800b3b},
{0x00000000, 1, 0, &urj_jim_intel_28f800b3b},
{0xFFFFFFFF, 0, 0, NULL} /* Always end list with part == NULL */
};

@ -58,7 +58,7 @@ ssize_t urj_lib_getline (char **lineptr, size_t *n, FILE * stream);
int debug_mode = 0;
int big_endian = 0;
int interactive = 0;
extern urj_flash_cfi_array_t *cfi_array;
extern urj_flash_cfi_array_t *urj_flash_cfi_array;
#define JTAGDIR ".jtag"
#define HISTORYFILE "history"
@ -274,8 +274,8 @@ jtag_parse_rc (urj_chain_t *chain)
static void
cleanup (urj_chain_t *chain)
{
urj_flash_cfi_array_free (cfi_array);
cfi_array = NULL;
urj_flash_cfi_array_free (urj_flash_cfi_array);
urj_flash_cfi_array = NULL;
if (urj_bus)
{

@ -39,109 +39,109 @@
#undef VERBOSE
extern urj_cable_driver_t arcom_cable_driver;
extern urj_cable_driver_t byteblaster_cable_driver;
extern urj_cable_driver_t usbblaster_cable_driver;
extern urj_cable_driver_t ft2232_cable_driver;
extern urj_cable_driver_t ft2232_jtagkey_cable_driver;
extern urj_cable_driver_t ft2232_armusbocd_cable_driver;
extern urj_cable_driver_t ft2232_gnice_cable_driver;
extern urj_cable_driver_t ft2232_oocdlinks_cable_driver;
extern urj_cable_driver_t ft2232_signalyzer_cable_driver;
extern urj_cable_driver_t ft2232_turtelizer2_cable_driver;
extern urj_cable_driver_t ft2232_usbtojtagif_cable_driver;
extern urj_cable_driver_t ft2232_flyswatter_cable_driver;
extern urj_cable_driver_t ft2232_usbscarab2_cable_driver;
extern urj_cable_driver_t dlc5_cable_driver;
extern urj_cable_driver_t ea253_cable_driver;
extern urj_cable_driver_t ei012_cable_driver;
extern urj_cable_driver_t igloo_cable_driver;
extern urj_cable_driver_t keithkoep_cable_driver;
extern urj_cable_driver_t lattice_cable_driver;
extern urj_cable_driver_t mpcbdm_cable_driver;
extern urj_cable_driver_t triton_cable_driver;
extern urj_cable_driver_t jim_cable_driver;
extern urj_cable_driver_t wiggler_cable_driver;
extern urj_cable_driver_t wiggler2_cable_driver;
extern urj_cable_driver_t wiggler_cable_driver;
extern urj_cable_driver_t xpc_int_cable_driver;
extern urj_cable_driver_t xpc_ext_cable_driver;
extern urj_cable_driver_t jlink_cable_driver;
extern urj_cable_driver_t ep9307_cable_driver;
extern urj_cable_driver_t ts7800_cable_driver;
urj_cable_driver_t *cable_drivers[] = {
extern urj_cable_driver_t urj_tap_cable_arcom_driver;
extern urj_cable_driver_t urj_tap_cable_byteblaster_driver;
extern urj_cable_driver_t urj_tap_cable_usbblaster_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_jtagkey_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_armusbocd_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_gnice_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_oocdlinks_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_signalyzer_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_turtelizer2_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_usbtojtagif_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_flyswatter_driver;
extern urj_cable_driver_t urj_tap_cable_ft2232_usbscarab2_driver;
extern urj_cable_driver_t urj_tap_cable_dlc5_driver;
extern urj_cable_driver_t urj_tap_cable_ea253_driver;
extern urj_cable_driver_t urj_tap_cable_ei012_driver;
extern urj_cable_driver_t urj_tap_cable_igloo_driver;
extern urj_cable_driver_t urj_tap_cable_keithkoep_driver;
extern urj_cable_driver_t urj_tap_cable_lattice_driver;
extern urj_cable_driver_t urj_tap_cable_mpcbdm_driver;
extern urj_cable_driver_t urj_tap_cable_triton_driver;
extern urj_cable_driver_t urj_tap_cable_jim_driver;
extern urj_cable_driver_t urj_tap_cable_wiggler_driver;
extern urj_cable_driver_t urj_tap_cable_wiggler2_driver;
extern urj_cable_driver_t urj_tap_cable_wiggler_driver;
extern urj_cable_driver_t urj_tap_cable_xpc_int_driver;
extern urj_cable_driver_t urj_tap_cable_xpc_ext_driver;
extern urj_cable_driver_t urj_tap_cable_jlink_driver;
extern urj_cable_driver_t urj_tap_cable_ep9307_driver;
extern urj_cable_driver_t urj_tap_cable_ts7800_driver;
urj_cable_driver_t *urj_tap_cable_drivers[] = {
#ifdef ENABLE_CABLE_ARCOM
&arcom_cable_driver,
&urj_tap_cable_arcom_driver,
#endif
#ifdef ENABLE_CABLE_BYTEBLASTER
&byteblaster_cable_driver,
&urj_tap_cable_byteblaster_driver,
#endif
#ifdef ENABLE_CABLE_USBBLASTER
&usbblaster_cable_driver,
&urj_tap_cable_usbblaster_driver,
#endif
#ifdef ENABLE_CABLE_FT2232
&ft2232_cable_driver,
&ft2232_jtagkey_cable_driver,
&ft2232_armusbocd_cable_driver,
&ft2232_gnice_cable_driver,
&ft2232_oocdlinks_cable_driver,
&ft2232_signalyzer_cable_driver,
&ft2232_turtelizer2_cable_driver,
&ft2232_usbtojtagif_cable_driver,
&ft2232_flyswatter_cable_driver,
&ft2232_usbscarab2_cable_driver,
&urj_tap_cable_ft2232_driver,
&urj_tap_cable_ft2232_jtagkey_driver,
&urj_tap_cable_ft2232_armusbocd_driver,
&urj_tap_cable_ft2232_gnice_driver,
&urj_tap_cable_ft2232_oocdlinks_driver,
&urj_tap_cable_ft2232_signalyzer_driver,
&urj_tap_cable_ft2232_turtelizer2_driver,
&urj_tap_cable_ft2232_usbtojtagif_driver,
&urj_tap_cable_ft2232_flyswatter_driver,
&urj_tap_cable_ft2232_usbscarab2_driver,
#endif
#ifdef ENABLE_CABLE_DLC5
&dlc5_cable_driver,
&urj_tap_cable_dlc5_driver,
#endif
#ifdef ENABLE_CABLE_EA253
&ea253_cable_driver,
&urj_tap_cable_ea253_driver,
#endif
#ifdef ENABLE_CABLE_EI012
&ei012_cable_driver,
&urj_tap_cable_ei012_driver,
#endif
#ifdef ENABLE_CABLE_IGLOO
&igloo_cable_driver,
&urj_tap_cable_igloo_driver,
#endif
#ifdef ENABLE_CABLE_KEITHKOEP
&keithkoep_cable_driver,
&urj_tap_cable_keithkoep_driver,
#endif
#ifdef ENABLE_CABLE_LATTICE
&lattice_cable_driver,
&urj_tap_cable_lattice_driver,
#endif
#ifdef ENABLE_CABLE_MPCBDM
&mpcbdm_cable_driver,
&urj_tap_cable_mpcbdm_driver,
#endif
#ifdef ENABLE_CABLE_TRITON
&triton_cable_driver,
&urj_tap_cable_triton_driver,
#endif
#ifdef ENABLE_JIM
&jim_cable_driver,
&urj_tap_cable_jim_driver,
#endif
#ifdef ENABLE_CABLE_WIGGLER
&wiggler_cable_driver,
&wiggler2_cable_driver,
&urj_tap_cable_wiggler_driver,
&urj_tap_cable_wiggler2_driver,
#endif
#ifdef ENABLE_CABLE_XPC
&xpc_int_cable_driver,
&xpc_ext_cable_driver,
&urj_tap_cable_xpc_int_driver,
&urj_tap_cable_xpc_ext_driver,
#endif
#ifdef ENABLE_CABLE_JLINK
&jlink_cable_driver,
&urj_tap_cable_jlink_driver,
#endif
#ifdef ENABLE_CABLE_EP9307
&ep9307_cable_driver,
&urj_tap_cable_ep9307_driver,
#endif
#ifdef ENABLE_CABLE_TS7800
&ts7800_cable_driver,
&urj_tap_cable_ts7800_driver,
#endif
NULL /* last must be NULL */
};

@ -132,7 +132,7 @@ arcom_set_signal (urj_cable_t *cable, int mask, int val)
return prev_sigs;
}
urj_cable_driver_t arcom_cable_driver = {
urj_cable_driver_t urj_tap_cable_arcom_driver = {
"ARCOM",
N_("Arcom JTAG Cable"),
urj_tap_cable_generic_parport_connect,

@ -154,7 +154,7 @@ byteblaster_set_signal (urj_cable_t *cable, int mask, int val)
return prev_sigs;
}
urj_cable_driver_t byteblaster_cable_driver = {
urj_cable_driver_t urj_tap_cable_byteblaster_driver = {
"ByteBlaster",
N_("Altera ByteBlaster/ByteBlaster II/ByteBlasterMV Parallel Port Download Cable"),
urj_tap_cable_generic_parport_connect,

@ -126,7 +126,7 @@ dlc5_set_signal (urj_cable_t *cable, int mask, int val)
return prev_sigs;
}
urj_cable_driver_t dlc5_cable_driver = {
urj_cable_driver_t urj_tap_cable_dlc5_driver = {
"DLC5",
N_("Xilinx DLC5 JTAG Parallel Cable III"),
urj_tap_cable_generic_parport_connect,

@ -132,7 +132,7 @@ ea253_set_signal (urj_cable_t *cable, int mask, int val)
return prev_sigs;
}
urj_cable_driver_t ea253_cable_driver = {
urj_cable_driver_t urj_tap_cable_ea253_driver = {
"EA253",
N_("ETC EA253 JTAG Cable"),
urj_tap_cable_generic_parport_connect,

@ -134,7 +134,7 @@ ei012_set_signal (urj_cable_t *cable, int mask, int val)
return prev_sigs;
}
urj_cable_driver_t ei012_cable_driver = {
urj_cable_driver_t urj_tap_cable_ei012_driver = {
"EI012",
N_("ETC EI012 JTAG Cable"),
urj_tap_cable_generic_parport_connect,

@ -1769,16 +1769,16 @@ ft2232_cable_free (urj_cable_t *cable)
}
urj_usbconn_cable_t usbconn_cable_ft2232_ftdi;
urj_usbconn_cable_t usbconn_cable_armusbocd_ftdi;
urj_usbconn_cable_t usbconn_cable_gnice_ftdi;
urj_usbconn_cable_t usbconn_cable_jtagkey_ftdi;
urj_usbconn_cable_t usbconn_cable_oocdlinks_ftdi;
urj_usbconn_cable_t usbconn_cable_turtelizer2_ftdi;
urj_usbconn_cable_t usbconn_cable_usbtojtagif_ftdi;
urj_usbconn_cable_t usbconn_cable_signalyzer_ftdi;
urj_usbconn_cable_t usbconn_cable_flyswatter_ftdi;
urj_usbconn_cable_t usbconn_cable_usbscarab2_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi;
urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi;
static void
@ -1786,34 +1786,34 @@ ft2232_usbcable_help (const char *cablename)
{
urj_usbconn_cable_t *conn;
conn = &usbconn_cable_armusbocd_ftdi;
conn = &urj_tap_cable_usbconn_armusbocd_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_gnice_ftdi;
conn = &urj_tap_cable_usbconn_gnice_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_jtagkey_ftdi;
conn = &urj_tap_cable_usbconn_jtagkey_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_oocdlinks_ftdi;
conn = &urj_tap_cable_usbconn_oocdlinks_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_turtelizer2_ftdi;
conn = &urj_tap_cable_usbconn_turtelizer2_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_usbtojtagif_ftdi;
conn = &urj_tap_cable_usbconn_usbtojtagif_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_signalyzer_ftdi;
conn = &urj_tap_cable_usbconn_signalyzer_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_flyswatter_ftdi;
conn = &urj_tap_cable_usbconn_flyswatter_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_usbscarab2_ftdi;
conn = &urj_tap_cable_usbconn_usbscarab2_ftdi;
if (strcasecmp (conn->name, cablename) == 0)
goto found;
conn = &usbconn_cable_ft2232_ftdi;
conn = &urj_tap_cable_usbconn_ft2232_ftdi;
found:
printf (_
@ -1827,7 +1827,7 @@ ft2232_usbcable_help (const char *cablename)
}
urj_cable_driver_t ft2232_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_driver = {
"FT2232",
N_("Generic FTDI FT2232 Cable"),
ft2232_connect,
@ -1844,14 +1844,14 @@ urj_cable_driver_t ft2232_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_ft2232_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi = {
"FT2232", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0000, /* VID */
0x0000 /* PID */
};
urj_usbconn_cable_t usbconn_cable_ft2232_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftd2xx = {
"FT2232", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -1859,7 +1859,7 @@ urj_usbconn_cable_t usbconn_cable_ft2232_ftd2xx = {
0x0000 /* PID */
};
urj_cable_driver_t ft2232_armusbocd_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_armusbocd_driver = {
"ARM-USB-OCD",
N_("Olimex ARM-USB-OCD[-TINY] (FT2232) Cable"),
ft2232_connect,
@ -1876,28 +1876,28 @@ urj_cable_driver_t ft2232_armusbocd_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_armusbocd_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi = {
"ARM-USB-OCD", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x15BA, /* VID */
0x0003 /* PID */
};
urj_usbconn_cable_t usbconn_cable_armusbocd_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftd2xx = {
"ARM-USB-OCD", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
0x15BA, /* VID */
0x0003 /* PID */
};
urj_usbconn_cable_t usbconn_cable_armusbocdtiny_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftdi = {
"ARM-USB-OCD", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x15BA, /* VID */
0x0004 /* PID */
};
urj_usbconn_cable_t usbconn_cable_armusbocdtiny_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftd2xx = {
"ARM-USB-OCD", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -1905,7 +1905,7 @@ urj_usbconn_cable_t usbconn_cable_armusbocdtiny_ftd2xx = {
0x0004 /* PID */
};
urj_cable_driver_t ft2232_gnice_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_gnice_driver = {
"gnICE",
N_("Analog Devices Blackfin gnICE (FT2232) Cable (EXPERIMENTAL)"),
ft2232_connect,
@ -1922,14 +1922,14 @@ urj_cable_driver_t ft2232_gnice_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_gnice_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi = {
"gnICE", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0456, /* VID */
0xF000 /* PID */
};
urj_usbconn_cable_t usbconn_cable_gnice_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftd2xx = {
"gnICE", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -1937,7 +1937,7 @@ urj_usbconn_cable_t usbconn_cable_gnice_ftd2xx = {
0xF000 /* PID */
};
urj_cable_driver_t ft2232_jtagkey_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_jtagkey_driver = {
"JTAGkey",
N_("Amontec JTAGkey (FT2232) Cable"),
ft2232_connect,
@ -1954,14 +1954,14 @@ urj_cable_driver_t ft2232_jtagkey_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_jtagkey_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi = {
"JTAGkey", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0403, /* VID */
0xCFF8 /* PID */
};
urj_usbconn_cable_t usbconn_cable_jtagkey_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftd2xx = {
"JTAGkey", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -1969,7 +1969,7 @@ urj_usbconn_cable_t usbconn_cable_jtagkey_ftd2xx = {
0xCFF8 /* PID */
};
urj_cable_driver_t ft2232_oocdlinks_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_oocdlinks_driver = {
"OOCDLink-s",
N_("OOCDLink-s (FT2232) Cable (EXPERIMENTAL)"),
ft2232_connect,
@ -1986,14 +1986,14 @@ urj_cable_driver_t ft2232_oocdlinks_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_oocdlinks_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi = {
"OOCDLink-s", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0403, /* VID */
0xbaf8 /* PID */
};
urj_usbconn_cable_t usbconn_cable_oocdlinks_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftd2xx = {
"OOCDLink-s", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -2001,7 +2001,7 @@ urj_usbconn_cable_t usbconn_cable_oocdlinks_ftd2xx = {
0xbaf8 /* PID */
};
urj_cable_driver_t ft2232_turtelizer2_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_turtelizer2_driver = {
"Turtelizer2",
N_("Turtelizer 2 Rev. B (FT2232) Cable (EXPERIMENTAL)"),
ft2232_connect,
@ -2018,14 +2018,14 @@ urj_cable_driver_t ft2232_turtelizer2_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_turtelizer2_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi = {
"Turtelizer2", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0403, /* VID */
0xBDC8 /* PID */
};
urj_usbconn_cable_t usbconn_cable_turtelizer2_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftd2xx = {
"Turtelizer2", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -2033,7 +2033,7 @@ urj_usbconn_cable_t usbconn_cable_turtelizer2_ftd2xx = {
0xBDC8 /* PID */
};
urj_cable_driver_t ft2232_usbtojtagif_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_usbtojtagif_driver = {
"USB-to-JTAG-IF",
N_("USB to JTAG Interface (FT2232) Cable (EXPERIMENTAL)"),
ft2232_connect,
@ -2050,14 +2050,14 @@ urj_cable_driver_t ft2232_usbtojtagif_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_usbtojtagif_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi = {
"USB-to-JTAG-IF", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0000, /* VID */
0x0000 /* PID */
};
urj_usbconn_cable_t usbconn_cable_usbtojtagif_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftd2xx = {
"USB-to-JTAG-IF", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -2065,7 +2065,7 @@ urj_usbconn_cable_t usbconn_cable_usbtojtagif_ftd2xx = {
0x0000 /* PID */
};
urj_cable_driver_t ft2232_signalyzer_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_signalyzer_driver = {
"Signalyzer",
N_("Xverve DT-USB-ST Signalyzer Tool (FT2232) Cable (EXPERIMENTAL)"),
ft2232_connect,
@ -2082,14 +2082,14 @@ urj_cable_driver_t ft2232_signalyzer_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_signalyzer_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi = {
"Signalyzer", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0000, /* VID */
0x0000 /* PID */
};
urj_usbconn_cable_t usbconn_cable_signalyzer_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftd2xx = {
"Signalyzer", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -2097,7 +2097,7 @@ urj_usbconn_cable_t usbconn_cable_signalyzer_ftd2xx = {
0x0000 /* PID */
};
urj_cable_driver_t ft2232_flyswatter_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_flyswatter_driver = {
"Flyswatter",
N_("TinCanTools Flyswatter (FT2232) Cable"),
ft2232_connect,
@ -2114,14 +2114,14 @@ urj_cable_driver_t ft2232_flyswatter_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_flyswatter_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi = {
"Flyswatter", /* cable name */
NULL, /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0403, /* VID */
0x6010 /* PID */
};
urj_usbconn_cable_t usbconn_cable_flyswatter_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftd2xx = {
"Flyswatter", /* cable name */
NULL, /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */
@ -2129,7 +2129,7 @@ urj_usbconn_cable_t usbconn_cable_flyswatter_ftd2xx = {
0x6010 /* PID */
};
urj_cable_driver_t ft2232_usbscarab2_cable_driver = {
urj_cable_driver_t urj_tap_cable_ft2232_usbscarab2_driver = {
"usbScarab2",
N_("KrisTech usbScarabeus2 (FT2232) Cable"),
ft2232_connect,
@ -2146,14 +2146,14 @@ urj_cable_driver_t ft2232_usbscarab2_cable_driver = {
ft2232_flush,
ft2232_usbcable_help
};
urj_usbconn_cable_t usbconn_cable_usbscarab2_ftdi = {
urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi = {
"usbScarab2", /* cable name */
"usbScarab2", /* string pattern, not used */
"ftdi-mpsse", /* default usbconn driver */
0x0403, /* VID */
0xbbe0 /* PID */
};
urj_usbconn_cable_t usbconn_cable_usbscarab2_ftd2xx = {
urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftd2xx = {
"usbScarab2", /* cable name */
"usbScarab2", /* string pattern, not used */
"ftd2xx-mpsse", /* default usbconn driver */

@ -62,18 +62,18 @@ urj_tap_cable_generic_parport_connect (char *params[], urj_cable_t *cable)
}
/* search parport driver list */
for (i = 0; parport_drivers[i]; i++)
if (strcasecmp (params[1], parport_drivers[i]->type) == 0)
for (i = 0; urj_tap_parport_drivers[i]; i++)
if (strcasecmp (params[1], urj_tap_parport_drivers[i]->type) == 0)
break;
if (!parport_drivers[i])
if (!urj_tap_parport_drivers[i])
{
printf (_("Unknown port driver: %s\n"), params[1]);
return 2;
}
/* set up parport driver */
port = parport_drivers[i]->connect ((const char **) &params[2],
urj_cmd_params (params) - 2);
port = urj_tap_parport_drivers[i]->connect ((const char **) &params[2],
urj_cmd_params (params) - 2);
if (port == NULL)
{
@ -85,7 +85,7 @@ urj_tap_cable_generic_parport_connect (char *params[], urj_cable_t *cable)
if (!cable_params)
{
printf (_("%s(%d) malloc failed!\n"), __FILE__, __LINE__);
parport_drivers[i]->parport_free (port);
urj_tap_parport_drivers[i]->parport_free (port);
return 4;
}

@ -38,103 +38,103 @@
#undef VERBOSE
#ifdef ENABLE_CABLE_XPC
extern urj_usbconn_cable_t usbconn_cable_xpc_int;
extern urj_usbconn_cable_t usbconn_cable_xpc_ext;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_int;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_xpc_ext;
#endif
#ifdef ENABLE_CABLE_JLINK
extern urj_usbconn_cable_t usbconn_cable_jlink;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_jlink;
#endif
#ifdef ENABLE_CABLE_FT2232
#ifdef ENABLE_LOWLEVEL_FTD2XX
extern urj_usbconn_cable_t usbconn_cable_ft2232_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_armusbocd_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_armusbocdtiny_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_gnice_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_jtagkey_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_oocdlinks_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_turtelizer2_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_usbtojtagif_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_signalyzer_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_flyswatter_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_usbscarab2_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftd2xx;
#endif
#ifdef ENABLE_LOWLEVEL_FTDI
extern urj_usbconn_cable_t usbconn_cable_ft2232_ftdi;
extern urj_usbconn_cable_t usbconn_cable_armusbocd_ftdi;
extern urj_usbconn_cable_t usbconn_cable_armusbocdtiny_ftdi;
extern urj_usbconn_cable_t usbconn_cable_gnice_ftdi;
extern urj_usbconn_cable_t usbconn_cable_jtagkey_ftdi;
extern urj_usbconn_cable_t usbconn_cable_oocdlinks_ftdi;
extern urj_usbconn_cable_t usbconn_cable_turtelizer2_ftdi;
extern urj_usbconn_cable_t usbconn_cable_usbtojtagif_ftdi;
extern urj_usbconn_cable_t usbconn_cable_signalyzer_ftdi;
extern urj_usbconn_cable_t usbconn_cable_flyswatter_ftdi;
extern urj_usbconn_cable_t usbconn_cable_usbscarab2_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_ft2232_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocd_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_armusbocdtiny_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_gnice_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_jtagkey_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_oocdlinks_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_turtelizer2_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbtojtagif_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_signalyzer_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_flyswatter_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbscarab2_ftdi;
#endif
#endif
#ifdef ENABLE_CABLE_USBBLASTER
#ifdef ENABLE_LOWLEVEL_FTD2XX
extern urj_usbconn_cable_t usbconn_cable_usbblaster_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_cubic_cyclonium_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_nios_eval_ftd2xx;
extern urj_usbconn_cable_t usbconn_cable_usb_jtag_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftd2xx;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftd2xx;
#endif
#ifdef ENABLE_LOWLEVEL_FTDI
extern urj_usbconn_cable_t usbconn_cable_usbblaster_ftdi;
extern urj_usbconn_cable_t usbconn_cable_cubic_cyclonium_ftdi;
extern urj_usbconn_cable_t usbconn_cable_nios_eval_ftdi;
extern urj_usbconn_cable_t usbconn_cable_usb_jtag_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usbblaster_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_cubic_cyclonium_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_nios_eval_ftdi;
extern urj_usbconn_cable_t urj_tap_cable_usbconn_usb_jtag_ftdi;
#endif
#endif
urj_usbconn_cable_t *usbconn_cables[] = {
urj_usbconn_cable_t *urj_tap_cable_usbconn_cables[] = {
#ifdef ENABLE_CABLE_XPC
&usbconn_cable_xpc_int,
&usbconn_cable_xpc_ext,
&urj_tap_cable_usbconn_xpc_int,
&urj_tap_cable_usbconn_xpc_ext,
#endif
#ifdef ENABLE_CABLE_JLINK
&usbconn_cable_jlink,
&urj_tap_cable_usbconn_jlink,
#endif
#ifdef ENABLE_CABLE_FT2232
#ifdef ENABLE_LOWLEVEL_FTD2XX
&usbconn_cable_ft2232_ftd2xx,
&usbconn_cable_armusbocd_ftd2xx,
&usbconn_cable_armusbocdtiny_ftd2xx,
&usbconn_cable_gnice_ftd2xx,
&usbconn_cable_jtagkey_ftd2xx,
&usbconn_cable_oocdlinks_ftd2xx,
&usbconn_cable_turtelizer2_ftd2xx,
&usbconn_cable_usbtojtagif_ftd2xx,
&usbconn_cable_signalyzer_ftd2xx,
&usbconn_cable_flyswatter_ftd2xx,
&usbconn_cable_usbscarab2_ftd2xx,
&urj_tap_cable_usbconn_ft2232_ftd2xx,
&urj_tap_cable_usbconn_armusbocd_ftd2xx,
&urj_tap_cable_usbconn_armusbocdtiny_ftd2xx,
&urj_tap_cable_usbconn_gnice_ftd2xx,
&urj_tap_cable_usbconn_jtagkey_ftd2xx,
&urj_tap_cable_usbconn_oocdlinks_ftd2xx,
&urj_tap_cable_usbconn_turtelizer2_ftd2xx,
&urj_tap_cable_usbconn_usbtojtagif_ftd2xx,
&urj_tap_cable_usbconn_signalyzer_ftd2xx,
&urj_tap_cable_usbconn_flyswatter_ftd2xx,
&urj_tap_cable_usbconn_usbscarab2_ftd2xx,
#endif
#ifdef ENABLE_LOWLEVEL_FTDI
&usbconn_cable_ft2232_ftdi,
&usbconn_cable_armusbocd_ftdi,
&usbconn_cable_armusbocdtiny_ftdi,
&usbconn_cable_gnice_ftdi,
&usbconn_cable_jtagkey_ftdi,
&usbconn_cable_oocdlinks_ftdi,
&usbconn_cable_turtelizer2_ftdi,
&usbconn_cable_usbtojtagif_ftdi,
&usbconn_cable_signalyzer_ftdi,
&usbconn_cable_flyswatter_ftdi,
&usbconn_cable_usbscarab2_ftdi,
&urj_tap_cable_usbconn_ft2232_ftdi,
&urj_tap_cable_usbconn_armusbocd_ftdi,
&urj_tap_cable_usbconn_armusbocdtiny_ftdi,
&urj_tap_cable_usbconn_gnice_ftdi,
&urj_tap_cable_usbconn_jtagkey_ftdi,
&urj_tap_cable_usbconn_oocdlinks_ftdi,
&urj_tap_cable_usbconn_turtelizer2_ftdi,
&urj_tap_cable_usbconn_usbtojtagif_ftdi,
&urj_tap_cable_usbconn_signalyzer_ftdi,
&urj_tap_cable_usbconn_flyswatter_ftdi,
&urj_tap_cable_usbconn_usbscarab2_ftdi,
#endif
#endif
#ifdef ENABLE_CABLE_USBBLASTER
#ifdef ENABLE_LOWLEVEL_FTD2XX
&usbconn_cable_usbblaster_ftd2xx,
&usbconn_cable_cubic_cyclonium_ftd2xx,
&usbconn_cable_nios_eval_ftd2xx,
&usbconn_cable_usb_jtag_ftd2xx,
&urj_tap_cable_usbconn_usbblaster_ftd2xx,
&urj_tap_cable_usbconn_cubic_cyclonium_ftd2xx,
&urj_tap_cable_usbconn_nios_eval_ftd2xx,
&urj_tap_cable_usbconn_usb_jtag_ftd2xx,
#endif
#ifdef ENABLE_LOWLEVEL_FTDI
&usbconn_cable_usbblaster_ftdi,
&usbconn_cable_cubic_cyclonium_ftdi,
&usbconn_cable_nios_eval_ftdi,
&usbconn_cable_usb_jtag_ftdi,
&urj_tap_cable_usbconn_usbblaster_ftdi,
&urj_tap_cable_usbconn_cubic_cyclonium_ftdi,
&urj_tap_cable_usbconn_nios_eval_ftdi,
&urj_tap_cable_usbconn_usb_jtag_ftdi,
#endif
#endif
NULL
@ -183,27 +183,30 @@ urj_tap_cable_generic_usbconn_connect (char *params[], urj_cable_t *cable)
}
/* search usbconn driver list */
for (i = 0; usbconn_drivers[i] && !conn; i++)
for (i = 0; urj_tap_usbconn_drivers[i] && !conn; i++)
{
if ((user_specified.driver == NULL)
|| (strcasecmp (user_specified.driver, usbconn_drivers[i]->type)
== 0))
||
(strcasecmp
(user_specified.driver, urj_tap_usbconn_drivers[i]->type) == 0))
{
int j;
/* search cable list */
for (j = 0; usbconn_cables[j] && !conn; j++)
for (j = 0; urj_tap_cable_usbconn_cables[j] && !conn; j++)
{
if ((user_specified.name == NULL)
||
(strcasecmp (user_specified.name, usbconn_cables[j]->name)
== 0))
(strcasecmp
(user_specified.name,
urj_tap_cable_usbconn_cables[j]->name) == 0))
{
if (strcasecmp
(usbconn_cables[j]->driver,
usbconn_drivers[i]->type) == 0)
(urj_tap_cable_usbconn_cables[j]->driver,
urj_tap_usbconn_drivers[i]->type) == 0)
{
urj_usbconn_cable_t cable_try = *(usbconn_cables[j]);
urj_usbconn_cable_t cable_try =
*(urj_tap_cable_usbconn_cables[j]);
if (user_specified.vid >= 0)
cable_try.vid = user_specified.vid;
@ -213,7 +216,7 @@ urj_tap_cable_generic_usbconn_connect (char *params[], urj_cable_t *cable)
cable_try.desc = user_specified.desc;
conn =
usbconn_drivers[i]->
urj_tap_usbconn_drivers[i]->
connect ((const char **) &params[1], paramc - 1,
&cable_try);
}
@ -232,7 +235,7 @@ urj_tap_cable_generic_usbconn_connect (char *params[], urj_cable_t *cable)
if (!cable_params)
{
printf (_("%s(%d) malloc failed!\n"), __FILE__, __LINE__);
usbconn_drivers[i]->free (conn);
urj_tap_usbconn_drivers[i]->free (conn);
return 4;
}

@ -153,7 +153,7 @@ jim_cable_help (const char *cablename)
printf (_("Usage: cable %s\n"), cablename);
}
urj_cable_driver_t jim_cable_driver = {
urj_cable_driver_t urj_tap_cable_jim_driver = {
"JIM",
N_("JTAG target simulator JIM"),
urj_tap_cable_jim_cable_connect,

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save