static uint32_t DAP_SWJ_Pins(uint8_t *request, uint8_t *response) { uint32_t value; uint32_t select; uint32_t wait; value = *(request+0); select = *(request+1); wait = (*(request+2) << 0) | (*(request+3) << 8) | (*(request+4) << 16) | (*(request+5) << 24); if (select & (1 << DAP_SWJ_SWCLK_TCK)) { if (value & (1 << DAP_SWJ_SWCLK_TCK)) { PIN_SWCLK_TCK_SET(); } else { PIN_SWCLK_TCK_CLR(); } } if (select & (1 << DAP_SWJ_SWDIO_TMS)) { if (value & (1 << DAP_SWJ_SWDIO_TMS)) { PIN_SWDIO_TMS_SET(); } else { PIN_SWDIO_TMS_CLR(); } } if (select & (1 << DAP_SWJ_TDI)) { PIN_TDI_OUT(value >> DAP_SWJ_TDI); }
void swd_set_target_reset(uint8_t asserted) { if (asserted) { swd_init_debug(); //Set POWER->RESET on NRF to 1 if(!swd_write_ap(AP_TAR, 0x40000000 + 0x544)) { return; } if(!swd_write_ap(AP_DRW, 1)){ return; } //Hold RESET and SWCLK low for a minimum of 100us PIN_SWCLK_TCK_CLR(); PIN_SWDIO_TMS_CLR(); //os_dly_wait(1); } else { PIN_SWCLK_TCK_SET(); PIN_SWDIO_TMS_SET(); } }