dsp5680xx: fix compilation problems
authorØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 28 Jun 2011 16:09:48 +0000 (18:09 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 28 Jun 2011 16:09:48 +0000 (18:09 +0200)
use a more specific global variable name than "context", which
can easily conflict with other things.

src/target/dsp5680xx.c
src/target/dsp5680xx.h

index 9afda42484ef63e323ad048cd40a310bbcb8ac2c..97cd0f42030eae23c42e1b90a9bb3ee2fabdf396 100644 (file)
@@ -28,6 +28,9 @@
 #include "target_type.h"
 #include "dsp5680xx.h"
 
+struct dsp5680xx_common dsp5680xx_context;
+
+
 #define err_check(retval,err_msg) if(retval != ERROR_OK){LOG_ERROR("%s: %d %s.",__FUNCTION__,__LINE__,err_msg);return retval;}
 #define err_check_propagate(retval) if(retval!=ERROR_OK){return retval;}
 
@@ -62,7 +65,7 @@ static int dsp5680xx_drscan(struct target * target, uint8_t * data_to_shift_into
   //can i send as many bits as i want?
   //is the casting necessary?
   jtag_add_plain_dr_scan(len,data_to_shift_into_dr,data_shifted_out_of_dr, TAP_IDLE);
-  if(context.flush){
+  if(dsp5680xx_context.flush){
        retval = dsp5680xx_execute_queue();
        err_check_propagate(retval);
   }
@@ -94,7 +97,7 @@ static int dsp5680xx_irscan(struct target * target, uint32_t * data_to_shift_int
   //can i send as many bits as i want?
   //is the casting necessary?
   jtag_add_plain_ir_scan(ir_len,(uint8_t *)data_to_shift_into_ir,(uint8_t *)data_shifted_out_of_ir, TAP_IDLE);
-  if(context.flush){
+  if(dsp5680xx_context.flush){
     retval = dsp5680xx_execute_queue();
     err_check_propagate(retval);
   }
@@ -505,7 +508,7 @@ static int eonce_pc_store(struct target * target){
   retval = eonce_rx_lower_data(target,(uint16_t *)&tmp);
   err_check_propagate(retval);
   LOG_USER("PC value: 0x%06X\n",tmp);
-  context.stored_pc = (uint32_t)tmp;
+  dsp5680xx_context.stored_pc = (uint32_t)tmp;
   return ERROR_OK;
 }
 
@@ -516,8 +519,8 @@ static int dsp5680xx_target_create(struct target *target, Jim_Interp * interp){
 }
 
 static int dsp5680xx_init_target(struct command_context *cmd_ctx, struct target *target){
-  context.stored_pc = 0;
-  context.flush = 1;
+  dsp5680xx_context.stored_pc = 0;
+  dsp5680xx_context.flush = 1;
   LOG_DEBUG("target initiated!");
   //TODO core tap must be enabled before running these commands, currently this is done in the .cfg tcl script.
   return ERROR_OK;
@@ -739,12 +742,12 @@ static int dsp5680xx_read(struct target * target, uint32_t address, unsigned siz
   retval = dsp5680xx_convert_address(&address, &pmem);
   err_check_propagate(retval);
 
-  context.flush = 0;
+  dsp5680xx_context.flush = 0;
   int counter = FLUSH_COUNT_READ_WRITE;
 
   for (unsigned i=0; i<count; i++){
     if(--counter==0){
-      context.flush = 1;
+      dsp5680xx_context.flush = 1;
       counter = FLUSH_COUNT_FLASH;
     }
     switch (size){
@@ -766,10 +769,10 @@ static int dsp5680xx_read(struct target * target, uint32_t address, unsigned siz
       break;
     }
        err_check_propagate(retval);
-    context.flush = 0;
+    dsp5680xx_context.flush = 0;
   }
 
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
   retval = dsp5680xx_execute_queue();
   err_check_propagate(retval);
 
@@ -823,18 +826,18 @@ static int dsp5680xx_write_8(struct target * target, uint32_t address, uint32_t
   int counter = FLUSH_COUNT_READ_WRITE;
   for(iter = 0; iter<count/2; iter++){
     if(--counter==0){
-      context.flush = 1;
+      dsp5680xx_context.flush = 1;
       counter = FLUSH_COUNT_READ_WRITE;
     }
     retval = dsp5680xx_write_16_single(target,address+iter,data_w[iter], pmem);
     if(retval != ERROR_OK){
       LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
-      context.flush = 1;
+      dsp5680xx_context.flush = 1;
       return retval;
     }
-    context.flush = 0;
+    dsp5680xx_context.flush = 0;
   }
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
 
   // Only one byte left, let's not overwrite the other byte (mem is 16bit)
   // Need to retrieve the part we do not want to overwrite.
@@ -863,18 +866,18 @@ static int dsp5680xx_write_16(struct target * target, uint32_t address, uint32_t
 
   for(iter = 0; iter<count; iter++){
        if(--counter==0){
-         context.flush = 1;
+         dsp5680xx_context.flush = 1;
       counter = FLUSH_COUNT_READ_WRITE;
        }
     retval = dsp5680xx_write_16_single(target,address+iter,data[iter], pmem);
     if(retval != ERROR_OK){
       LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
-         context.flush = 1;
+         dsp5680xx_context.flush = 1;
       return retval;
     }
-       context.flush = 0;
+       dsp5680xx_context.flush = 0;
   }
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
   return retval;
 }
 
@@ -889,18 +892,18 @@ static int dsp5680xx_write_32(struct target * target, uint32_t address, uint32_t
 
   for(iter = 0; iter<count; iter++){
        if(--counter==0){
-         context.flush = 1;
+         dsp5680xx_context.flush = 1;
       counter = FLUSH_COUNT_READ_WRITE;
        }
     retval = dsp5680xx_write_32_single(target,address+(iter<<1),data[iter], pmem);
     if(retval != ERROR_OK){
       LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
-         context.flush = 1;
+         dsp5680xx_context.flush = 1;
       return retval;
     }
-       context.flush = 0;
+       dsp5680xx_context.flush = 0;
   }
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
   return retval;
 }
 
@@ -1104,7 +1107,7 @@ static int dsp5680xx_f_execute_command(struct target * target, uint16_t command,
     }
   }while (!(i&0x40));                          // wait until current command is complete
 
-  context.flush = 0;
+  dsp5680xx_context.flush = 0;
 
   retval = eonce_move_value_at_r2_disp(target,0x00,HFM_CNFG);  // write to HFM_CNFG (lock=0, select bank) -- flash_desc.bank&0x03,0x01 == 0x00,0x01 ???
   err_check_propagate(retval);
@@ -1134,7 +1137,7 @@ static int dsp5680xx_f_execute_command(struct target * target, uint16_t command,
   retval = eonce_move_value_at_r2_disp(target,0x80,HFM_USTAT);         // start the command
   err_check_propagate(retval);
 
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
   retval = dsp5680xx_execute_queue();
   err_check_propagate(retval);
 
@@ -1371,7 +1374,7 @@ int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, ui
   // Setup registers needed by pgm_write_pflash
   // -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 
-  context.flush = 0;
+  dsp5680xx_context.flush = 0;
 
   retval = eonce_move_long_to_r3(target,address);  // Destination address to r3
   err_check_propagate(retval);
@@ -1400,7 +1403,7 @@ int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, ui
        err_check(retval,"Cannot handle odd number of words.");
   }
 
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
   retval = dsp5680xx_execute_queue();
   err_check_propagate(retval);
 
@@ -1412,21 +1415,21 @@ int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, ui
   err_check_propagate(retval);
 
   int counter = FLUSH_COUNT_FLASH;
-  context.flush = 0;
+  dsp5680xx_context.flush = 0;
   uint32_t i;
   for(i=1; (i<count/2)&&(i<HFM_SIZE_WORDS); i++){
     if(--counter==0){
-      context.flush = 1;
+      dsp5680xx_context.flush = 1;
       counter = FLUSH_COUNT_FLASH;
     }
     retval = eonce_tx_upper_data(target,buff16[i],&drscan_data);
        if(retval!=ERROR_OK){
-         context.flush = 1;
+         dsp5680xx_context.flush = 1;
          err_check_propagate(retval);
        }
-       context.flush = 0;
+       dsp5680xx_context.flush = 0;
   }
-  context.flush = 1;
+  dsp5680xx_context.flush = 1;
   // -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   // Verify flash
   // -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
index 3fbe90ecf0824bc06e3dc623682221851d0b0286..599fd68e1ee7bd30fd7a8587cdc0ace01ba82130 100644 (file)
@@ -217,7 +217,9 @@ 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;

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)