dsp5680xx - error codes
[openocd.git] / src / target / dsp5680xx.h
index a57472403747dc9854bd199ac1b4f501b8c938f6..9c8f435ce59caf2363c0338b459ae063eacd8237 100644 (file)
 //----------------------------------------------------------------
 // Master TAP instructions from MC56F8000RM.pdf
 //----------------------------------------------------------------
-#define MASTER_TAP_CMD_BYPASS      0xFF
-#define MASTER_TAP_CMD_IDCODE      0x02
-#define MASTER_TAP_CMD_TLM_SEL     0x05
-#define MASTER_TAP_CMD_FLASH_ERASE 0x08
+#define MASTER_TAP_CMD_BYPASS      0xF
+#define MASTER_TAP_CMD_IDCODE      0x2
+#define MASTER_TAP_CMD_TLM_SEL     0x5
+#define MASTER_TAP_CMD_FLASH_ERASE 0x8
 //----------------------------------------------------------------
 
 //----------------------------------------------------------------
 #define SIM_CMD_RESET 0x10
 //----------------------------------------------------------------
 
+/**
+ * ----------------------------------------------------------------
+ * ERROR codes - enable automatic parsing of output
+ * ----------------------------------------------------------------
+ */
+#define DSP5680XX_ERROR_UNKNOWN_OR_ERROR_OPENOCD -100
+#define DSP5680XX_ERROR_JTAG_COMM -1
+#define DSP5680XX_ERROR_JTAG_RESET -2
+#define DSP5680XX_ERROR_JTAG_INVALID_TAP -3
+#define DSP5680XX_ERROR_JTAG_DR_LEN_OVERFLOW -4
+#define DSP5680XX_ERROR_INVALID_IR_LEN -5
+#define DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER -6
+#define DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE -7
+#define DSP5680XX_ERROR_JTAG_TAP_FIND_MASTER -8
+#define DSP5680XX_ERROR_JTAG_TAP_FIND_CORE -9
+#define DSP5680XX_ERROR_JTAG_DRSCAN -10
+#define DSP5680XX_ERROR_JTAG_IRSCAN -11
+#define DSP5680XX_ERROR_ENTER_DEBUG_MODE -12
+#define DSP5680XX_ERROR_RESUME -13
+#define DSP5680XX_ERROR_WRITE_WITH_TARGET_RUNNING -14
+#define DSP5680XX_ERROR_INVALID_DATA_SIZE_UNIT -15
+#define DSP5680XX_ERROR_PROTECT_CHECK_INVALID_ARGS -16
+#define DSP5680XX_ERROR_FM_BUSY -17
+#define DSP5680XX_ERROR_FM_CMD_TIMED_OUT -18
+#define DSP5680XX_ERROR_FM_EXEC -19
+#define DSP5680XX_ERROR_FM_SET_CLK -20
+#define DSP5680XX_ERROR_FLASHING_INVALID_WORD_COUNT -21
+#define DSP5680XX_ERROR_FLASHING_CRC -22
+#define DSP5680XX_ERROR_FLASHING -23
+#define DSP5680XX_ERROR_NOT_IMPLEMENTED_STEP -24
+/**
+ * ----------------------------------------------------------------
+ */
+
 struct dsp5680xx_common{
   //TODO
   uint32_t stored_pc;
   int flush;
-}context;
+};
+
+extern struct dsp5680xx_common dsp5680xx_context;
 
 static inline struct dsp5680xx_common *target_to_dsp5680xx(struct target *target){
   return target->arch_info;
@@ -226,15 +262,17 @@ static inline struct dsp5680xx_common *target_to_dsp5680xx(struct target *target
 /** 
  * 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 
+ * @param address Word addressing.
  * @param count In bytes. 
+ * @param verify_flash Execute a CRC check after flashing. 
  * 
  * @return 
  */
-int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, uint32_t count);
+int dsp5680xx_f_wr(struct target * target, 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 executes it. It does not support individual sector analysis.
@@ -259,7 +297,7 @@ int dsp5680xx_f_erase_check(struct target * target,uint8_t * erased, uint32_t se
 int dsp5680xx_f_erase(struct target * target, int first, int last);
 
 /** 
- * Reads the memory mapped protection register.
+ * 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.

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)