summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/swd_core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/transport/swd_core.c b/src/transport/swd_core.c
index cc9109d6..c18c111a 100644
--- a/src/transport/swd_core.c
+++ b/src/transport/swd_core.c
@@ -61,12 +61,13 @@ int oocd_swd_queue_idcode_read(struct adiv5_dap *dap, uint8_t *ack, uint32_t *da
}
int oocd_swd_queue_dp_read(struct adiv5_dap *dap, unsigned reg, uint32_t *data){
- int retval;
- retval=swd_dp_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_EXECUTE, reg, (int**) &data);
+ int retval, *rdata;
+ retval=swd_dp_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_EXECUTE, reg, &rdata);
if (retval<0){
LOG_ERROR("swd_dp_read() error: %s ", swd_error_string(retval));
return ERROR_FAIL;
}
+ if (data!=NULL) *data=(uint32_t)*rdata;
return ERROR_OK;
}
@@ -81,12 +82,13 @@ int oocd_swd_queue_dp_write(struct adiv5_dap *dap, unsigned reg, uint32_t data){
}
int oocd_swd_queue_ap_read(struct adiv5_dap *dap, unsigned reg, uint32_t *data){
- int retval;
- retval=swd_ap_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_EXECUTE, (char) reg, (int**) &data);
+ int retval, *rdata;
+ retval=swd_ap_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_EXECUTE, (char) reg, &rdata);
if (retval<0){
LOG_ERROR("swd_ap_read() error: %s ", swd_error_string(retval));
return ERROR_FAIL;
}
+ if (data!=NULL) *data=*rdata;
return ERROR_OK;
}