return ERROR_OK;
}
-static int cc3220sf_erase(struct flash_bank *bank, int first, int last)
+static int cc3220sf_erase(struct flash_bank *bank, unsigned int first,
+ unsigned int last)
{
struct target *target = bank->target;
bool done;
}
/* Erase requested sectors one by one */
- for (int i = first; i <= last; i++) {
+ for (unsigned int i = first; i <= last; i++) {
/* Determine address of sector to erase */
address = FLASH_BASE_ADDR + i * FLASH_SECTOR_SIZE;
LOG_ERROR("cc3220sf: Flash operation failed");
break;
}
+
+ keep_alive();
}
/* Do one word write for any final bytes less than a full word */
uint32_t base;
uint32_t size;
- int num_sectors;
+ unsigned int num_sectors;
base = FLASH_BASE_ADDR;
size = FLASH_NUM_SECTORS * FLASH_SECTOR_SIZE;
num_sectors = FLASH_NUM_SECTORS;
- if (NULL != bank->sectors) {
- free(bank->sectors);
- bank->sectors = NULL;
- }
+ free(bank->sectors);
bank->sectors = malloc(sizeof(struct flash_sector) * num_sectors);
if (NULL == bank->sectors)
bank->write_end_alignment = 0;
bank->num_sectors = num_sectors;
- for (int i = 0; i < num_sectors; i++) {
+ for (unsigned int i = 0; i < num_sectors; i++) {
bank->sectors[i].offset = i * FLASH_SECTOR_SIZE;
bank->sectors[i].size = FLASH_SECTOR_SIZE;
bank->sectors[i].is_erased = -1;
return retval;
}
-static int cc3220sf_info(struct flash_bank *bank, char *buf, int buf_size)
+static int cc3220sf_info(struct flash_bank *bank, struct command_invocation *cmd)
{
- int printed;
-
- printed = snprintf(buf, buf_size, "CC3220SF with 1MB internal flash\n");
-
- if (printed >= buf_size)
- return ERROR_BUF_TOO_SMALL;
-
+ command_print_sameline(cmd, "CC3220SF with 1MB internal flash\n");
return ERROR_OK;
}
-struct flash_driver cc3220sf_flash = {
+const struct flash_driver cc3220sf_flash = {
.name = "cc3220sf",
.flash_bank_command = cc3220sf_flash_bank_command,
.erase = cc3220sf_erase,