diff --git a/jtag/src/jim/intel_28f800b3.c b/jtag/src/jim/intel_28f800b3.c index e7d8c5ce..207e2cfd 100644 --- a/jtag/src/jim/intel_28f800b3.c +++ b/jtag/src/jim/intel_28f800b3.c @@ -109,8 +109,8 @@ uint32_t intel_28fxxxb3_capture(jim_bus_device_t *d, data = is->status_buffer; break; case READ_ID: - if(address == 0) data = is->identifier; - else if(address == 1) data = 0x0089; + if(address == 1) data = is->identifier; + else if(address == 0) data = 0x0089; break; case READ_ARRAY: data = shmem[(address<<1)]<<8; diff --git a/jtag/src/jim/some_cpu.c b/jtag/src/jim/some_cpu.c index ab807f5a..512c3dc9 100644 --- a/jtag/src/jim/some_cpu.c +++ b/jtag/src/jim/some_cpu.c @@ -59,8 +59,6 @@ void some_cpu_tck_rise(jim_device_t *dev, { int i; - // jim_print_tap_state(dev); - switch(dev->tap_state) { case RESET: @@ -86,7 +84,7 @@ void some_cpu_tck_rise(jim_device_t *dev, jim_bus_device_t *b = tp->part; /* Address decoder */ - if(tp->offset < a) + if(tp->offset <= a) { uint32_t as = (a - (tp->offset)) >> tp->adr_shift; if(as < b->size) @@ -98,8 +96,6 @@ void some_cpu_tck_rise(jim_device_t *dev, /* Store data into data "input" cells in BSR */ dev->sreg[2].reg[2] = d; - jim_print_tap_state(dev); - }; break; @@ -169,7 +165,7 @@ void some_cpu_tck_fall(jim_device_t *dev, jim_bus_device_t *b = tp->part; /* Address decoder */ - if(tp->offset < a) + if(tp->offset <= a) { uint32_t as = (a - (tp->offset)) >> tp->adr_shift; if(as < b->size) diff --git a/jtag/src/jim/tap.c b/jtag/src/jim/tap.c index 2c621910..236abe5d 100644 --- a/jtag/src/jim/tap.c +++ b/jtag/src/jim/tap.c @@ -30,6 +30,8 @@ #include +#undef VERBOSE + const tap_state_t next_tap_state[16][2] = { /* RESET */ { IDLE, RESET }, @@ -56,9 +58,9 @@ void jim_print_sreg(shift_reg_t *r) for(i=(r->len+31)/32; i>=0; i--) printf(" %08X", r->reg[i]); } -void jim_print_tap_state(jim_device_t *dev) +void jim_print_tap_state(char *rof, jim_device_t *dev) { - printf(" tck rise, state="); + printf(" tck %s, state=", rof); switch(dev->tap_state & 7) { case 0: printf((dev->tap_state==RESET) ? "RESET":"IDLE" ); break; @@ -110,6 +112,7 @@ void jim_tck_rise(jim_state_t *s, int tms, int tdi) { jim_device_t *dev; + for(dev = s->last_device_in_chain; dev; dev = dev->prev) { int dev_tdi; @@ -117,6 +120,10 @@ void jim_tck_rise(jim_state_t *s, int tms, int tdi) shift_reg_t *sr; uint32_t *reg; +#ifdef VERBOSE + jim_print_tap_state("rise", dev); +#endif + dev_tdi = (dev->prev != NULL) ? dev->prev->tdo : tdi; if(dev->tck_rise != NULL) dev->tck_rise(dev, tms, dev_tdi, s->shmem, s->shmem_size); @@ -182,6 +189,10 @@ void jim_tck_fall(jim_state_t *s) { dev->tdo = dev->tdo_buffer; +#ifdef VERBOSE + jim_print_tap_state("fall", dev); +#endif + if(dev->tck_fall != NULL) dev->tck_fall(dev, s->shmem, s->shmem_size); } }