diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 274ff539..4b6bb2b7 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -83,6 +83,10 @@ src/tap/usbconn/libftd2xx.c, src/tap/usbconn/libftdi.c, src/tap/usbconn/libusb.c: Constify the USB cable drivers. + * include/urjtag/flash.h, src/flash/amd.c, src/flash/amd.h, + src/flash/amd_flash.c, src/flash/flash.c, src/flash/intel.c, + src/flash/intel.h: Constify the flash drivers. + 2010-01-22 Mike Frysinger * src/cmd/cmd_bit.c (cmd_bit_print_params): Fix strncat length handling. diff --git a/urjtag/include/urjtag/flash.h b/urjtag/include/urjtag/flash.h index acff105e..a497f8d5 100644 --- a/urjtag/include/urjtag/flash.h +++ b/urjtag/include/urjtag/flash.h @@ -60,7 +60,7 @@ typedef struct } urj_flash_driver_t; -extern urj_flash_driver_t *urj_flash_flash_drivers[]; +extern const urj_flash_driver_t *urj_flash_flash_drivers[]; /** @return URJ_STATUS_OK on success; URJ_STATUS_FAIL on error */ int urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr); diff --git a/urjtag/src/flash/amd.c b/urjtag/src/flash/amd.c index 39d08aa7..2d5df79f 100644 --- a/urjtag/src/flash/amd.c +++ b/urjtag/src/flash/amd.c @@ -642,7 +642,7 @@ amd_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr, return URJ_STATUS_OK; } -urj_flash_driver_t urj_flash_amd_32_flash_driver = { +const urj_flash_driver_t urj_flash_amd_32_flash_driver = { N_("AMD/Fujitsu Standard Command Set"), N_("supported: AMD 29LV640D, 29LV641D, 29LV642D; 2x16 Bit"), 4, /* buswidth */ @@ -654,7 +654,7 @@ urj_flash_driver_t urj_flash_amd_32_flash_driver = { amd_flash_read_array, }; -urj_flash_driver_t urj_flash_amd_16_flash_driver = { +const urj_flash_driver_t urj_flash_amd_16_flash_driver = { N_("AMD/Fujitsu Standard Command Set"), N_("supported: AMD 29LV800B, S29GLxxxN; MX29LV640B, W19B320AT/B; 1x16 Bit"), 2, /* buswidth */ @@ -666,7 +666,7 @@ urj_flash_driver_t urj_flash_amd_16_flash_driver = { amd_flash_read_array, }; -urj_flash_driver_t urj_flash_amd_8_flash_driver = { +const urj_flash_driver_t urj_flash_amd_8_flash_driver = { N_("AMD/Fujitsu Standard Command Set"), N_("supported: AMD 29LV160, AMD 29LV065D, AMD 29LV040B, S29GLxxxN, W19B320AT/B; 1x8 Bit"), 1, /* buswidth */ diff --git a/urjtag/src/flash/amd.h b/urjtag/src/flash/amd.h index 9f79b855..f0a42a10 100644 --- a/urjtag/src/flash/amd.h +++ b/urjtag/src/flash/amd.h @@ -40,9 +40,9 @@ int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **urj_flash_cfi_array); -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_amd_29xx040_flash_driver; //20/09/2006 +extern const urj_flash_driver_t urj_flash_amd_32_flash_driver; +extern const urj_flash_driver_t urj_flash_amd_16_flash_driver; +extern const urj_flash_driver_t urj_flash_amd_8_flash_driver; +extern const urj_flash_driver_t urj_flash_amd_29xx040_flash_driver; #endif /* URJ_FLASH_H */ diff --git a/urjtag/src/flash/amd_flash.c b/urjtag/src/flash/amd_flash.c index 717e8b88..77f44507 100644 --- a/urjtag/src/flash/amd_flash.c +++ b/urjtag/src/flash/amd_flash.c @@ -409,7 +409,7 @@ amd_29xx040_unlock_block (urj_flash_cfi_array_t *cfi_array, } -urj_flash_driver_t urj_flash_amd_29xx040_flash_driver = { +const urj_flash_driver_t urj_flash_amd_29xx040_flash_driver = { N_("AMD Standard Command Set"), N_("supported: AMD 29LV040B, 29C040B, 1x8 Bit"), 1, /* buswidth */ diff --git a/urjtag/src/flash/flash.c b/urjtag/src/flash/flash.c index 5a816788..3cbb372b 100644 --- a/urjtag/src/flash/flash.c +++ b/urjtag/src/flash/flash.c @@ -51,7 +51,7 @@ #include "intel.h" #include "amd.h" -urj_flash_driver_t *urj_flash_flash_drivers[] = { +const 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, @@ -62,7 +62,7 @@ urj_flash_driver_t *urj_flash_flash_drivers[] = { NULL }; -static urj_flash_driver_t *flash_driver = NULL; +static const urj_flash_driver_t *flash_driver = NULL; static int set_flash_driver (void) diff --git a/urjtag/src/flash/intel.c b/urjtag/src/flash/intel.c index 8b903918..2bd9f4ae 100644 --- a/urjtag/src/flash/intel.c +++ b/urjtag/src/flash/intel.c @@ -525,7 +525,7 @@ intel_flash_readarray (urj_flash_cfi_array_t *cfi_array) URJ_BUS_WRITE (cfi_array->bus, cfi_array->address, 0x00FF00FF); } -urj_flash_driver_t urj_flash_intel_32_flash_driver = { +const urj_flash_driver_t urj_flash_intel_32_flash_driver = { N_("Intel Standard Command Set"), N_("supported: 28Fxxxx, 2 x 16 bit"), 4, /* buswidth */ @@ -537,7 +537,7 @@ urj_flash_driver_t urj_flash_intel_32_flash_driver = { intel_flash_readarray32, }; -urj_flash_driver_t urj_flash_intel_16_flash_driver = { +const urj_flash_driver_t urj_flash_intel_16_flash_driver = { N_("Intel Standard Command Set"), N_("supported: 28Fxxxx, 1 x 16 bit"), 2, /* buswidth */ @@ -549,7 +549,7 @@ urj_flash_driver_t urj_flash_intel_16_flash_driver = { intel_flash_readarray, }; -urj_flash_driver_t urj_flash_intel_8_flash_driver = { +const urj_flash_driver_t urj_flash_intel_8_flash_driver = { N_("Intel Standard Command Set"), N_("supported: 28Fxxxx, 1 x 8 bit"), 1, /* buswidth */ diff --git a/urjtag/src/flash/intel.h b/urjtag/src/flash/intel.h index 906c3a0e..35b254e4 100644 --- a/urjtag/src/flash/intel.h +++ b/urjtag/src/flash/intel.h @@ -98,8 +98,8 @@ #define CFI_CHIP_INTEL_28F256K18 0x8807 #define CFI_CHIPN_INTEL_28F256K18 "28F256K18" -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 const urj_flash_driver_t urj_flash_intel_32_flash_driver; +extern const urj_flash_driver_t urj_flash_intel_16_flash_driver; +extern const urj_flash_driver_t urj_flash_intel_8_flash_driver; #endif /* FLASH_INTEL_H */