flash/nor/at91samd: Use 32-bit register writes for ST-Link compat
[fw/openocd] / src / target / dsp5680xx.h
index a607a5ba381112b25a13b9ce7ccd84401a6df6dd..152f446977dab176e957b4611ccfc0abedfba3e1 100644 (file)
@@ -1,28 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
 /***************************************************************************
  *   Copyright (C) 2011 by Rodrigo L. Rosa                                 *
  *   rodrigorosa.LG@gmail.com                                              *
  *                                                                         *
  *   Based on dsp563xx_once.h written by Mathias Kuester                   *
  *   mkdorg@users.sourceforge.net                                          *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#ifndef DSP5680XX_H
-#define DSP5680XX_H
+#ifndef OPENOCD_TARGET_DSP5680XX_H
+#define OPENOCD_TARGET_DSP5680XX_H
 
 #include <jtag/jtag.h>
 
@@ -35,7 +22,6 @@
  * The chip has two taps in the JTAG chain, the Master tap and the Core tap.
  * In this code the Master tap is only used to unlock the flash memory by executing a JTAG instruction.
  *
- *
  */
 
 #define S_FILE_DATA_OFFSET 0x200000
  */
 
  /** ----------------------------------------------------------------
- * Register Select Encoding (eonce_rev.1.0_0208081.pdf@14)
+ * Register Select Encoding (eonce_rev.1.0_0208081.pdf:14)
  * ----------------------------------------------------------------
  */
 #define DSP5680XX_ONCE_NOREG    0x00    /* No register selected */
 #define FLUSH_COUNT_READ_WRITE 8192 /* This value works, higher values (and lower...) may work as well. */
 #define FLUSH_COUNT_FLASH 8192
 /** ----------------------------------------------------------------
- * HFM (flash module) Commands (ref:MC56F801xRM.pdf@159)
+ * HFM (flash module) Commands (ref:MC56F801xRM.pdf:159)
  * ----------------------------------------------------------------
  */
 #define HFM_ERASE_VERIFY                 0x05
  */
 
 /** ----------------------------------------------------------------
- * Flashing (ref:MC56F801xRM.pdf@159)
+ * Flashing (ref:MC56F801xRM.pdf:159)
  * ----------------------------------------------------------------
  */
 #define HFM_BASE_ADDR     0x0F400   /** In x: mem. (write to S_FILE_DATA_OFFSET+HFM_BASE_ADDR
 
 #define HFM_EXEC_COMPLETE  0x40
 
-/* User status register (USTAT) masks (MC56F80XXRM.pdf@6.7.5) */
+/* User status register (USTAT) masks (MC56F80XXRM.pdf:6.7.5) */
 #define HFM_USTAT_MASK_BLANK 0x4
 #define HFM_USTAT_MASK_PVIOL_ACCER 0x30
 
  */
 
 /** ----------------------------------------------------------------
- * Register Memory Map (eonce_rev.1.0_0208081.pdf@16)
+ * Register Memory Map (eonce_rev.1.0_0208081.pdf:16)
  * ----------------------------------------------------------------
  */
 #define MC568013_EONCE_OBASE_ADDR 0xFF
  * ----------------------------------------------------------------
  */
 #define MC568013_SIM_BASE_ADDR 0xF140
-#define MC56803x_2x_SIM_BASE_ADDR 0xF100
+#define MC56803X_2X_SIM_BASE_ADDR 0xF100
 
 #define SIM_CMD_RESET 0x10
  /**
@@ -292,8 +278,6 @@ struct dsp5680xx_common {
        bool debug_mode_enabled;
 };
 
-extern struct dsp5680xx_common dsp5680xx_context;
-
 static inline struct dsp5680xx_common *target_to_dsp5680xx(struct target
                                                           *target)
 {
@@ -314,15 +298,15 @@ static inline struct dsp5680xx_common *target_to_dsp5680xx(struct target
  * @param buffer
  * @param address Word addressing.
  * @param count In bytes.
- * @param verify_flash Execute a CRC check after flashing.
+ * @param is_flash_lock
  *
  * @return
  */
-int dsp5680xx_f_wr(struct target *target, uint8_t * buffer, uint32_t address,
+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 funcionality of checking if the flash array is erased. This function
+ * 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
@@ -332,12 +316,12 @@ int dsp5680xx_f_wr(struct target *target, uint8_t * buffer, uint32_t address,
  *
  * @return
  */
-int dsp5680xx_f_erase_check(struct target *target, uint8_t * erased,
+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
+ * 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
@@ -357,7 +341,7 @@ int dsp5680xx_f_erase(struct target *target, int first, int last);
  *
  * @return
  */
-int dsp5680xx_f_protect_check(struct target *target, uint16_t * protected);
+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
@@ -382,4 +366,4 @@ int dsp5680xx_f_lock(struct target *target);
  */
 int dsp5680xx_f_unlock(struct target *target);
 
-#endif /* dsp5680xx.h */
+#endif /* OPENOCD_TARGET_DSP5680XX_H */