- add bulk memory write function - execute jtag queue at the end of the memory transfer
authorMathias K <kesmtp@freenet.de>
Tue, 15 Feb 2011 15:59:23 +0000 (16:59 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 15 Feb 2011 19:19:55 +0000 (20:19 +0100)
src/target/dsp563xx.c

index 4371d0a8c64c7b7413a10d4b9960a2dbda8fa44d..10365dfdd76eb254670d6396b8135e2820cf7362 100644 (file)
@@ -29,8 +29,6 @@
 #include "dsp563xx.h"
 #include "dsp563xx_once.h"
 
-//#define DSP563XX_JTAG_INS_LEN         4
-
 #define ASM_REG_W_R0   0x60F400
 #define ASM_REG_W_R1   0x61F400
 #define ASM_REG_W_R2   0x62F400
@@ -1138,9 +1136,16 @@ static int dsp563xx_read_memory(struct target *target, int mem_type, uint32_t ad
                return ERROR_TARGET_NOT_HALTED;
        }
 
+       /* we only support 4 byte aligned data */
+       if ( size != 4 )
+       {
+               return ERROR_INVALID_ARGUMENTS;
+       }
+
        switch (mem_type)
        {
                case MEM_X:
+                       /* TODO: mark effected queued registers */
                        move_cmd = 0x61d800;
                        break;
                case MEM_Y:
@@ -1173,17 +1178,30 @@ static int dsp563xx_read_memory(struct target *target, int mem_type, uint32_t ad
 
        for (i = 0; i < x; i++)
        {
-               data = 0;
                if ((err = dsp563xx_once_execute_sw_ir_nq(target->tap, move_cmd)) != ERROR_OK)
                        return err;
-               if ((err = dsp563xx_once_execute_sw_ir(target->tap, 0x08D13C)) != ERROR_OK)
+               if ((err = dsp563xx_once_execute_sw_ir_nq(target->tap, 0x08D13C)) != ERROR_OK)
                        return err;
-               if ((err = dsp563xx_once_reg_read(target->tap, DSP563XX_ONCE_OGDBR, &data)) != ERROR_OK)
+               if ((err = dsp563xx_once_reg_read_nq(target->tap, DSP563XX_ONCE_OGDBR, (uint32_t*)b)) != ERROR_OK)
                        return err;
-               target_buffer_set_u32(target, b, data);
                b += 4;
+       }
 
-               LOG_DEBUG("R: %08X", data);
+       /* flush the jtag queue */
+       if ((err = jtag_execute_queue()) != ERROR_OK)
+       {
+               return err;
+       }
+
+       /* walk over the buffer and fix target endianness */
+       b = buffer;
+
+       for (i = 0; i < x; i++)
+       {
+               data = *((uint32_t*)b) & 0x00FFFFFF;
+//             LOG_DEBUG("R: %08X", *((uint32_t*)b));
+               target_buffer_set_u32(target, b, data);
+               b += 4;
        }
 
        return ERROR_OK;
@@ -1210,6 +1228,12 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a
                return ERROR_TARGET_NOT_HALTED;
        }
 
+       /* we only support 4 byte aligned data */
+       if ( size != 4 )
+       {
+               return ERROR_INVALID_ARGUMENTS;
+       }
+
        switch (mem_type)
        {
                case MEM_X:
@@ -1246,18 +1270,24 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a
        for (i = 0; i < x; i++)
        {
                data = target_buffer_get_u32(target, b);
-               data &= 0x00ffffff;
 
-               LOG_DEBUG("W: %08X", data);
+//             LOG_DEBUG("W: %08X", data);
+
+               data &= 0x00ffffff;
 
                if ((err = dsp563xx_once_execute_dw_ir_nq(target->tap, 0x61F400, data)) != ERROR_OK)
                        return err;
-               if ((err = dsp563xx_once_execute_sw_ir(target->tap, move_cmd)) != ERROR_OK)
+               if ((err = dsp563xx_once_execute_sw_ir_nq(target->tap, move_cmd)) != ERROR_OK)
                        return err;
-
                b += 4;
        }
 
+       /* flush the jtag queue */
+       if ((err = jtag_execute_queue()) != ERROR_OK)
+       {
+               return err;
+       }
+
        return ERROR_OK;
 }
 
@@ -1266,6 +1296,11 @@ static int dsp563xx_write_memory_p(struct target *target, uint32_t address, uint
        return dsp563xx_write_memory(target, MEM_P, address, size, count, buffer);
 }
 
+static int dsp563xx_bulk_write_memory_p(struct target *target, uint32_t address, uint32_t count, uint8_t *buffer)
+{
+       return dsp563xx_write_memory(target, MEM_P, address, 4, count, buffer);
+}
+
 static void handle_md_output(struct command_context *cmd_ctx, struct target *target, uint32_t address, unsigned size, unsigned count, const uint8_t * buffer)
 {
        const unsigned line_bytecnt = 32;
@@ -1485,6 +1520,7 @@ struct target_type dsp563xx_target = {
 
        .read_memory = dsp563xx_read_memory_p,
        .write_memory = dsp563xx_write_memory_p,
+       .bulk_write_memory = dsp563xx_bulk_write_memory_p,
 
        .commands = dsp563xx_command_handlers,
        .target_create = dsp563xx_target_create,

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)