+/**
+ * Writes to flash memory.
+ * Does not check if flash is erased, it's up to the user to erase the flash before running
+ * this function.
+ * The flashing algorithm runs from RAM, reading from a register to which this function
+ * writes to. The algorithm is open loop, there is no control to verify that the FM read
+ * the register before writing the next data. A closed loop approach was much slower,
+ * and the current implementation does not fail, and if it did the crc check would detect it,
+ * allowing to flash again.
+ *
+ * @param target
+ * @param buffer
+ * @param address Word addressing.
+ * @param count In bytes.
+ * @param is_flash_lock
+ *
+ * @return
+ */
+int dsp5680xx_f_wr(struct target *target, const uint8_t * buffer, uint32_t address,
+ uint32_t count, int is_flash_lock);
+
+/**
+ * The FM has the functionality of checking if the flash array is erased. This function
+ * executes it. It does not support individual sector analysis.
+ *
+ * @param target
+ * @param erased
+ * @param sector This parameter is ignored because the FM does not support checking if
+ * individual sectors are erased.
+ *
+ * @return
+ */
+int dsp5680xx_f_erase_check(struct target *target, uint8_t * erased,
+ uint32_t sector);
+
+/**
+ * Erases either a sector or the complete flash array. If either the range first-last covers
+ * the complete array or if first == 0 and last == 0 then a mass erase command is executed
+ * on the FM. If not, then individual sectors are erased.
+ *
+ * @param target
+ * @param first
+ * @param last
+ *
+ * @return
+ */
+int dsp5680xx_f_erase(struct target *target, int first, int last);
+
+/**
+ * Reads the memory mapped protection register. A 1 implies the sector is protected,
+ * a 0 implies the sector is not protected.
+ *
+ * @param target
+ * @param protected Data read from the protection register.
+ *
+ * @return
+ */
+int dsp5680xx_f_protect_check(struct target *target, uint16_t * protected);
+
+/**
+ * Writes the flash security words with a specific value. The chip's security will be
+ * enabled after the first reset following the execution of this function.
+ *
+ * @param target
+ *
+ * @return
+ */
+int dsp5680xx_f_lock(struct target *target);