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/1322

-- gerrit

commit 94337f2e0b16441abab03a8341227346da31afa9
Author: Hsiangkai <[email protected]>
Date:   Tue Apr 2 17:04:30 2013 +0800

    aice: add execute() api for aice interface
    
    Debug host needs to execute arbitrary instructions through target cpu
    during debugging. So, open an aice interface to let host execute
    instructions on target as needed.
    
    Change-Id: Ieeff117985d21b5e3e266ddb579c39c318006e3b
    Signed-off-by: Hsiangkai <[email protected]>

diff --git a/src/jtag/aice/aice_port.h b/src/jtag/aice/aice_port.h
index 5a4127b..9734798 100644
--- a/src/jtag/aice/aice_port.h
+++ b/src/jtag/aice/aice_port.h
@@ -67,6 +67,10 @@ enum aice_api_s {
        AICE_MEMORY_MODE,
        AICE_READ_TLB,
        AICE_CACHE_CTL,
+       AICE_SET_RETRY_TIMES,
+       AICE_PROGRAM_EDM,
+       AICE_PACK_COMMAND,
+       AICE_EXECUTE,
 };
 
 enum aice_error_s {
@@ -179,6 +183,9 @@ struct aice_port_api_s {
 
        /** */
        int (*pack_command)(bool enable_pack_command);
+
+       /** */
+       int (*execute)(uint32_t *instructions, uint32_t instruction_num);
 };
 
 #define AICE_PORT_UNKNOWN      0
diff --git a/src/jtag/aice/aice_usb.c b/src/jtag/aice/aice_usb.c
index 174df4b..f03b84e 100644
--- a/src/jtag/aice/aice_usb.c
+++ b/src/jtag/aice/aice_usb.c
@@ -2996,6 +2996,60 @@ static int aice_usb_pack_command(bool 
enable_pack_command)
        return ERROR_OK;
 }
 
+static int aice_usb_execute(uint32_t *instructions, uint32_t instruction_num)
+{
+       uint32_t i, j;
+       uint8_t current_instruction_num;
+       uint32_t dim_instructions[4] = {NOP, NOP, NOP, BEQ_MINUS_12};
+
+       /* To execute 4 instructions as a special case */
+       if (instruction_num == 4)
+               return aice_execute_dim(instructions, 4);
+
+       for (i = 0 ; i < instruction_num ; i += 3) {
+               if (instruction_num - i < 3) {
+                       current_instruction_num = instruction_num - i;
+                       for (j = current_instruction_num ; j < 3 ; j++)
+                               dim_instructions[j] = NOP;
+               } else {
+                       current_instruction_num = 3;
+               }
+
+               memcpy(dim_instructions, instructions + i,
+                               current_instruction_num * sizeof(uint32_t));
+
+               /** fill DIM */
+               if (aice_write_dim(current_target_id,
+                                       dim_instructions,
+                                       4) != ERROR_OK)
+                       return ERROR_FAIL;
+
+               /** clear DBGER.DPED */
+               if (aice_write_misc(current_target_id, NDS_EDM_MISC_DBGER, 
NDS_DBGER_DPED) != ERROR_OK)
+                       return ERROR_FAIL;
+
+               /** execute DIM */
+               if (aice_execute(current_target_id) != ERROR_OK)
+                       return ERROR_FAIL;
+
+               /** read DBGER.DPED */
+               uint32_t dbger_value;
+               if (aice_read_misc(current_target_id, NDS_EDM_MISC_DBGER,
+                                       &dbger_value) != ERROR_OK)
+                       return ERROR_FAIL;
+
+               if ((dbger_value & NDS_DBGER_DPED) != NDS_DBGER_DPED) {
+                       LOG_ERROR("DIM execution is not done");
+                       return ERROR_FAIL;
+               }
+
+               if (ERROR_OK != check_suppressed_exception(dbger_value))
+                       return ERROR_FAIL;
+       }
+
+       return ERROR_OK;
+}
+
 /** */
 struct aice_port_api_s aice_usb_api = {
        /** */
@@ -3054,4 +3108,6 @@ struct aice_port_api_s aice_usb_api = {
        .program_edm = aice_usb_program_edm,
        /** */
        .pack_command = aice_usb_pack_command,
+       /** */
+       .execute = aice_usb_execute,
 };

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to