|
|
|
@ -130,19 +130,19 @@ typedef struct
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
register_set_bit (tap_register * tr, unsigned int bitno, unsigned int val)
|
|
|
|
|
register_set_bit (tap_register *tr, unsigned int bitno, unsigned int val)
|
|
|
|
|
{
|
|
|
|
|
tr->data[bitno] = (val) ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
register_get_bit (tap_register * tr, unsigned int bitno)
|
|
|
|
|
register_get_bit (tap_register *tr, unsigned int bitno)
|
|
|
|
|
{
|
|
|
|
|
return (tr->data[bitno] & 1) ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
shift_instr (bus_t * bus, unsigned int bit)
|
|
|
|
|
shift_instr (bus_t *bus, unsigned int bit)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->out;
|
|
|
|
|
|
|
|
|
@ -159,7 +159,7 @@ shift_instr (bus_t * bus, unsigned int bit)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
shift_data (bus_t * bus, unsigned int bit)
|
|
|
|
|
shift_data (bus_t *bus, unsigned int bit)
|
|
|
|
|
{
|
|
|
|
|
data_register *dr = PART->active_instruction->data_register;
|
|
|
|
|
|
|
|
|
@ -178,13 +178,13 @@ shift_data (bus_t * bus, unsigned int bit)
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
mwa_scan_in_instr (bus_t * bus)
|
|
|
|
|
mwa_scan_in_instr (bus_t *bus)
|
|
|
|
|
{
|
|
|
|
|
shift_instr (bus, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
mwa_scan_in_addr (bus_t * bus, unsigned int slave, uint32_t addr, int mode)
|
|
|
|
|
mwa_scan_in_addr (bus_t *bus, unsigned int slave, uint32_t addr, int mode)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->data_register->in;
|
|
|
|
|
int i;
|
|
|
|
@ -209,7 +209,7 @@ mwa_scan_in_addr (bus_t * bus, unsigned int slave, uint32_t addr, int mode)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
mwa_scan_in_data (bus_t * bus, uint32_t data)
|
|
|
|
|
mwa_scan_in_data (bus_t *bus, uint32_t data)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->data_register->in;
|
|
|
|
|
int i;
|
|
|
|
@ -227,7 +227,7 @@ mwa_scan_in_data (bus_t * bus, uint32_t data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
mwa_scan_out_data (bus_t * bus, uint32_t * pdata)
|
|
|
|
|
mwa_scan_out_data (bus_t *bus, uint32_t *pdata)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->data_register->out;
|
|
|
|
|
uint32_t data;
|
|
|
|
@ -245,8 +245,7 @@ mwa_scan_out_data (bus_t * bus, uint32_t * pdata)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
mwa_read_word (bus_t * bus, unsigned int slave, uint32_t addr,
|
|
|
|
|
uint32_t * data)
|
|
|
|
|
mwa_read_word (bus_t *bus, unsigned int slave, uint32_t addr, uint32_t *data)
|
|
|
|
|
{
|
|
|
|
|
mwa_scan_in_instr (bus);
|
|
|
|
|
mwa_scan_in_addr (bus, slave, addr, ACCESS_MODE_READ);
|
|
|
|
@ -254,7 +253,7 @@ mwa_read_word (bus_t * bus, unsigned int slave, uint32_t addr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
mwa_write_word (bus_t * bus, unsigned int slave, uint32_t addr, uint32_t data)
|
|
|
|
|
mwa_write_word (bus_t *bus, unsigned int slave, uint32_t addr, uint32_t data)
|
|
|
|
|
{
|
|
|
|
|
mwa_scan_in_instr (bus);
|
|
|
|
|
mwa_scan_in_addr (bus, slave, addr, ACCESS_MODE_WRITE);
|
|
|
|
@ -264,19 +263,19 @@ mwa_write_word (bus_t * bus, unsigned int slave, uint32_t addr, uint32_t data)
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nexus_access_start (bus_t * bus)
|
|
|
|
|
nexus_access_start (bus_t *bus)
|
|
|
|
|
{
|
|
|
|
|
shift_instr (bus, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nexus_access_end (bus_t * bus)
|
|
|
|
|
nexus_access_end (bus_t *bus)
|
|
|
|
|
{
|
|
|
|
|
tap_reset_bypass (CHAIN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nexus_access_set_addr (bus_t * bus, uint32_t addr, int mode)
|
|
|
|
|
nexus_access_set_addr (bus_t *bus, uint32_t addr, int mode)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->data_register->in;
|
|
|
|
|
int i;
|
|
|
|
@ -298,7 +297,7 @@ nexus_access_set_addr (bus_t * bus, uint32_t addr, int mode)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nexus_access_read_data (bus_t * bus, uint32_t * pdata)
|
|
|
|
|
nexus_access_read_data (bus_t *bus, uint32_t *pdata)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->data_register->out;
|
|
|
|
|
uint32_t data;
|
|
|
|
@ -316,7 +315,7 @@ nexus_access_read_data (bus_t * bus, uint32_t * pdata)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nexus_access_write_data (bus_t * bus, uint32_t data)
|
|
|
|
|
nexus_access_write_data (bus_t *bus, uint32_t data)
|
|
|
|
|
{
|
|
|
|
|
tap_register *r = PART->active_instruction->data_register->in;
|
|
|
|
|
int i;
|
|
|
|
@ -333,14 +332,14 @@ nexus_access_write_data (bus_t * bus, uint32_t data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
nexus_reg_read (bus_t * bus, uint32_t reg, uint32_t * data)
|
|
|
|
|
nexus_reg_read (bus_t *bus, uint32_t reg, uint32_t *data)
|
|
|
|
|
{
|
|
|
|
|
nexus_access_set_addr (bus, reg, ACCESS_MODE_READ);
|
|
|
|
|
nexus_access_read_data (bus, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
nexus_reg_write (bus_t * bus, uint32_t reg, uint32_t data)
|
|
|
|
|
nexus_reg_write (bus_t *bus, uint32_t reg, uint32_t data)
|
|
|
|
|
{
|
|
|
|
|
nexus_access_set_addr (bus, reg, ACCESS_MODE_WRITE);
|
|
|
|
|
nexus_access_write_data (bus, data);
|
|
|
|
@ -349,14 +348,14 @@ nexus_reg_write (bus_t * bus, uint32_t reg, uint32_t data)
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nexus_memacc_set_addr (bus_t * bus, uint32_t addr, uint32_t rwcs)
|
|
|
|
|
nexus_memacc_set_addr (bus_t *bus, uint32_t addr, uint32_t rwcs)
|
|
|
|
|
{
|
|
|
|
|
nexus_reg_write (bus, OCD_REG_RWA, addr);
|
|
|
|
|
nexus_reg_write (bus, OCD_REG_RWCS, rwcs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
nexus_memacc_read (bus_t * bus, uint32_t * data)
|
|
|
|
|
nexus_memacc_read (bus_t *bus, uint32_t *data)
|
|
|
|
|
{
|
|
|
|
|
uint32_t status;
|
|
|
|
|
int ret;
|
|
|
|
@ -388,7 +387,7 @@ nexus_memacc_read (bus_t * bus, uint32_t * data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
nexus_memacc_write (bus_t * bus, uint32_t addr, uint32_t data, uint32_t rwcs)
|
|
|
|
|
nexus_memacc_write (bus_t *bus, uint32_t addr, uint32_t data, uint32_t rwcs)
|
|
|
|
|
{
|
|
|
|
|
uint32_t status;
|
|
|
|
|
int ret;
|
|
|
|
@ -415,8 +414,7 @@ nexus_memacc_write (bus_t * bus, uint32_t addr, uint32_t data, uint32_t rwcs)
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
avr32_bus_setup (bus_t * bus, chain_t * chain, part_t * part,
|
|
|
|
|
unsigned int mode)
|
|
|
|
|
avr32_bus_setup (bus_t *bus, chain_t *chain, part_t *part, unsigned int mode)
|
|
|
|
|
{
|
|
|
|
|
CHAIN = chain;
|
|
|
|
|
PART = part;
|
|
|
|
@ -460,7 +458,7 @@ avr32_bus_setup (bus_t * bus, chain_t * chain, part_t * part,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
check_instruction (part_t * part, const char *instr)
|
|
|
|
|
check_instruction (part_t *part, const char *instr)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
@ -476,8 +474,7 @@ check_instruction (part_t * part, const char *instr)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static bus_t *
|
|
|
|
|
avr32_bus_new (chain_t * chain, const bus_driver_t * driver,
|
|
|
|
|
char *cmd_params[])
|
|
|
|
|
avr32_bus_new (chain_t *chain, const bus_driver_t *driver, char *cmd_params[])
|
|
|
|
|
{
|
|
|
|
|
bus_t *bus;
|
|
|
|
|
part_t *part;
|
|
|
|
@ -561,7 +558,7 @@ avr32_bus_new (chain_t * chain, const bus_driver_t * driver,
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
avr32_bus_printinfo (bus_t * bus)
|
|
|
|
|
avr32_bus_printinfo (bus_t *bus)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
@ -577,7 +574,7 @@ avr32_bus_printinfo (bus_t * bus)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
avr32_bus_prepare (bus_t * bus)
|
|
|
|
|
avr32_bus_prepare (bus_t *bus)
|
|
|
|
|
{
|
|
|
|
|
if (!INITIALIZED)
|
|
|
|
|
bus_init (bus);
|
|
|
|
@ -588,7 +585,7 @@ avr32_bus_prepare (bus_t * bus)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static int
|
|
|
|
|
avr32_bus_area (bus_t * bus, uint32_t addr, bus_area_t * area)
|
|
|
|
|
avr32_bus_area (bus_t *bus, uint32_t addr, bus_area_t *area)
|
|
|
|
|
{
|
|
|
|
|
switch (MODE)
|
|
|
|
|
{
|
|
|
|
@ -647,7 +644,7 @@ avr32_bus_area (bus_t * bus, uint32_t addr, bus_area_t * area)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
avr32_bus_read_start (bus_t * bus, uint32_t addr)
|
|
|
|
|
avr32_bus_read_start (bus_t *bus, uint32_t addr)
|
|
|
|
|
{
|
|
|
|
|
addr &= ADDR_MASK;
|
|
|
|
|
|
|
|
|
@ -678,7 +675,7 @@ avr32_bus_read_start (bus_t * bus, uint32_t addr)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static uint32_t
|
|
|
|
|
avr32_bus_read_end (bus_t * bus)
|
|
|
|
|
avr32_bus_read_end (bus_t *bus)
|
|
|
|
|
{
|
|
|
|
|
uint32_t data;
|
|
|
|
|
|
|
|
|
@ -705,7 +702,7 @@ avr32_bus_read_end (bus_t * bus)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static uint32_t
|
|
|
|
|
avr32_bus_read_next (bus_t * bus, uint32_t addr)
|
|
|
|
|
avr32_bus_read_next (bus_t *bus, uint32_t addr)
|
|
|
|
|
{
|
|
|
|
|
uint32_t data;
|
|
|
|
|
|
|
|
|
@ -735,7 +732,7 @@ avr32_bus_read_next (bus_t * bus, uint32_t addr)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
avr32_bus_write (bus_t * bus, uint32_t addr, uint32_t data)
|
|
|
|
|
avr32_bus_write (bus_t *bus, uint32_t addr, uint32_t data)
|
|
|
|
|
{
|
|
|
|
|
addr &= ADDR_MASK;
|
|
|
|
|
|
|
|
|
|