target/adi: clarify TARGETSEL mask and offset

This commit is contained in:
Rafael Silva 2022-08-05 21:27:52 +01:00 committed by Rachel Mant
parent 20d4109c56
commit 81890b1fe9
2 changed files with 11 additions and 1 deletions

View File

@ -68,6 +68,14 @@
#define ADIV5_DP_TARGETID_TDESIGNER_OFFSET 1U #define ADIV5_DP_TARGETID_TDESIGNER_OFFSET 1U
#define ADIV5_DP_TARGETID_TDESIGNER_MASK (0x7ffU << ADIV5_DP_TARGETID_TDESIGNER_OFFSET) #define ADIV5_DP_TARGETID_TDESIGNER_MASK (0x7ffU << ADIV5_DP_TARGETID_TDESIGNER_OFFSET)
/* DP TARGETSEL */
#define ADIV5_DP_TARGETSEL_TINSTANCE_OFFSET 28U
#define ADIV5_DP_TARGETSEL_TINSTANCE_MASK (0xfU << ADIV5_DP_TARGETSEL_TINSTANCE_OFFSET)
#define ADIV5_DP_TARGETSEL_TPARTNO_OFFSET 12U
#define ADIV5_DP_TARGETSEL_TPARTNO_MASK (0xffffU << ADIV5_DP_TARGETSEL_TPARTNO_OFFSET)
#define ADIV5_DP_TARGETSEL_TDESIGNER_OFFSET 1U
#define ADIV5_DP_TARGETSEL_TDESIGNER_MASK (0x7ffU << ADIV5_DP_TARGETSEL_TDESIGNER_OFFSET)
/* DP DPIDR/TARGETID/IDCODE DESIGNER */ /* DP DPIDR/TARGETID/IDCODE DESIGNER */
/* Bits 10:7 - JEP-106 Continuation code */ /* Bits 10:7 - JEP-106 Continuation code */
/* Bits 6:0 - JEP-106 Identity code */ /* Bits 6:0 - JEP-106 Identity code */

View File

@ -159,7 +159,9 @@ int adiv5_swdp_scan(uint32_t targetid)
for (volatile size_t i = 0; i < nr_dps; i++) { for (volatile size_t i = 0; i < nr_dps; i++) {
if (scan_multidrop) { if (scan_multidrop) {
dp_line_reset(initial_dp); dp_line_reset(initial_dp);
dp_targetid = (i << 28U) | (initial_dp->target_id & 0x0fffffffU); dp_targetid =
(i << ADIV5_DP_TARGETSEL_TINSTANCE_OFFSET) |
(initial_dp->target_id & (ADIV5_DP_TARGETSEL_TPARTNO_MASK | ADIV5_DP_TARGETSEL_TDESIGNER_MASK | 1U));
initial_dp->dp_low_write(initial_dp, ADIV5_DP_TARGETSEL, dp_targetid); initial_dp->dp_low_write(initial_dp, ADIV5_DP_TARGETSEL, dp_targetid);
TRY_CATCH (e, EXCEPTION_ALL) { TRY_CATCH (e, EXCEPTION_ALL) {
dp_debug_port_id = initial_dp->dp_read(initial_dp, ADIV5_DP_DPIDR); dp_debug_port_id = initial_dp->dp_read(initial_dp, ADIV5_DP_DPIDR);