target/arm_adi_v5,arm_dap: introduce multidrop_targetsel and its configuration

Add multidrop_targetsel to struct adiv5_dap.
Add option -dp-id and -instance-id to dap create command.
Add convenience function dap_is_multidrop()

Change-Id: Ibb93abb5f50b3665c320a10c1497421035762134
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6140
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Tomas Vanek
2021-04-06 13:59:14 +02:00
committed by Antonio Borneo
parent bb78fa10c7
commit b973a76d86
3 changed files with 79 additions and 1 deletions

View File

@@ -97,6 +97,11 @@
#define DP_APSEL_MAX (255)
#define DP_APSEL_INVALID (-1)
#define DP_TARGETSEL_INVALID 0xFFFFFFFFU
#define DP_TARGETSEL_DPID_MASK 0x0FFFFFFFU
#define DP_TARGETSEL_INSTANCEID_MASK 0xF0000000U
#define DP_TARGETSEL_INSTANCEID_SHIFT 28
/* MEM-AP register addresses */
#define MEM_AP_REG_CSW 0x00
@@ -324,6 +329,13 @@ struct adiv5_dap {
/** Flag saying whether to ignore the syspwrupack flag in DAP. Some devices
* do not set this bit until later in the bringup sequence */
bool ignore_syspwrupack;
/** Value to select DP in SWD multidrop mode or DP_TARGETSEL_INVALID */
uint32_t multidrop_targetsel;
/** TPARTNO and TDESIGNER fields of multidrop_targetsel have been configured */
bool multidrop_dp_id_valid;
/** TINSTANCE field of multidrop_targetsel has been configured */
bool multidrop_instance_id_valid;
};
/**
@@ -610,6 +622,12 @@ static inline struct adiv5_ap *dap_ap(struct adiv5_dap *dap, uint8_t ap_num)
return &dap->ap[ap_num];
}
/** Check if SWD multidrop configuration is valid */
static inline bool dap_is_multidrop(struct adiv5_dap *dap)
{
return dap->multidrop_dp_id_valid && dap->multidrop_instance_id_valid;
}
/* Lookup CoreSight component */
int dap_lookup_cs_component(struct adiv5_ap *ap,
target_addr_t dbgbase, uint8_t type, target_addr_t *addr, int32_t *idx);