X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Faducm360.c;h=4e816fd618f3cef46a02ea2ba51d694a70de29dc;hb=c1f4d9e6e8f9cdab122db36299e039a73151ffe4;hp=8681a25af45a44b51867e495da8725c48488ad98;hpb=f19ac83152b54a204b8148815a538d868973e1e1;p=openocd.git diff --git a/src/flash/nor/aducm360.c b/src/flash/nor/aducm360.c index 8681a25af4..4e816fd618 100644 --- a/src/flash/nor/aducm360.c +++ b/src/flash/nor/aducm360.c @@ -85,13 +85,12 @@ FLASH_BANK_COMMAND_HANDLER(aducm360_flash_bank_command) /* ----------------------------------------------------------------------- */ static int aducm360_build_sector_list(struct flash_bank *bank) { - int i = 0; uint32_t offset = 0; /* sector size is 512 */ bank->num_sectors = bank->size / FLASH_SECTOR_SIZE; bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); - for (i = 0; i < bank->num_sectors; ++i) { + for (unsigned i = 0; i < bank->num_sectors; ++i) { bank->sectors[i].offset = offset; bank->sectors[i].size = FLASH_SECTOR_SIZE; offset += bank->sectors[i].size; @@ -102,13 +101,6 @@ static int aducm360_build_sector_list(struct flash_bank *bank) return ERROR_OK; } -/* ----------------------------------------------------------------------- */ -static int aducm360_protect_check(struct flash_bank *bank) -{ - LOG_WARNING("aducm360_protect_check not implemented."); - return ERROR_OK; -} - /* ----------------------------------------------------------------------- */ static int aducm360_mass_erase(struct target *target) { @@ -171,7 +163,8 @@ static int aducm360_page_erase(struct target *target, uint32_t padd) } /* ----------------------------------------------------------------------- */ -static int aducm360_erase(struct flash_bank *bank, int first, int last) +static int aducm360_erase(struct flash_bank *bank, unsigned int first, + unsigned int last) { int res = ERROR_OK; int i; @@ -194,13 +187,6 @@ static int aducm360_erase(struct flash_bank *bank, int first, int last) return res; } -/* ----------------------------------------------------------------------- */ -static int aducm360_protect(struct flash_bank *bank, int set, int first, int last) -{ - LOG_ERROR("aducm360_protect not implemented."); - return ERROR_FLASH_OPERATION_FAILED; -} - /* ----------------------------------------------------------------------- */ static int aducm360_write_block_sync( struct flash_bank *bank, @@ -299,7 +285,7 @@ static int aducm360_write_block_sync( res = buf_get_u32(reg_params[4].value, 0, 32); if (res) { - LOG_ERROR("aducm360 fast sync algorithm reports an error (%02X)", res); + LOG_ERROR("aducm360 fast sync algorithm reports an error (%02" PRIX32 ")", res); retval = ERROR_FAIL; break; } @@ -415,7 +401,7 @@ static int aducm360_write_block_async( } else { res = buf_get_u32(reg_params[4].value, 0, 32); /*RESULT*/ if (res) { - LOG_ERROR("aducm360 fast async algorithm reports an error (%02X)", res); + LOG_ERROR("aducm360 fast async algorithm reports an error (%02" PRIX32 ")", res); retval = ERROR_FAIL; } } @@ -448,10 +434,8 @@ static int aducm360_write_block(struct flash_bank *bank, switch (choice) { case 0: return aducm360_write_block_sync(bank, buffer, offset, count); - break; case 1: return aducm360_write_block_async(bank, buffer, offset, count); - break; default: LOG_ERROR("aducm360_write_block was cancelled (no writing method was chosen)!"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; @@ -568,15 +552,13 @@ static int aducm360_check_flash_completion(struct target *target, unsigned int t } /* ----------------------------------------------------------------------- */ -struct flash_driver aducm360_flash = { +const struct flash_driver aducm360_flash = { .name = "aducm360", .flash_bank_command = aducm360_flash_bank_command, .erase = aducm360_erase, - .protect = aducm360_protect, .write = aducm360_write, .read = default_flash_read, .probe = aducm360_probe, .auto_probe = aducm360_probe, .erase_check = default_flash_blank_check, - .protect_check = aducm360_protect_check, };