Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start seperating swd multi drop #1184

Merged
merged 4 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/target/adiv5.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ static void adiv5_dp_clear_sticky_errors(adiv5_debug_port_s *dp)
}

/* Keep the TRY_CATCH funkiness contained to avoid clobbering and reduce the need for volatiles */
static uint32_t adiv5_dp_read_dpidr(adiv5_debug_port_s *const dp)
uint32_t adiv5_dp_read_dpidr(adiv5_debug_port_s *const dp)
{
volatile uint32_t dpidr = 0;
volatile exception_s e;
Expand Down
23 changes: 23 additions & 0 deletions src/target/adiv5.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@
#define ADIV5_DP_RDBUFF ADIV5_DP_REG(0xcU)
#define ADIV5_DP_TARGETSEL ADIV5_DP_REG(0xcU)

/* ADIv5 SWD/JTAG Select Sequence */
#define ADIV5_SWD_TO_JTAG_SELECT_SEQUENCE 0xe73cU /* 16 bits, LSB (MSB: 0x3ce7) */
#define ADIV5_JTAG_TO_SWD_SELECT_SEQUENCE 0xe79eU /* 16 bits, LSB (MSB: 0x79e7) */

/*
* ADIv5 Selection Alert sequence
* This sequence is sent MSB first and can be represented as either:
* - 0x49cf9046 a9b4a161 97f5bbc7 45703d98 transmitted MSB first
* - 0x19bc0ea2 e3ddafe9 86852d95 6209f392 transmitted LSB first
*/
#define ADIV5_SELECTION_ALERT_SEQUENCE_0 0x6209f392U /* 32 bits, LSB */
#define ADIV5_SELECTION_ALERT_SEQUENCE_1 0x86852d95U /* 32 bits, LSB */
#define ADIV5_SELECTION_ALERT_SEQUENCE_2 0xe3ddafe9U /* 32 bits, LSB */
#define ADIV5_SELECTION_ALERT_SEQUENCE_3 0x19bc0ea2U /* 32 bits, LSB */

/* ADIv5 Dormant state activation codes */
#define ADIV5_ACTIVATION_CODE_ARM_SWD_DP 0x1aU /* 8bits, LSB (MSB: 0x58) */
#define ADIV5_ACTIVATION_CODE_ARM_JTAG_DP 0x0aU /* 8bits, LSB (MSB: 0x50) */

/* DP DPIDR */
#define ADIV5_DP_DPIDR_REVISION_OFFSET 28U
#define ADIV5_DP_DPIDR_REVISION_MASK (0xfU << ADIV5_DP_DPIDR_VERSION_OFFSET)
Expand Down Expand Up @@ -379,4 +398,8 @@ uint32_t firmware_swdp_error(adiv5_debug_port_s *dp, bool protocol_recovery);
void firmware_swdp_abort(adiv5_debug_port_s *dp, uint32_t abort);
void adiv5_jtagdp_abort(adiv5_debug_port_s *dp, uint32_t abort);

void adiv5_swd_multidrop_scan(adiv5_debug_port_s *dp, uint32_t targetid);

uint32_t adiv5_dp_read_dpidr(adiv5_debug_port_s *dp);

#endif /* TARGET_ADIV5_H */
Loading