added t/nsrst_assert_width commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@2768 b42882b7-edfa-0310-969c-e2dbd0fdcd60__archive__
parent
e3a0647558
commit
c5949a03a7
|
@ -93,6 +93,8 @@ static int jtag_verify = 1;
|
|||
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
|
||||
static int jtag_nsrst_delay = 0; /* default to no nSRST delay */
|
||||
static int jtag_ntrst_delay = 0; /* default to no nTRST delay */
|
||||
static int jtag_nsrst_assert_width = 0; /* width of assertion */
|
||||
static int jtag_ntrst_assert_width = 0; /* width of assertion */
|
||||
|
||||
typedef struct jtag_event_callback_s
|
||||
{
|
||||
|
@ -661,7 +663,11 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
|
|||
if (jtag_srst != new_srst) {
|
||||
jtag_srst = new_srst;
|
||||
if (jtag_srst)
|
||||
{
|
||||
LOG_DEBUG("SRST line asserted");
|
||||
if (jtag_nsrst_assert_width)
|
||||
jtag_add_sleep(jtag_nsrst_assert_width * 1000);
|
||||
}
|
||||
else {
|
||||
LOG_DEBUG("SRST line released");
|
||||
if (jtag_nsrst_delay)
|
||||
|
@ -685,6 +691,8 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
|
|||
if (jtag_trst) {
|
||||
LOG_DEBUG("TRST line asserted");
|
||||
tap_set_state(TAP_RESET);
|
||||
if (jtag_ntrst_assert_width)
|
||||
jtag_add_sleep(jtag_ntrst_assert_width * 1000);
|
||||
} else {
|
||||
LOG_DEBUG("TRST line released");
|
||||
if (jtag_ntrst_delay)
|
||||
|
@ -1480,3 +1488,21 @@ unsigned jtag_get_ntrst_delay(void)
|
|||
{
|
||||
return jtag_ntrst_delay;
|
||||
}
|
||||
|
||||
|
||||
void jtag_set_nsrst_assert_width(unsigned delay)
|
||||
{
|
||||
jtag_nsrst_assert_width = delay;
|
||||
}
|
||||
unsigned jtag_get_nsrst_assert_width(void)
|
||||
{
|
||||
return jtag_nsrst_assert_width;
|
||||
}
|
||||
void jtag_set_ntrst_assert_width(unsigned delay)
|
||||
{
|
||||
jtag_ntrst_assert_width = delay;
|
||||
}
|
||||
unsigned jtag_get_ntrst_assert_width(void)
|
||||
{
|
||||
return jtag_ntrst_assert_width;
|
||||
}
|
||||
|
|
|
@ -289,6 +289,12 @@ unsigned jtag_get_nsrst_delay(void);
|
|||
void jtag_set_ntrst_delay(unsigned delay);
|
||||
unsigned jtag_get_ntrst_delay(void);
|
||||
|
||||
void jtag_set_nsrst_assert_width(unsigned delay);
|
||||
unsigned jtag_get_nsrst_assert_width(void);
|
||||
|
||||
void jtag_set_ntrst_assert_width(unsigned delay);
|
||||
unsigned jtag_get_ntrst_assert_width(void);
|
||||
|
||||
/// @returns The current state of TRST.
|
||||
int jtag_get_trst(void);
|
||||
/// @returns The current state of SRST.
|
||||
|
|
|
@ -61,6 +61,8 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
|
|||
static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
|
||||
static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
|
||||
|
@ -619,6 +621,10 @@ int jtag_register_commands(struct command_context_s *cmd_ctx)
|
|||
COMMAND_ANY, "jtag_nsrst_delay <ms> - delay after deasserting srst in ms");
|
||||
register_command(cmd_ctx, NULL, "jtag_ntrst_delay", handle_jtag_ntrst_delay_command,
|
||||
COMMAND_ANY, "jtag_ntrst_delay <ms> - delay after deasserting trst in ms");
|
||||
register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width", handle_jtag_nsrst_assert_width_command,
|
||||
COMMAND_ANY, "jtag_nsrst_assert_width <ms> - delay after asserting srst in ms");
|
||||
register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width", handle_jtag_ntrst_assert_width_command,
|
||||
COMMAND_ANY, "jtag_ntrst_assert_width <ms> - delay after asserting trst in ms");
|
||||
|
||||
register_command(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command,
|
||||
COMMAND_EXEC, "print current scan chain configuration");
|
||||
|
@ -979,6 +985,40 @@ static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx,
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx,
|
||||
char *cmd, char **args, int argc)
|
||||
{
|
||||
if (argc > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
if (argc == 1)
|
||||
{
|
||||
unsigned delay;
|
||||
int retval = parse_uint(args[0], &delay);
|
||||
if (ERROR_OK != retval)
|
||||
return retval;
|
||||
jtag_set_nsrst_assert_width(delay);
|
||||
}
|
||||
command_print(cmd_ctx, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx,
|
||||
char *cmd, char **args, int argc)
|
||||
{
|
||||
if (argc > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
if (argc == 1)
|
||||
{
|
||||
unsigned delay;
|
||||
int retval = parse_uint(args[0], &delay);
|
||||
if (ERROR_OK != retval)
|
||||
return retval;
|
||||
jtag_set_ntrst_assert_width(delay);
|
||||
}
|
||||
command_print(cmd_ctx, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
||||
{
|
||||
int retval = ERROR_OK;
|
||||
|
|
Loading…
Reference in New Issue