X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Faduc702x.c;h=40ee3212687828138146fa2584be2104b5aa2ac8;hp=643705cae287c0df6cf1cc0ec31626c1ab99ca0b;hb=7bbd6c76838ffc639226897328d8ec7069b1769d;hpb=fe9228a32db930be297d4d3b35ffb94d6de1b9ab diff --git a/src/flash/nor/aduc702x.c b/src/flash/nor/aduc702x.c index 643705cae2..40ee321268 100644 --- a/src/flash/nor/aduc702x.c +++ b/src/flash/nor/aduc702x.c @@ -23,11 +23,11 @@ #include "config.h" #endif -#include "flash.h" -#include "armv4_5.h" -#include "binarybuffer.h" -#include "time_support.h" -#include "algorithm.h" +#include "imp.h" +#include +#include +#include +#include static int aduc702x_build_sector_list(struct flash_bank *bank); @@ -165,7 +165,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32 struct working_area *source; uint32_t address = bank->base + offset; struct reg_param reg_params[6]; - struct armv4_5_algorithm armv4_5_info; + struct arm_algorithm armv4_5_info; int retval = ERROR_OK; if (((count%2)!=0)||((offset%2)!=0)) @@ -188,7 +188,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32 r6 - set to 2, used to write flash command */ - uint32_t aduc702x_flash_write_code[] = { + static const uint32_t aduc702x_flash_write_code[] = { //<_start>: 0xe3a05008, // mov r5, #8 ; 0x8 0xe5845004, // str r5, [r4, #4] @@ -227,7 +227,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32 } /* memory buffer */ - while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK) + while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { buffer_size /= 2; if (buffer_size <= 256) @@ -241,9 +241,9 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32 } } - armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC; - armv4_5_info.core_mode = ARMV4_5_MODE_SVC; - armv4_5_info.core_state = ARMV4_5_STATE_ARM; + armv4_5_info.common_magic = ARM_COMMON_MAGIC; + armv4_5_info.core_mode = ARM_MODE_SVC; + armv4_5_info.core_state = ARM_STATE_ARM; init_reg_param(®_params[0], "r0", 32, PARAM_OUT); init_reg_param(®_params[1], "r1", 32, PARAM_OUT); @@ -343,7 +343,7 @@ static int aduc702x_write_single(struct flash_bank *bank, uint8_t *buffer, uint3 return ERROR_OK; } -int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { int retval; @@ -412,14 +412,15 @@ static int aduc702x_check_flash_completion(struct target* target, unsigned int t } struct flash_driver aduc702x_flash = { - .name = "aduc702x", - .flash_bank_command = &aduc702x_flash_bank_command, - .erase = &aduc702x_erase, - .protect = &aduc702x_protect, - .write = &aduc702x_write, - .probe = &aduc702x_probe, - .auto_probe = &aduc702x_probe, - .erase_check = &default_flash_blank_check, - .protect_check = &aduc702x_protect_check, - .info = &aduc702x_info - }; + .name = "aduc702x", + .flash_bank_command = aduc702x_flash_bank_command, + .erase = aduc702x_erase, + .protect = aduc702x_protect, + .write = aduc702x_write, + .read = default_flash_read, + .probe = aduc702x_probe, + .auto_probe = aduc702x_probe, + .erase_check = default_flash_blank_check, + .protect_check = aduc702x_protect_check, + .info = aduc702x_info +};