adiv5: Implement access to DP ABORT register.

This commit is contained in:
Gareth McMullin 2016-04-19 22:02:26 -07:00
parent 68bf825042
commit bed6627579
3 changed files with 22 additions and 0 deletions

View File

@ -44,6 +44,7 @@ static uint32_t adiv5_jtagdp_error(ADIv5_DP_t *dp);
static uint32_t adiv5_jtagdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
uint16_t addr, uint32_t value);
static void adiv5_jtagdp_abort(ADIv5_DP_t *dp, uint32_t abort);
void adiv5_jtag_dp_handler(jtag_dev_t *dev)
{
@ -55,6 +56,7 @@ void adiv5_jtag_dp_handler(jtag_dev_t *dev)
dp->dp_read = adiv5_jtagdp_read;
dp->error = adiv5_jtagdp_error;
dp->low_access = adiv5_jtagdp_low_access;
dp->abort = adiv5_jtagdp_abort;
adiv5_dp_init(dp);
}
@ -100,3 +102,10 @@ static uint32_t adiv5_jtagdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
return (uint32_t)(response >> 3);
}
static void adiv5_jtagdp_abort(ADIv5_DP_t *dp, uint32_t abort)
{
uint64_t request = (uint64_t)abort << 3;
jtag_dev_write_ir(dp->dev, IR_ABORT);
jtag_dev_shift_dr(dp->dev, NULL, (const uint8_t*)&request, 35);
}

View File

@ -41,6 +41,7 @@ static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp);
static uint32_t adiv5_swdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
uint16_t addr, uint32_t value);
static void adiv5_swdp_abort(ADIv5_DP_t *dp, uint32_t abort);
int adiv5_swdp_scan(void)
{
@ -65,6 +66,7 @@ int adiv5_swdp_scan(void)
dp->dp_read = adiv5_swdp_read;
dp->error = adiv5_swdp_error;
dp->low_access = adiv5_swdp_low_access;
dp->abort = adiv5_swdp_abort;
adiv5_swdp_error(dp);
adiv5_dp_init(dp);
@ -158,3 +160,8 @@ static uint32_t adiv5_swdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
return response;
}
static void adiv5_swdp_abort(ADIv5_DP_t *dp, uint32_t abort)
{
adiv5_dp_write(dp, ADIV5_DP_ABORT, abort);
}

View File

@ -110,6 +110,7 @@ typedef struct ADIv5_DP_s {
uint32_t (*error)(struct ADIv5_DP_s *dp);
uint32_t (*low_access)(struct ADIv5_DP_s *dp, uint8_t RnW,
uint16_t addr, uint32_t value);
void (*abort)(struct ADIv5_DP_s *dp, uint32_t abort);
union {
jtag_dev_t *dev;
@ -133,6 +134,11 @@ static inline uint32_t adiv5_dp_low_access(struct ADIv5_DP_s *dp, uint8_t RnW,
return dp->low_access(dp, RnW, addr, value);
}
static inline void adiv5_dp_abort(struct ADIv5_DP_s *dp, uint32_t abort)
{
return dp->abort(dp, abort);
}
typedef struct ADIv5_AP_s {
int refcnt;