From d09bef2622fe2a1baeae7a98fad02b25ed104d16 Mon Sep 17 00:00:00 2001 From: "Rodrigo L. Rosa" Date: Thu, 2 Jun 2011 09:52:33 -0700 Subject: code cleanup --- src/target/dsp5680xx.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c index f2f2dba6..044fb7ec 100644 --- a/src/target/dsp5680xx.c +++ b/src/target/dsp5680xx.c @@ -28,7 +28,7 @@ #include "target_type.h" #include "dsp5680xx.h" -#define err_check(retval,err_msg) if(retval != ERROR_OK){LOG_ERROR("%s: %s.",__FUNCTION__,err_msg);return retval;} +#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;} // Forward declarations, could try to optimize this. @@ -158,16 +158,11 @@ int dsp5680xx_target_status(struct target * target, uint8_t * jtag_st, uint16_t } static int dsp5680xx_assert_reset(struct target *target){ - //TODO verify the sleeps are necessary - jtag_add_reset(1,0); target->state = TARGET_RESET; - jtag_add_sleep(500); - usleep(1000); return ERROR_OK; } static int dsp5680xx_deassert_reset(struct target *target){ - jtag_add_reset(0,0); target->state = TARGET_RUNNING; return ERROR_OK; } @@ -179,7 +174,6 @@ static int dsp5680xx_poll(struct target *target){ uint16_t read_tmp; retval = dsp5680xx_jtag_status(target,&jtag_status); err_check_propagate(retval); - LOG_DEBUG("JTAG 0x%02X",jtag_status);//TODO remove!! if (jtag_status == JTAG_STATUS_DEBUG) if (target->state != TARGET_HALTED){ retval = eonce_enter_debug_mode(target,&read_tmp); @@ -620,16 +614,15 @@ static int eonce_move_value_to_pc(struct target * target, uint32_t value) static int eonce_load_TX_RX_to_r0(struct target * target) { - //TODO add error control uint32_t obase_addr; int retval = dsp5680xx_obase_addr(target,& obase_addr); - eonce_move_long_to_r0(target,((MC568013_EONCE_TX_RX_ADDR)+(obase_addr<<16))); + err_check_propagate(retval); + retval = eonce_move_long_to_r0(target,((MC568013_EONCE_TX_RX_ADDR)+(obase_addr<<16))); return retval; } static int eonce_load_TX_RX_high_to_r0(struct target * target) { - //TODO add error control uint32_t obase_addr; int retval = dsp5680xx_obase_addr(target,& obase_addr); err_check_propagate(retval); @@ -811,22 +804,19 @@ static int dsp5680xx_write_8(struct target * target, uint32_t address, uint32_t uint16_t * data_w = (uint16_t *)data; uint32_t iter; - int counter_reset = FLUSH_COUNT_WRITE; - int counter = counter_reset; - + int counter = FLUSH_COUNT_WRITE; for(iter = 0; iterstate != TARGET_HALTED){ LOG_USER("Target must be halted."); return ERROR_OK; -- cgit v1.2.3