diff --git a/src/DAP.c b/src/DAP.c index 6460dc3..6eb16d1 100644 --- a/src/DAP.c +++ b/src/DAP.c @@ -80,7 +80,7 @@ static uint8_t DAP_Info(uint8_t id, uint8_t *info) { uint8_t length = 0; - DEBUG("DAP_Info: %02X\n", id); + DEBUGF("DAP_Info: %02X\n", id); switch (id) { @@ -167,11 +167,11 @@ static uint32_t DAP_LED(uint8_t *request, uint8_t *response) switch (*request) { case DAP_LED_DEBUGGER_CONNECTED: - DEBUG("DAP_LED: CONNECTED %02X\n", (*(request+1) & 1)); + DEBUGF("DAP_LED: CONNECTED %02X\n", (*(request+1) & 1)); LED_CONNECTED_OUT((*(request+1) & 1)); break; case DAP_LED_TARGET_RUNNING: - DEBUG("DAP_LED: RUNNING %02X\n", (*(request+1) & 1)); + DEBUGF("DAP_LED: RUNNING %02X\n", (*(request+1) & 1)); LED_RUNNING_OUT((*(request+1) & 1)); break; default: @@ -251,7 +251,7 @@ static uint32_t DAP_ResetTarget(uint8_t *response) { *(response + 1) = RESET_TARGET(); *(response + 0) = DAP_OK; - DEBUG("DAP_RESET: %02X\n", *(response + 1)); + DEBUGF("DAP_RESET: %02X\n", *(response + 1)); return (2); } @@ -274,7 +274,7 @@ static uint32_t DAP_SWJ_Pins(uint8_t *request, uint8_t *response) (*(request + 4) << 16) | (*(request + 5) << 24); - DEBUG("DAP_SWJ_Pins: %04X %04X %04X", select, value, wait); + DEBUGF("DAP_SWJ_Pins: %04X %04X %04X", select, value, wait); if (select & (1 << DAP_SWJ_SWCLK_TCK)) { @@ -350,7 +350,7 @@ static uint32_t DAP_SWJ_Pins(uint8_t *request, uint8_t *response) (PIN_nTRST_IN() << DAP_SWJ_nTRST) | (PIN_nRESET_IN() << DAP_SWJ_nRESET); - DEBUG(" %02X\n", (uint8_t)value); + DEBUGF(" %02X\n", (uint8_t)value); *response = (uint8_t)value; return (1); } @@ -372,7 +372,7 @@ static uint32_t DAP_SWJ_Clock(uint8_t *request, uint8_t *response) (*(request+2) << 16) | (*(request+3) << 24); - DEBUG("DAP_SWJ_Clock: %u\n", clock); + DEBUGF("DAP_SWJ_Clock: %u\n", clock); if (clock == 0) { @@ -403,7 +403,7 @@ static uint32_t DAP_SWJ_Clock(uint8_t *request, uint8_t *response) DAP_Data.clock_delay = delay; int success = ftdi_set_baudrate (&__ftdic, clock/2); if( success < 0){ - DEBUG("Could not set baudrate: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not set baudrate: %s\n",ftdi_get_error_string(&__ftdic)); } } @@ -426,7 +426,7 @@ static uint32_t DAP_SWJ_Sequence(uint8_t *request, uint8_t *response) count = *request++; if (count == 0) count = 256; - DEBUG("DAP_SWJ_Sequence: %u\n", count); + DEBUGF("DAP_SWJ_Sequence: %u\n", count); SWJ_Sequence(count, request); @@ -449,7 +449,7 @@ static uint32_t DAP_SWD_Configure(uint8_t *request, uint8_t *response) DAP_Data.swd_conf.turnaround = (value & 0x03) + 1; DAP_Data.swd_conf.data_phase = (value & 0x04) ? 1 : 0; - DEBUG("DAP_SWD_Configure: %d %d\n", + DEBUGF("DAP_SWD_Configure: %d %d\n", DAP_Data.swd_conf.turnaround, DAP_Data.swd_conf.data_phase ); @@ -484,7 +484,7 @@ static uint32_t DAP_SWD_Abort(uint8_t *request, uint8_t *response) (*(request+3) << 16) | (*(request+4) << 24); - DEBUG("%04X\n", data); + DEBUGF("%04X\n", data); // Write Abort register SWD_Transfer(DP_ABORT, &data); *response = DAP_OK; @@ -604,7 +604,7 @@ err: DEBUG("ERROR\n"); *(response+3) = (uint8_t)(data >> 16); *(response+4) = (uint8_t)(data >> 24); - DEBUG("%04X\n", data); + DEBUGF("%04X\n", data); return (1+4); } @@ -645,7 +645,7 @@ err: DEBUG("ERROR\n"); JTAG_WriteAbort(data); *response = DAP_OK; - DEBUG("%04X\n", data); + DEBUGF("%04X\n", data); return (1); } @@ -661,7 +661,7 @@ static uint32_t DAP_TransferConfigure(uint8_t *request, uint8_t *response) DAP_Data.transfer.idle_cycles = *(request+0); DAP_Data.transfer.retry_count = *(request+1) | (*(request+2) << 8); DAP_Data.transfer.match_retry = *(request+3) | (*(request+4) << 8); - DEBUG("DAP_TransferConfigure: %d %d %d\n", + DEBUGF("DAP_TransferConfigure: %d %d %d\n", DAP_Data.transfer.idle_cycles, DAP_Data.transfer.retry_count, DAP_Data.transfer.match_retry @@ -703,7 +703,7 @@ static uint32_t DAP_SWD_Transfer(uint8_t *request, uint8_t *response) request++; // Ignore DAP index request_count = *request++; - DEBUG("DAP_SWD_Transfer: %d\n", request_count); + DEBUGF("DAP_SWD_Transfer: %d\n", request_count); while (request_count--) { @@ -1320,7 +1320,7 @@ end: #if 0 __weak uint32_t DAP_ProcessVendorCommand(uint8_t *request, uint8_t *response) { - DEBUG("DAP_ProcessVendorCommand:\n"); + DEBUGF("DAP_ProcessVendorCommand:\n"); *response = ID_DAP_Invalid; return (1); } diff --git a/src/DAP.h b/src/DAP.h index 509a2e3..744a135 100644 --- a/src/DAP.h +++ b/src/DAP.h @@ -205,6 +205,7 @@ extern void DAP_Setup (void); // Configurable delay for clock generation #define DELAY_SLOW_CYCLES 1 // Number of cycles for one iteration static __forceinline void PIN_DELAY_SLOW (uint32_t delay) { + (void)delay; //Delayus(delay); //printf("delay %d\n",delay); FTDI_SUBMIT(); diff --git a/src/DAP_config.h b/src/DAP_config.h index d6152ef..e108a76 100644 --- a/src/DAP_config.h +++ b/src/DAP_config.h @@ -176,11 +176,11 @@ static __inline void FTDI_BITBANG_SETUP() { /* Enable bitbang mode */ success = ftdi_set_bitmode(&__ftdic, dir_state, BITMODE_SYNCBB ); if( success<0 ){ - DEBUG("Could not change to async. bitbang: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not change to async. bitbang: %s\n",ftdi_get_error_string(&__ftdic)); } success = ftdi_write_data(&__ftdic,&out_state,1); if( success < 0){ - DEBUG("Could not write pins: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not write pins: %s\n",ftdi_get_error_string(&__ftdic)); } /*ftdi_read_data_set_chunksize(&__ftdic,1); ftdi_write_data_set_chunksize(&__ftdic,1);*/ @@ -190,7 +190,7 @@ static __inline void FTDI_BITBANG_SETUP() { static __forceinline void FTDI_WRITE_OUT_READ_MODE( ) { int success = ftdi_write_data(&__ftdic,out_state_buff,out_state_buff_pos); if( success<0 ){ - DEBUG("Could not write pins: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not write pins: %s\n",ftdi_get_error_string(&__ftdic)); exit(1); } } @@ -198,7 +198,7 @@ static __forceinline void FTDI_WRITE_OUT_READ_MODE( ) { static __forceinline void FTDI_WRITE_OUT( ) { int success; if( out_state_buff_pos==0 ){ - DEBUG("buffer is empty %d \n",out_state_buff_pos); + DEBUGF("buffer is empty %d \n",out_state_buff_pos); return; } FTDI_WRITE_OUT_READ_MODE( ); @@ -209,7 +209,7 @@ static __forceinline void FTDI_WRITE_OUT( ) { while(out_state_buff_pos!=0) { success = ftdi_read_data(&__ftdic,in_buff,out_state_buff_pos); if( success < 0 ) { - DEBUG("Could not read pins: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not read pins: %s\n",ftdi_get_error_string(&__ftdic)); exit(1); } out_state_buff_pos -= success; @@ -234,11 +234,11 @@ static __inline void FTDI_BEGIN_READ(){ int success = ftdi_set_bitmode(&__ftdic, dir_state, BITMODE_SYNCBB ); if( success<0 ){ - DEBUG("Could not change to sync. bitbang: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not change to sync. bitbang: %s\n",ftdi_get_error_string(&__ftdic)); } success = ftdi_usb_purge_rx_buffer(&__ftdic); if( success<0 ){ - DEBUG("Could not flush buffer: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Could not flush buffer: %s\n",ftdi_get_error_string(&__ftdic)); } //memset ( pin_read_buff, 0, BUFFER_SIZE*sizeof(int) ); @@ -255,13 +255,13 @@ static __inline void FTDI_END_READ(){ while( remaining ){ success = ftdi_read_data(&__ftdic,ptr,remaining); if( success<0 ){ - DEBUG("Error while read: %s\n",ftdi_get_error_string(&__ftdic)); + DEBUGF("Error while read: %s\n",ftdi_get_error_string(&__ftdic)); exit(1); } ptr+=success; remaining-=success; } - DEBUG("Read %d/%d bytes\n",(int)(ptr-in_buff),out_state_buff_pos); + DEBUGF("Read %d/%d bytes\n",(int)(ptr-in_buff),out_state_buff_pos); out_state_buff_pos = 0; for(i=0;i