Wait some clocks at Run-Test/Idle for Blackfin.

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1769 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Jie Zhang 15 years ago
parent 8937485ef8
commit dd77752ee7

@ -1,3 +1,19 @@
2010-02-08 Jie Zhang <jie.zhang@analog.com>
* include/urjtag/part.h (struct URJ_PART_PARAMS): Add wait_ready.
* include/urjtag/bfin.h (bfin_wait_clocks): Declare.
* include/urjtag/chain.h (urj_tap_chain_wait_ready): Declare.
* src/tap/chain.c (urj_tap_chain_wait_ready): New.
* src/tap/tap.c (urj_tap_defer_shift_register): Call
urj_tap_chain_wait_ready if Run-Test/Idle.
* src/bfin/bfin.c (bfin_wait_clocks): Define.
(part_emudat_defer_get): Call chain_wait_ready when Run-Test/Idle.
(part_emudat_get): Likewise.
* src/bfin/bfin-part-bfin.c: Include <sysdep.h>, <urjtag/chain.h>,
<urjtag/cable.h> and <urjtag/log.h>.
(bfin_wait_ready): New.
(bfin_part_init): Init wait_ready.
2010-02-06 Jie Zhang <jie.zhang@analog.com>
* include/urjtag/cable.h (enum action): Add URJ_TAP_CABLE_CLOCK_COMPACT.

@ -212,6 +212,7 @@ enum {
};
extern int bfin_check_emuready;
extern int bfin_wait_clocks;
/* From src/bfin/bfin.c */

@ -81,7 +81,8 @@ int urj_tap_chain_get_pod_signal (urj_chain_t *chain, urj_pod_sigsel_t sig);
*
* @return NULL on error, and sets urj_error.
*/
urj_part_t *urj_tap_chain_active_part(urj_chain_t *chain);
urj_part_t *urj_tap_chain_active_part (urj_chain_t *chain);
void urj_tap_chain_wait_ready (urj_chain_t *chain);
typedef struct
{

@ -34,6 +34,7 @@
struct URJ_PART_PARAMS
{
void (*free) (void *);
void (*wait_ready) (void *);
void *data;
};

@ -17,16 +17,20 @@
*/
#include <sysdep.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <urjtag/part.h>
#include <urjtag/chain.h>
#include <urjtag/cable.h>
#include <urjtag/data_register.h>
#include <urjtag/part_instruction.h>
#include <urjtag/tap_register.h>
#include <urjtag/bfin.h>
#include <urjtag/log.h>
/* The helper functions for Blackfin DBGCTL and DBGSTAT operations. */
@ -113,6 +117,48 @@ struct emu_oab bfin_emu_oab =
0x0001, /* DBGSTAT_EMUDOF */
};
static void
bfin_wait_ready (void *data)
{
urj_chain_t *chain = (urj_chain_t *) data;
/* When CCLK is 62MHz and SCLK is 31MHz, which is the lowest frequency I
can set in bf537 stamp linux kernel, set the gnICE+ cable frequency to
15MHz (current default), --wait-clocks >= 12 is required.
When CCLK is 62MHz and SCLK is 31MHz, set the gnICE+ cable frequency to
30MHz, --wait-clocks >= 21 is required.
When CCLK is 62MHz and SCLK is 31MHz, set the gnICE+ cable frequency to
6MHz (default), --wait-clocks >= 5 is required.
When CCLK is 62MHz and SCLK is 31MHz, set the gnICE cable frequency to
6MHz (default), --wait-clocks >= 2 is required. */
if (bfin_wait_clocks == -1)
{
urj_cable_t *cable = chain->cable;
uint32_t frequency = cable->frequency;
const char *name = cable->driver->name;
if (strcmp (name, "gnICE+") == 0 && frequency == 15000000)
bfin_wait_clocks = 12;
else if (strcmp (name, "gnICE+") == 0 && frequency == 30000000)
bfin_wait_clocks = 21;
else if (strcmp (name, "gnICE+") == 0 && frequency == 6000000)
bfin_wait_clocks = 5;
else if (strcmp (name, "gnICE") == 0 && frequency == 6000000)
bfin_wait_clocks = 2;
else
{
bfin_wait_clocks = 21;
urj_warning (_("untested cable or frequency, set wait_clocks to %d\n"), bfin_wait_clocks);
}
}
urj_tap_chain_defer_clock (chain, 0, 0, bfin_wait_clocks);
}
static void
bfin_part_init (urj_part_t *part)
{
@ -121,6 +167,7 @@ bfin_part_init (urj_part_t *part)
assert (part && part->params);
part->params->free = free;
part->params->wait_ready = bfin_wait_ready;
part->params->data = malloc (sizeof (struct bfin_part_data));
EMU_OAB (part) = &bfin_emu_oab;

@ -47,6 +47,7 @@ const char *scans[] = {
int bfin_check_emuready = 1;
int bfin_wait_clocks = -1;
static struct timespec bfin_emu_wait_ts = {0, 5000000};
@ -1062,6 +1063,7 @@ part_emudat_defer_get (urj_chain_t *chain, int n, int exit)
{
assert (urj_tap_state (chain) & URJ_TAP_STATE_IDLE);
urj_tap_chain_defer_clock (chain, 0, 0, 1);
urj_tap_chain_wait_ready (chain);
}
if (part_scan_select (chain, n, EMUDAT_SCAN) < 0)
@ -1146,6 +1148,7 @@ part_emudat_get (urj_chain_t *chain, int n, int exit)
{
assert (urj_tap_state (chain) & URJ_TAP_STATE_IDLE);
urj_tap_chain_defer_clock (chain, 0, 0, 1);
urj_tap_chain_wait_ready (chain);
}
if (part_scan_select (chain, n, EMUDAT_SCAN) < 0)

@ -331,3 +331,17 @@ urj_tap_chain_active_part (urj_chain_t *chain)
return chain->parts->parts[chain->active_part];
}
void
urj_tap_chain_wait_ready (urj_chain_t *chain)
{
urj_part_t *part;
if (!chain || !chain->parts)
return;
part = chain->parts->parts[chain->main_part];
if (part->params && part->params->wait_ready)
part->params->wait_ready (chain);
}

@ -105,6 +105,7 @@ urj_tap_defer_shift_register (urj_chain_t *chain,
{
urj_tap_chain_defer_clock (chain, 1, 0, 1); /* Update-DR or Update-IR */
urj_tap_chain_defer_clock (chain, 0, 0, 1); /* Run-Test/Idle */
urj_tap_chain_wait_ready (chain);
}
else if (tap_exit == URJ_CHAIN_EXITMODE_UPDATE)
urj_tap_chain_defer_clock (chain, 1, 0, 1); /* Update-DR or Update-IR */

Loading…
Cancel
Save