- jlink jlink_execute_queue returns result
- added jlink_get_version_info function - reformatted spaces to tabs git-svn-id: svn://svn.berlios.de/openocd/trunk@676 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
209112000b
commit
f1e317e534
|
@ -60,8 +60,8 @@ static u8 usb_out_buffer[JLINK_OUT_BUFFER_SIZE];
|
|||
|
||||
/* Constants for JLink command */
|
||||
|
||||
/* The JLINK_TAP_SEQUENCE_COMMAND is obsolete *
|
||||
/* and we should use EMU_CMD_HW_JTAG instead */
|
||||
/* The JLINK_TAP_SEQUENCE_COMMAND is obsolete
|
||||
* and we should use EMU_CMD_HW_JTAG instead */
|
||||
#define JLINK_TAP_SEQUENCE_COMMAND 0xcd
|
||||
|
||||
#define EMU_CMD_VERSION 0x01
|
||||
|
@ -116,6 +116,9 @@ int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_length);
|
|||
int jlink_usb_write(jlink_jtag_t *jlink_jtag, int out_length);
|
||||
int jlink_usb_read(jlink_jtag_t *jlink_jtag);
|
||||
|
||||
/* helper functions */
|
||||
int jlink_get_version_info(void);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
void jlink_debug_buffer(u8 *buffer, int length);
|
||||
#endif
|
||||
|
@ -230,9 +233,8 @@ int jlink_execute_queue(void)
|
|||
}
|
||||
cmd = cmd->next;
|
||||
}
|
||||
jlink_tap_execute();
|
||||
|
||||
return ERROR_OK;
|
||||
return jlink_tap_execute();
|
||||
}
|
||||
|
||||
/* Sets speed in kHz. */
|
||||
|
@ -240,7 +242,6 @@ int jlink_speed(int speed)
|
|||
{
|
||||
int result;
|
||||
|
||||
// if ((speed == -1) || ((1 <= speed) && (speed <= JLINK_MAX_SPEED)))
|
||||
if (speed <= JLINK_MAX_SPEED)
|
||||
{
|
||||
/* check for RTCK setting */
|
||||
|
@ -287,8 +288,6 @@ int jlink_register_commands(struct command_context_s *cmd_ctx)
|
|||
|
||||
int jlink_init(void)
|
||||
{
|
||||
int result;
|
||||
int len;
|
||||
int check_cnt;
|
||||
|
||||
jlink_jtag_handle = jlink_usb_open();
|
||||
|
@ -302,29 +301,12 @@ int jlink_init(void)
|
|||
check_cnt = 0;
|
||||
while (check_cnt < 3)
|
||||
{
|
||||
/* query hardware version */
|
||||
jlink_simple_command(EMU_CMD_VERSION);
|
||||
result = jlink_usb_read(jlink_jtag_handle);
|
||||
|
||||
if (result == 2)
|
||||
if (jlink_get_version_info() == ERROR_OK)
|
||||
{
|
||||
/* Get length */
|
||||
len = buf_get_u32(usb_in_buffer, 0, 16);
|
||||
|
||||
/* Get version */
|
||||
result = jlink_usb_read(jlink_jtag_handle);
|
||||
|
||||
if(result == len)
|
||||
{
|
||||
usb_in_buffer[result] = 0;
|
||||
LOG_INFO(usb_in_buffer);
|
||||
|
||||
/* attempt to get status */
|
||||
jlink_get_status();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
check_cnt++;
|
||||
}
|
||||
|
@ -528,7 +510,7 @@ int jlink_get_status(void)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
||||
int jlink_get_version_info(void)
|
||||
{
|
||||
int result;
|
||||
int len = 0;
|
||||
|
@ -546,15 +528,21 @@ int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd
|
|||
{
|
||||
usb_in_buffer[result] = 0;
|
||||
LOG_INFO(usb_in_buffer);
|
||||
return ERROR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", result);
|
||||
return ERROR_JTAG_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
||||
{
|
||||
if (jlink_get_version_info() == ERROR_OK)
|
||||
{
|
||||
/* attempt to get status */
|
||||
jlink_get_status();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", result);
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue