-struct dsp5680xx_flash_bank {
- struct working_area *write_algorithm;
-};
-
-static int dsp5680xx_build_sector_list(struct flash_bank *bank){
- //LOG_USER("%s not implemented",__FUNCTION__);
- //return ERROR_OK;
-
- // sector size is 512
- // bank->num_sectors = bank->size / 512; // Bank size is actually 0x2000, but it is set much higher as part of the workaround for byte/word addressing issues.
- bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
- int i;
- for (i = 0; i < bank->num_sectors; ++i){
- bank->sectors[i].offset = 0;// not implemented.
- bank->sectors[i].size = HFM_SECTOR_SIZE;
- //offset += bank->sectors[i].size;
- bank->sectors[i].is_erased = -1;
- bank->sectors[i].is_protected = -1;
- }
- LOG_USER("%s not tested yet.",__FUNCTION__);
- return ERROR_OK;
-
-}
-
-// flash bank dsp5680xx 0 0 0 0 <target#>
-FLASH_BANK_COMMAND_HANDLER(dsp5680xx_flash_bank_command){
- struct dsp5680xx_flash_bank *nbank;
-
- nbank = malloc(sizeof(struct dsp5680xx_flash_bank));
-
- bank->base = HFM_FLASH_BASE_ADDR;
- bank->size = HFM_SIZE; // top 4k not accessible
- bank->driver_priv = nbank;
- bank->num_sectors = HFM_SECTOR_COUNT;// This number is anything >0. not really used.
- dsp5680xx_build_sector_list(bank);
+static int dsp5680xx_build_sector_list(struct flash_bank *bank)
+{
+ bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
+
+ for (unsigned int i = 0; i < bank->num_sectors; ++i) {
+ bank->sectors[i].offset = i * HFM_SECTOR_SIZE;
+ bank->sectors[i].size = HFM_SECTOR_SIZE;
+ bank->sectors[i].is_erased = -1;
+ bank->sectors[i].is_protected = -1;
+ }
+ LOG_USER("%s not tested yet.", __func__);
+ return ERROR_OK;