-static int dsp5680xx_write_single(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count){
- LOG_USER("%s not implemented",__FUNCTION__);
- return ERROR_OK;
-}
-*/
-
-//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-// Flash stuff test
-//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-static int dsp5680xx_flash_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count){
- int retval;
- if((offset + count/2)>bank->size){
- LOG_ERROR("%s: Flash bank cannot fit data.",__FUNCTION__);
- return ERROR_FAIL;
- }
- if(offset%2){
- LOG_ERROR("%s: Writing to odd addresses not supported. This chip uses word addressing, Openocd only supports byte addressing. The workaround results in disabling writing to odd byte addresses.",__FUNCTION__);
- return ERROR_FAIL;
- }
- retval = dsp5680xx_f_wr(bank->target, buffer, bank->base + offset/2, count);
- if(retval == ERROR_OK)
- bank->sectors[0].is_erased = 0;
- else
- bank->sectors[0].is_erased = -1;
- return retval;
-}
+/**
+ * The dsp5680xx use word addressing. The "/2" that appear in the following code
+ * are a workaround for the fact that OpenOCD uses byte addressing.
+ *
+ * @param bank
+ * @param buffer Data to write to flash.
+ * @param offset
+ * @param count In bytes (2 bytes per address).
+ *
+ * @return
+ */
+static int dsp5680xx_flash_write(struct flash_bank *bank, const uint8_t* buffer,
+ uint32_t offset, uint32_t count)
+{
+ int retval;