David Brownell <david-b@pacbell.net>:
Remove pernicious whitespace from src/jtag/*c files; mostly the end-of-line flavor for now, although there's more. git-svn-id: svn://svn.berlios.de/openocd/trunk@2036 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
99fbbdc9c4
commit
4123f08263
|
@ -1,4 +1,4 @@
|
|||
// vim:ts=4 sw=4:
|
||||
// vim:ts=4 sw=4:
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 by Dimitar Dimitrov <dinuxbg@gmail.com> *
|
||||
|
@ -222,14 +222,14 @@ static int armjtagew_speed(int speed)
|
|||
usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
|
||||
result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4);
|
||||
speed_real = (int)buf_get_u32(usb_in_buffer,0,32);
|
||||
if(result < 0)
|
||||
if(result < 0)
|
||||
{
|
||||
LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result);
|
||||
return ERROR_JTAG_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real);
|
||||
LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real);
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
|
@ -334,7 +334,7 @@ static void armjtagew_path_move(int num_states, tap_state_t *path)
|
|||
for (i = 0; i < num_states; i++)
|
||||
{
|
||||
/*
|
||||
* TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
|
||||
* TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
|
||||
* Either handle that here, or update the documentation with examples
|
||||
* how to fix that in the configuration files.
|
||||
*/
|
||||
|
@ -504,7 +504,7 @@ static int armjtagew_get_version_info(void)
|
|||
usb_out_buffer[0] = CMD_GET_VERSION;
|
||||
result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4+15+256);
|
||||
|
||||
if (result != 0)
|
||||
if (result != 0)
|
||||
{
|
||||
LOG_ERROR("ARM-JTAG-EW command CMD_GET_VERSION failed (%d)\n", result);
|
||||
return ERROR_JTAG_DEVICE_ERROR;
|
||||
|
@ -791,7 +791,7 @@ static int armjtagew_usb_message(armjtagew_jtag_t *armjtagew_jtag, int out_lengt
|
|||
if (result == out_length)
|
||||
{
|
||||
result = armjtagew_usb_read(armjtagew_jtag, in_length);
|
||||
if (result != in_length)
|
||||
if (result != in_length)
|
||||
{
|
||||
LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result);
|
||||
return -1;
|
||||
|
|
|
@ -79,7 +79,7 @@ static void bitbang_state_move(int skip)
|
|||
int i=0, tms=0;
|
||||
u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
|
||||
int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
|
||||
|
||||
|
||||
for (i = skip; i < tms_count; i++)
|
||||
{
|
||||
tms = (tms_scan >> i) & 1;
|
||||
|
|
|
@ -53,13 +53,13 @@ static int ep93xx_quit(void);
|
|||
|
||||
struct timespec ep93xx_zzzz;
|
||||
|
||||
jtag_interface_t ep93xx_interface =
|
||||
jtag_interface_t ep93xx_interface =
|
||||
{
|
||||
.name = "ep93xx",
|
||||
|
||||
.execute_queue = bitbang_execute_queue,
|
||||
|
||||
.speed = ep93xx_speed,
|
||||
.speed = ep93xx_speed,
|
||||
.register_commands = ep93xx_register_commands,
|
||||
.init = ep93xx_init,
|
||||
.quit = ep93xx_quit,
|
||||
|
@ -84,12 +84,12 @@ static void ep93xx_write(int tck, int tms, int tdi)
|
|||
output_value |= TCK_BIT;
|
||||
else
|
||||
output_value &= ~TCK_BIT;
|
||||
|
||||
|
||||
if (tms)
|
||||
output_value |= TMS_BIT;
|
||||
else
|
||||
output_value &= ~TMS_BIT;
|
||||
|
||||
|
||||
if (tdi)
|
||||
output_value |= TDI_BIT;
|
||||
else
|
||||
|
@ -111,7 +111,7 @@ static void ep93xx_reset(int trst, int srst)
|
|||
output_value |= SRST_BIT;
|
||||
else if (srst == 1)
|
||||
output_value &= ~SRST_BIT;
|
||||
|
||||
|
||||
*gpio_data_register = output_value;
|
||||
nanosleep(&ep93xx_zzzz, NULL);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ static int ep93xx_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
bitbang_interface = &ep93xx_bitbang;
|
||||
bitbang_interface = &ep93xx_bitbang;
|
||||
|
||||
ep93xx_zzzz.tv_sec = 0;
|
||||
ep93xx_zzzz.tv_nsec = 10000000;
|
||||
|
@ -203,7 +203,7 @@ static int ep93xx_init(void)
|
|||
gpio_data_direction_register = gpio_controller + 0x18;
|
||||
|
||||
LOG_INFO("gpio_data_register = %p\n", gpio_data_register);
|
||||
LOG_INFO("gpio_data_direction_reg = %p\n", gpio_data_direction_register);
|
||||
LOG_INFO("gpio_data_direction_reg = %p\n", gpio_data_direction_register);
|
||||
/*
|
||||
* Configure bit 0 (TDO) as an input, and bits 1-5 (TDI, TCK
|
||||
* TMS, TRST, SRST) as outputs. Drive TDI and TCK low, and
|
||||
|
|
|
@ -59,24 +59,24 @@ static u8 usb_out_buffer[JLINK_OUT_BUFFER_SIZE];
|
|||
static u8 usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE];
|
||||
|
||||
/* Constants for JLink command */
|
||||
#define EMU_CMD_VERSION 0x01
|
||||
#define EMU_CMD_SET_SPEED 0x05
|
||||
#define EMU_CMD_GET_STATE 0x07
|
||||
#define EMU_CMD_VERSION 0x01
|
||||
#define EMU_CMD_SET_SPEED 0x05
|
||||
#define EMU_CMD_GET_STATE 0x07
|
||||
#define EMU_CMD_HW_CLOCK 0xc8
|
||||
#define EMU_CMD_HW_TMS0 0xc9
|
||||
#define EMU_CMD_HW_TMS1 0xca
|
||||
#define EMU_CMD_HW_JTAG2 0xce
|
||||
#define EMU_CMD_HW_JTAG3 0xcf
|
||||
#define EMU_CMD_HW_TMS0 0xc9
|
||||
#define EMU_CMD_HW_TMS1 0xca
|
||||
#define EMU_CMD_HW_JTAG2 0xce
|
||||
#define EMU_CMD_HW_JTAG3 0xcf
|
||||
#define EMU_CMD_GET_MAX_MEM_BLOCK 0xd4
|
||||
#define EMU_CMD_HW_RESET0 0xdc
|
||||
#define EMU_CMD_HW_RESET1 0xdd
|
||||
#define EMU_CMD_HW_TRST0 0xde
|
||||
#define EMU_CMD_HW_TRST1 0xdf
|
||||
#define EMU_CMD_GET_CAPS 0xe8
|
||||
#define EMU_CMD_GET_HW_VERSION 0xf0
|
||||
#define EMU_CMD_HW_RESET0 0xdc
|
||||
#define EMU_CMD_HW_RESET1 0xdd
|
||||
#define EMU_CMD_HW_TRST0 0xde
|
||||
#define EMU_CMD_HW_TRST1 0xdf
|
||||
#define EMU_CMD_GET_CAPS 0xe8
|
||||
#define EMU_CMD_GET_HW_VERSION 0xf0
|
||||
|
||||
/* bits return from EMU_CMD_GET_CAPS */
|
||||
#define EMU_CAP_GET_HW_VERSION 1
|
||||
#define EMU_CAP_GET_HW_VERSION 1
|
||||
#define EMU_CAP_GET_MAX_BLOCK_SIZE 11
|
||||
|
||||
/* max speed 12MHz v5.0 jlink */
|
||||
|
@ -294,7 +294,7 @@ static int jlink_khz(int khz, int *jtag_speed)
|
|||
static int jlink_register_commands(struct command_context_s *cmd_ctx)
|
||||
{
|
||||
|
||||
register_command(cmd_ctx, NULL, "jlink_info",
|
||||
register_command(cmd_ctx, NULL, "jlink_info",
|
||||
&jlink_handle_jlink_info_command, COMMAND_EXEC,
|
||||
"query jlink info");
|
||||
register_command(cmd_ctx, NULL, "jlink_hw_jtag",
|
||||
|
@ -307,7 +307,7 @@ static int jlink_init(void)
|
|||
{
|
||||
int check_cnt;
|
||||
int i;
|
||||
|
||||
|
||||
jlink_jtag_handle = jlink_usb_open();
|
||||
|
||||
if (jlink_jtag_handle == 0)
|
||||
|
@ -343,12 +343,12 @@ static int jlink_init(void)
|
|||
jlink_speed(jtag_speed);
|
||||
|
||||
/* v5/6 jlink seems to have an issue if the first tap move
|
||||
* is not divisible by 8, so we send a TLR on first power up */
|
||||
* is not divisible by 8, so we send a TLR on first power up */
|
||||
for (i = 0; i < 8; i++) {
|
||||
jlink_tap_append_step(1, 0);
|
||||
}
|
||||
jlink_tap_execute();
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,7 @@ static int jlink_get_version_info(void)
|
|||
LOG_ERROR("J-Link command EMU_CMD_VERSION impossible return length 0x%0x", len);
|
||||
len = JLINK_IN_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
|
||||
result = jlink_usb_read(jlink_jtag_handle, len);
|
||||
if (result != len)
|
||||
{
|
||||
|
|
|
@ -2658,7 +2658,7 @@ int jtag_add_statemove(tap_state_t goal_state)
|
|||
jtag_add_pathmove(tms_count, moves);
|
||||
}
|
||||
|
||||
/* else state must be immediately reachable in one clock cycle, and does not
|
||||
/* else state must be immediately reachable in one clock cycle, and does not
|
||||
need to be a stable state.
|
||||
*/
|
||||
else if( tap_state_transition(cur_state, true) == goal_state
|
||||
|
|
|
@ -75,8 +75,8 @@ typedef struct cable_s
|
|||
u8 LED_MASK; /* data port bit for LED */
|
||||
} cable_t;
|
||||
|
||||
static cable_t cables[] =
|
||||
{
|
||||
static cable_t cables[] =
|
||||
{
|
||||
/* name tdo trst tms tck tdi srst o_inv i_inv init exit led */
|
||||
{ "wiggler", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 },
|
||||
{ "wiggler2", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x00, 0x20 },
|
||||
|
@ -135,13 +135,13 @@ static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx
|
|||
static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
|
||||
jtag_interface_t parport_interface =
|
||||
jtag_interface_t parport_interface =
|
||||
{
|
||||
.name = "parport",
|
||||
|
||||
|
||||
.execute_queue = bitbang_execute_queue,
|
||||
|
||||
.speed = parport_speed,
|
||||
.speed = parport_speed,
|
||||
.register_commands = parport_register_commands,
|
||||
.init = parport_init,
|
||||
.quit = parport_quit,
|
||||
|
@ -158,7 +158,7 @@ static bitbang_interface_t parport_bitbang =
|
|||
static int parport_read(void)
|
||||
{
|
||||
int data = 0;
|
||||
|
||||
|
||||
#if PARPORT_USE_PPDEV == 1
|
||||
ioctl(device_handle, PPRSTATUS, & data);
|
||||
#else
|
||||
|
@ -190,22 +190,22 @@ static __inline__ void parport_write_data(void)
|
|||
static void parport_write(int tck, int tms, int tdi)
|
||||
{
|
||||
int i = jtag_speed + 1;
|
||||
|
||||
|
||||
if (tck)
|
||||
dataport_value |= cable->TCK_MASK;
|
||||
else
|
||||
dataport_value &= ~cable->TCK_MASK;
|
||||
|
||||
|
||||
if (tms)
|
||||
dataport_value |= cable->TMS_MASK;
|
||||
else
|
||||
dataport_value &= ~cable->TMS_MASK;
|
||||
|
||||
|
||||
if (tdi)
|
||||
dataport_value |= cable->TDI_MASK;
|
||||
else
|
||||
dataport_value &= ~cable->TDI_MASK;
|
||||
|
||||
|
||||
while (i-- > 0)
|
||||
parport_write_data();
|
||||
}
|
||||
|
@ -224,10 +224,10 @@ static void parport_reset(int trst, int srst)
|
|||
dataport_value |= cable->SRST_MASK;
|
||||
else if (srst == 1)
|
||||
dataport_value &= ~cable->SRST_MASK;
|
||||
|
||||
|
||||
parport_write_data();
|
||||
}
|
||||
|
||||
|
||||
/* turn LED on parport adapter on (1) or off (0) */
|
||||
static void parport_led(int on)
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ static int parport_get_giveio_access(void)
|
|||
{
|
||||
HANDLE h;
|
||||
OSVERSIONINFO version;
|
||||
|
||||
|
||||
version.dwOSVersionInfoSize = sizeof version;
|
||||
if (!GetVersionEx( &version )) {
|
||||
errno = EINVAL;
|
||||
|
@ -269,15 +269,15 @@ static int parport_get_giveio_access(void)
|
|||
}
|
||||
if (version.dwPlatformId != VER_PLATFORM_WIN32_NT)
|
||||
return 0;
|
||||
|
||||
|
||||
h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
errno = ENODEV;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
CloseHandle( h );
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -289,15 +289,15 @@ static int parport_init(void)
|
|||
char buffer[256];
|
||||
int i = 0;
|
||||
#endif
|
||||
|
||||
|
||||
cur_cable = cables;
|
||||
|
||||
|
||||
if ((parport_cable == NULL) || (parport_cable[0] == 0))
|
||||
{
|
||||
parport_cable = "wiggler";
|
||||
LOG_WARNING("No parport cable specified, using default 'wiggler'");
|
||||
}
|
||||
|
||||
|
||||
while (cur_cable->name)
|
||||
{
|
||||
if (strcmp(cur_cable->name, parport_cable) == 0)
|
||||
|
@ -313,9 +313,9 @@ static int parport_init(void)
|
|||
LOG_ERROR("No matching cable found for %s", parport_cable);
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
|
||||
dataport_value = cable->PORT_INIT;
|
||||
|
||||
|
||||
#if PARPORT_USE_PPDEV == 1
|
||||
if (device_handle > 0)
|
||||
{
|
||||
|
@ -374,10 +374,10 @@ static int parport_init(void)
|
|||
parport_port = 0x378;
|
||||
LOG_WARNING("No parport port specified, using default '0x378' (LPT1)");
|
||||
}
|
||||
|
||||
|
||||
dataport = parport_port;
|
||||
statusport = parport_port + 1;
|
||||
|
||||
|
||||
LOG_DEBUG("requesting privileges for parallel port 0x%lx...", dataport);
|
||||
#if PARPORT_USE_GIVEIO == 1
|
||||
if (parport_get_giveio_access() != 0)
|
||||
|
@ -389,21 +389,21 @@ static int parport_init(void)
|
|||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
LOG_DEBUG("...privileges granted");
|
||||
|
||||
|
||||
/* make sure parallel port is in right mode (clear tristate and interrupt */
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
outb(parport_port + 2, 0x0);
|
||||
#else
|
||||
outb(0x0, parport_port + 2);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PARPORT_USE_PPDEV */
|
||||
|
||||
|
||||
parport_reset(0, 0);
|
||||
parport_write(0, 0, 0);
|
||||
parport_led(1);
|
||||
|
||||
bitbang_interface = &parport_bitbang;
|
||||
bitbang_interface = &parport_bitbang;
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
@ -417,13 +417,13 @@ static int parport_quit(void)
|
|||
dataport_value = cable->PORT_EXIT;
|
||||
parport_write_data();
|
||||
}
|
||||
|
||||
|
||||
if (parport_cable)
|
||||
{
|
||||
free(parport_cable);
|
||||
parport_cable = NULL;
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -461,11 +461,11 @@ static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ct
|
|||
command_print(cmd_ctx, "usage: parport_write_on_exit <on|off>");
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(args[0], "on") == 0)
|
||||
parport_exit = 1;
|
||||
else if (strcmp(args[0], "off") == 0)
|
||||
parport_exit = 0;
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef struct presto_s
|
|||
int jtag_tdi_count;
|
||||
|
||||
int jtag_speed;
|
||||
|
||||
|
||||
} presto_t;
|
||||
|
||||
static presto_t presto_state;
|
||||
|
@ -420,7 +420,7 @@ static int presto_open(char *req_serial)
|
|||
presto->jtag_tdi_count=0;
|
||||
|
||||
presto->jtag_speed=0;
|
||||
|
||||
|
||||
#if BUILD_PRESTO_FTD2XX == 1
|
||||
return presto_open_ftd2xx(req_serial);
|
||||
#elif BUILD_PRESTO_LIBFTDI == 1
|
||||
|
@ -575,7 +575,7 @@ static int presto_tdi_flush(void)
|
|||
presto_sendbyte(presto->jtag_tdi_data);
|
||||
presto->jtag_tdi_count = 0;
|
||||
presto->jtag_tdi_data = 0;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,7 @@ static int presto_tck_idle(void)
|
|||
presto_sendbyte(0xCA);
|
||||
presto->jtag_tck = 0;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -711,7 +711,7 @@ static int presto_jtag_khz(int khz, int *jtag_speed)
|
|||
|
||||
if (khz >= 3000) *jtag_speed = 0;
|
||||
else *jtag_speed = (1000+khz-1)/khz;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -725,26 +725,26 @@ static int presto_jtag_speed_div(int speed, int *khz)
|
|||
|
||||
if (speed == 0) *khz = 3000;
|
||||
else *khz = 1000/speed;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int presto_jtag_speed(int speed)
|
||||
{
|
||||
int khz;
|
||||
|
||||
|
||||
if (presto_jtag_speed_div(speed, &khz))
|
||||
{
|
||||
return ERROR_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
presto->jtag_speed = speed;
|
||||
|
||||
|
||||
if (khz%1000 == 0)
|
||||
LOG_INFO("setting speed to %d, max. TCK freq. is %d MHz", speed, khz/1000);
|
||||
else
|
||||
LOG_INFO("setting speed to %d, max. TCK freq. is %d kHz", speed, khz);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue