Remove abstraction of adiv5_dp_write. Both implementations were identical.
This commit is contained in:
parent
2bf54f9a72
commit
c3f798438a
|
@ -70,6 +70,11 @@ void adiv5_ap_unref(ADIv5_AP_t *ap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void adiv5_dp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value)
|
||||||
|
{
|
||||||
|
dp->low_access(dp, ADIV5_LOW_WRITE, addr, value);
|
||||||
|
}
|
||||||
|
|
||||||
void adiv5_dp_init(ADIv5_DP_t *dp)
|
void adiv5_dp_init(ADIv5_DP_t *dp)
|
||||||
{
|
{
|
||||||
uint32_t ctrlstat;
|
uint32_t ctrlstat;
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#define IR_DPACC 0xA
|
#define IR_DPACC 0xA
|
||||||
#define IR_APACC 0xB
|
#define IR_APACC 0xB
|
||||||
|
|
||||||
static void adiv5_jtagdp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value);
|
|
||||||
static uint32_t adiv5_jtagdp_read(ADIv5_DP_t *dp, uint16_t addr);
|
static uint32_t adiv5_jtagdp_read(ADIv5_DP_t *dp, uint16_t addr);
|
||||||
|
|
||||||
static uint32_t adiv5_jtagdp_error(ADIv5_DP_t *dp);
|
static uint32_t adiv5_jtagdp_error(ADIv5_DP_t *dp);
|
||||||
|
@ -52,7 +51,6 @@ void adiv5_jtag_dp_handler(jtag_dev_t *dev)
|
||||||
dp->dev = dev;
|
dp->dev = dev;
|
||||||
dp->idcode = dev->idcode;
|
dp->idcode = dev->idcode;
|
||||||
|
|
||||||
dp->dp_write = adiv5_jtagdp_write;
|
|
||||||
dp->dp_read = adiv5_jtagdp_read;
|
dp->dp_read = adiv5_jtagdp_read;
|
||||||
dp->error = adiv5_jtagdp_error;
|
dp->error = adiv5_jtagdp_error;
|
||||||
dp->low_access = adiv5_jtagdp_low_access;
|
dp->low_access = adiv5_jtagdp_low_access;
|
||||||
|
@ -60,11 +58,6 @@ void adiv5_jtag_dp_handler(jtag_dev_t *dev)
|
||||||
adiv5_dp_init(dp);
|
adiv5_dp_init(dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adiv5_jtagdp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value)
|
|
||||||
{
|
|
||||||
adiv5_jtagdp_low_access(dp, ADIV5_LOW_WRITE, addr, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t adiv5_jtagdp_read(ADIv5_DP_t *dp, uint16_t addr)
|
static uint32_t adiv5_jtagdp_read(ADIv5_DP_t *dp, uint16_t addr)
|
||||||
{
|
{
|
||||||
adiv5_jtagdp_low_access(dp, ADIV5_LOW_READ, addr, 0);
|
adiv5_jtagdp_low_access(dp, ADIV5_LOW_READ, addr, 0);
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define SWDP_ACK_WAIT 0x02
|
#define SWDP_ACK_WAIT 0x02
|
||||||
#define SWDP_ACK_FAULT 0x04
|
#define SWDP_ACK_FAULT 0x04
|
||||||
|
|
||||||
static void adiv5_swdp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value);
|
|
||||||
static uint32_t adiv5_swdp_read(ADIv5_DP_t *dp, uint16_t addr);
|
static uint32_t adiv5_swdp_read(ADIv5_DP_t *dp, uint16_t addr);
|
||||||
|
|
||||||
static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp);
|
static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp);
|
||||||
|
@ -64,7 +63,6 @@ int adiv5_swdp_scan(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dp->dp_write = adiv5_swdp_write;
|
|
||||||
dp->dp_read = adiv5_swdp_read;
|
dp->dp_read = adiv5_swdp_read;
|
||||||
dp->error = adiv5_swdp_error;
|
dp->error = adiv5_swdp_error;
|
||||||
dp->low_access = adiv5_swdp_low_access;
|
dp->low_access = adiv5_swdp_low_access;
|
||||||
|
@ -78,11 +76,6 @@ int adiv5_swdp_scan(void)
|
||||||
return target_list?1:0;
|
return target_list?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adiv5_swdp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value)
|
|
||||||
{
|
|
||||||
adiv5_swdp_low_access(dp, ADIV5_LOW_WRITE, addr, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t adiv5_swdp_read(ADIv5_DP_t *dp, uint16_t addr)
|
static uint32_t adiv5_swdp_read(ADIv5_DP_t *dp, uint16_t addr)
|
||||||
{
|
{
|
||||||
if (addr & ADIV5_APnDP) {
|
if (addr & ADIV5_APnDP) {
|
||||||
|
@ -111,7 +104,7 @@ static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp)
|
||||||
if(err & ADIV5_DP_CTRLSTAT_WDATAERR)
|
if(err & ADIV5_DP_CTRLSTAT_WDATAERR)
|
||||||
clr |= ADIV5_DP_ABORT_WDERRCLR;
|
clr |= ADIV5_DP_ABORT_WDERRCLR;
|
||||||
|
|
||||||
adiv5_swdp_write(dp, ADIV5_DP_ABORT, clr);
|
adiv5_dp_write(dp, ADIV5_DP_ABORT, clr);
|
||||||
dp->fault = 0;
|
dp->fault = 0;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -109,7 +109,6 @@ typedef struct ADIv5_DP_s {
|
||||||
|
|
||||||
bool allow_timeout;
|
bool allow_timeout;
|
||||||
|
|
||||||
void (*dp_write)(struct ADIv5_DP_s *dp, uint16_t addr, uint32_t value);
|
|
||||||
uint32_t (*dp_read)(struct ADIv5_DP_s *dp, uint16_t addr);
|
uint32_t (*dp_read)(struct ADIv5_DP_s *dp, uint16_t addr);
|
||||||
|
|
||||||
uint32_t (*error)(struct ADIv5_DP_s *dp);
|
uint32_t (*error)(struct ADIv5_DP_s *dp);
|
||||||
|
@ -123,11 +122,6 @@ typedef struct ADIv5_DP_s {
|
||||||
};
|
};
|
||||||
} ADIv5_DP_t;
|
} ADIv5_DP_t;
|
||||||
|
|
||||||
static inline void adiv5_dp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value)
|
|
||||||
{
|
|
||||||
dp->dp_write(dp, addr, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t adiv5_dp_read(ADIv5_DP_t *dp, uint16_t addr)
|
static inline uint32_t adiv5_dp_read(ADIv5_DP_t *dp, uint16_t addr)
|
||||||
{
|
{
|
||||||
return dp->dp_read(dp, addr);
|
return dp->dp_read(dp, addr);
|
||||||
|
@ -160,6 +154,7 @@ typedef struct ADIv5_AP_s {
|
||||||
} ADIv5_AP_t;
|
} ADIv5_AP_t;
|
||||||
|
|
||||||
void adiv5_dp_init(ADIv5_DP_t *dp);
|
void adiv5_dp_init(ADIv5_DP_t *dp);
|
||||||
|
void adiv5_dp_write(ADIv5_DP_t *dp, uint16_t addr, uint32_t value);
|
||||||
|
|
||||||
void adiv5_dp_ref(ADIv5_DP_t *dp);
|
void adiv5_dp_ref(ADIv5_DP_t *dp);
|
||||||
void adiv5_ap_ref(ADIv5_AP_t *ap);
|
void adiv5_ap_ref(ADIv5_AP_t *ap);
|
||||||
|
|
Loading…
Reference in New Issue