hosted: Provide the DP functions in swd_proc.
This commit is contained in:
parent
fa561c8d66
commit
5abb288c7a
|
@ -20,11 +20,20 @@
|
|||
|
||||
#ifndef __SWDPTAP_H
|
||||
#define __SWDPTAP_H
|
||||
#include "adiv5.h"
|
||||
|
||||
typedef struct swd_proc_s {
|
||||
uint32_t (*swdptap_seq_in)(int ticks);
|
||||
bool (*swdptap_seq_in_parity)(uint32_t *data, int ticks);
|
||||
void (*swdptap_seq_out)(uint32_t MS, int ticks);
|
||||
void (*swdptap_seq_out_parity)(uint32_t MS, int ticks);
|
||||
# if PC_HOSTED == 1
|
||||
uint32_t (*swdp_read)(ADIv5_DP_t *dp, uint16_t addr);
|
||||
uint32_t (*swdp_error)(ADIv5_DP_t *dp);
|
||||
uint32_t (*swdp_low_access)(ADIv5_DP_t *dp, uint8_t RnW,
|
||||
uint16_t addr, uint32_t value);
|
||||
void (*swdp_abort)(ADIv5_DP_t *dp, uint32_t abort);
|
||||
#endif
|
||||
} swd_proc_t;
|
||||
extern swd_proc_t swd_proc;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/*
|
||||
* This file is part of the Black Magic Debug project.
|
||||
*
|
||||
* Copyright (C) 2018 Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
|
||||
* Written by Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
* Copyright(C) 2018 - 2021 Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -212,7 +211,10 @@ int libftdi_swdptap_init(swd_proc_t *swd_proc)
|
|||
swd_proc->swdptap_seq_in_parity = swdptap_seq_in_parity;
|
||||
swd_proc->swdptap_seq_out = swdptap_seq_out;
|
||||
swd_proc->swdptap_seq_out_parity = swdptap_seq_out_parity;
|
||||
|
||||
swd_proc->swdp_read = firmware_swdp_read;
|
||||
swd_proc->swdp_error = firmware_swdp_error;
|
||||
swd_proc->swdp_low_access = firmware_swdp_low_access;
|
||||
swd_proc->swdp_abort = firmware_swdp_abort;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Written by Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
* Modified by Dave Marples <dave@marples.net>
|
||||
* Modification (C) 2020 Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
|
||||
* Modified 2020 - 2021 by Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -54,7 +54,10 @@ int remote_swdptap_init(swd_proc_t *swd_proc)
|
|||
swd_proc->swdptap_seq_in_parity = swdptap_seq_in_parity;
|
||||
swd_proc->swdptap_seq_out = swdptap_seq_out;
|
||||
swd_proc->swdptap_seq_out_parity = swdptap_seq_out_parity;
|
||||
|
||||
swd_proc->swdp_read = firmware_swdp_read;
|
||||
swd_proc->swdp_error = firmware_swdp_error;
|
||||
swd_proc->swdp_low_access = firmware_swdp_low_access;
|
||||
swd_proc->swdp_abort = firmware_swdp_abort;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,12 +173,19 @@ int adiv5_swdp_scan(uint32_t targetid)
|
|||
}
|
||||
dp->idcode = idcode;
|
||||
dp->targetid = dp_targetid;
|
||||
#if HOSTED == 0
|
||||
dp->dp_read = firmware_swdp_read;
|
||||
dp->error = firmware_swdp_error;
|
||||
dp->low_access = firmware_swdp_low_access;
|
||||
dp->abort = firmware_swdp_abort;
|
||||
|
||||
firmware_swdp_error(dp);
|
||||
#else
|
||||
dp->dp_read = swd_proc->swdp_read;
|
||||
dp->error = swd_proc->swdp_error;
|
||||
dp->low_access = swd_proc->swdp_low_access;
|
||||
dp->abort = swd_proc->swdp_abort;
|
||||
swd_proc->swdp_error();
|
||||
#endif
|
||||
adiv5_dp_init(dp);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue