This is an automated email from Gerrit.

Hsiangkai Wang ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1578

-- gerrit

commit e19f755675f9b72e5a71338e18473bed08df48be
Author: Hsiangkai Wang <[email protected]>
Date:   Tue Jul 2 15:09:59 2013 +0800

    nds32: add new command "nds mdw|mdh|mdb|mww|mwh|mwb"
    
    add new Andes commands
    nds mww [phys] address data [count]
    nds mwh [phys] address data [count]
    nds mwb [phys] address data [count]
    nds mdw [phys] address [count]
    nds mdh [phys] address [count]
    nds mdb [phys] address [count]
    
    These commands will use DMA to access memory.
    
    Change-Id: Id3dd3914d18145f19153b4958d752664ee7de015
    Signed-off-by: Hsiangkai Wang <[email protected]>

diff --git a/src/target/nds32_cmd.c b/src/target/nds32_cmd.c
index 3f24370..fbd6239 100644
--- a/src/target/nds32_cmd.c
+++ b/src/target/nds32_cmd.c
@@ -613,6 +613,37 @@ COMMAND_HANDLER(handle_nds32_word_access_mem_command)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(handle_nds32_dma_memory)
+{
+       struct target *target = get_current_target(CMD_CTX);
+       struct nds32 *nds32 = target_to_nds32(target);
+       char target_command[128];
+       enum nds_memory_access origin_mem_access;
+
+       /* backup origin mem_access value */
+       origin_mem_access = nds32->memory.access_channel;
+
+       /* switch to BUS mode, always use BUS mode to display memory */
+       command_run_line(CMD_CTX, "nds mem_access bus");
+
+       sprintf(target_command, "%s ", CMD_NAME);
+       for (uint32_t i = 0; i < CMD_ARGC; i++) {
+               strcat(target_command, CMD_ARGV[i]);
+               strcat(target_command, " ");
+       }
+
+       /* display memory */
+       int retval = command_run_line(CMD_CTX, target_command);
+
+       /* restore origin mem_access_value */
+       if (NDS_MEMORY_ACC_BUS == origin_mem_access)
+               command_run_line(CMD_CTX, "nds mem_access bus");
+       else if (NDS_MEMORY_ACC_CPU == origin_mem_access)
+               command_run_line(CMD_CTX, "nds mem_access cpu");
+
+       return retval;
+}
+
 COMMAND_HANDLER(handle_nds32_query_target_command)
 {
        struct target *target = get_current_target(CMD_CTX);
@@ -1048,6 +1079,48 @@ static const struct command_registration 
nds32_exec_command_handlers[] = {
                .help = "Always use word-aligned address to access memory.",
        },
        {
+               .name = "mww",
+               .mode = COMMAND_EXEC,
+               .handler = handle_nds32_dma_memory,
+               .help = "Write 32-bit words to target memory through DMA",
+               .usage = "[phys] address data [count]",
+       },
+       {
+               .name = "mwh",
+               .mode = COMMAND_EXEC,
+               .handler = handle_nds32_dma_memory,
+               .help = "Write 16-bit half-words to target memory through DMA",
+               .usage = "[phys] address data [count]",
+       },
+       {
+               .name = "mwb",
+               .mode = COMMAND_EXEC,
+               .handler = handle_nds32_dma_memory,
+               .help = "Write 8-bit bytes to target memory through DMA",
+               .usage = "[phys] address data [count]",
+       },
+       {
+               .name = "mdw",
+               .mode = COMMAND_EXEC,
+               .handler = handle_nds32_dma_memory,
+               .help = "Display target memory as 32-bit words through DMA",
+               .usage = "[phys] address [count]",
+       },
+       {
+               .name = "mdh",
+               .mode = COMMAND_EXEC,
+               .handler = handle_nds32_dma_memory,
+               .help = "Display target memory as 16-bit half-words through 
DMA",
+               .usage = "[phys] address [count]",
+       },
+       {
+               .name = "mdb",
+               .mode = COMMAND_EXEC,
+               .handler = handle_nds32_dma_memory,
+               .help = "Display target memory as 8-bit bytes through DMA",
+               .usage = "[phys] address [count]",
+       },
+       {
                .name = "bulk_write",
                .jim_handler = jim_nds32_bulk_write,
                .mode = COMMAND_EXEC,

-- 

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to