AC_CHECK_HEADERS(jtag_minidriver.h)
AC_CHECK_HEADERS(sys/param.h)
+AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(elf.h)
+AC_CHECK_HEADERS(strings.h)
+
+AC_HEADER_TIME
AC_C_BIGENDIAN
+AC_C_VARARRAYS
AC_CHECK_FUNCS(strndup)
AC_CHECK_FUNCS(strnlen)
int unregister_command(command_context_t *context, char *name)
{
- unique_length_dirty = 1;
-
command_t *c, *p = NULL, *c2;
+ unique_length_dirty = 1;
+
if ((!context) || (!name))
return ERROR_INVALID_ARGUMENTS;
void command_print_help_line(command_context_t* context, struct command_s *command, int indent)
{
command_t *c;
+ #ifdef HAVE_C_VARRAYS
char indent_text[indent + 2];
+ #else
+ char indent_text[68];
+ #endif
char *help = "no help available";
char name_buf[64];
int handle_time_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc<1)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
duration_t duration;
char *duration_text;
int retval;
+ float t;
+
+ if (argc<1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
duration_start_measure(&duration);
duration_stop_measure(&duration, &duration_text);
- float t=duration.duration.tv_sec;
+ t=duration.duration.tv_sec;
t+=((float)duration.duration.tv_usec / 1000000.0);
command_print(cmd_ctx, "%s took %fs", args[0], t);
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
-#include <time.h>
int debug_level = -1;
*/
static void log_puts(enum log_levels level, const char *file, int line, const char *function, const char *string)
{
+ char *f;
if (level == LOG_LVL_OUTPUT)
{
/* do not prepend any headers, just print out what we were given and return */
return;
}
- char *f = strrchr(file, '/');
+ f = strrchr(file, '/');
if (f != NULL)
file = f + 1;
void log_printf(enum log_levels level, const char *file, int line, const char *function, const char *format, ...)
{
char *string;
+ va_list ap;
count++;
if (level > debug_level)
return;
- va_list ap;
va_start(ap, format);
string = alloc_vprintf(format, ap);
void log_printf_lf(enum log_levels level, const char *file, int line, const char *function, const char *format, ...)
{
char *string;
+ va_list ap;
count++;
if (level > debug_level)
return;
- va_list ap;
va_start(ap, format);
string = alloc_vprintf(format, ap);
for (;;)
{
char *t = string;
+ va_list ap_copy;
+ int ret;
string = realloc(string, size);
if (string == NULL)
{
return NULL;
}
- va_list ap_copy;
va_copy(ap_copy, ap);
- int ret;
ret = vsnprintf(string, size, fmt, ap_copy);
/* NB! The result of the vsnprintf() might be an *EMPTY* string! */
if ((ret >= 0) && ((ret + 1) < size))
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_STRINGS_H
#include <strings.h>
+#endif
/*
* clear_malloc
*
static __inline void socket_nonblock(int fd)
{
#ifdef _WIN32
- long nonblock = 1;
+ unsigned long nonblock = 1;
ioctlsocket(fd, FIONBIO, &nonblock );
#else
int oldopts = fcntl(fd, F_GETFL, 0);
#include "log.h"
#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y);
int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y);
#ifndef TIME_SUPPORT_H
#define TIME_SUPPORT_H
-#include <sys/time.h>
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
extern int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y);
extern int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y);
#include <string.h>
#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-
#if PARPORT_USE_PPDEV == 1
#include <linux/parport.h>
#include <linux/ppdev.h>
#include <stdlib.h>
#include <unistd.h>
-#include <sys/time.h>
-#include <time.h>
-
bitbang_interface_t *bitbang_interface;
int bitbang_execute_queue(void);
#include <stdlib.h>
#include <unistd.h>
-#include <sys/time.h>
-#include <time.h>
-
bitq_interface_t *bitq_interface; /* low level bit queue interface */
#include <ftdi.h>
#endif
-#include <sys/time.h>
-#include <time.h>
-
/* enable this to debug io latency
*/
#if 0
state_count = 0;
while (num_states)
{
- tms_byte = 0x0;
int bit_count = 0;
int num_states_batch = num_states > 7 ? 7 : num_states;
+ tms_byte = 0x0;
/* command "Clock Data to TMS/CS Pin (no Read)" */
BUFFER_ADD = 0x4b;
/* number of states remaining */
#include <string.h>
#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-
#if PARPORT_USE_PPDEV == 1
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <dev/ppbus/ppi.h>
{
cmd_queue_page_t **p_page = &cmd_queue_pages;
int offset;
+ u8 *t;
if (*p_page)
{
offset = (*p_page)->used;
(*p_page)->used += size;
- u8 *t=(u8 *)((*p_page)->address);
+ t=(u8 *)((*p_page)->address);
return t + offset;
}
void jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state state)
{
+ int retval;
+
jtag_prelude(state);
- int retval=interface_jtag_add_ir_scan(num_fields, fields, cmd_queue_end_state);
+ retval=interface_jtag_add_ir_scan(num_fields, fields, cmd_queue_end_state);
if (retval!=ERROR_OK)
jtag_error=retval;
}
void jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum tap_state state)
{
+ int retval;
+
jtag_prelude(state);
- int retval=interface_jtag_add_plain_ir_scan(num_fields, fields, cmd_queue_end_state);
+ retval=interface_jtag_add_plain_ir_scan(num_fields, fields, cmd_queue_end_state);
if (retval!=ERROR_OK)
jtag_error=retval;
}
void jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_state state)
{
+ int retval;
+
jtag_prelude(state);
- int retval=interface_jtag_add_dr_scan(num_fields, fields, cmd_queue_end_state);
+ retval=interface_jtag_add_dr_scan(num_fields, fields, cmd_queue_end_state);
if (retval!=ERROR_OK)
jtag_error=retval;
}
void jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state state)
{
+ int retval;
+
jtag_prelude(state);
- int retval=interface_jtag_add_plain_dr_scan(num_fields, fields, cmd_queue_end_state);
+ retval=interface_jtag_add_plain_dr_scan(num_fields, fields, cmd_queue_end_state);
if (retval!=ERROR_OK)
jtag_error=retval;
}
void jtag_add_pathmove(int num_states, enum tap_state *path)
{
+ enum tap_state cur_state=cmd_queue_cur_state;
+ int i;
+ int retval;
+
/* the last state has to be a stable state */
if (tap_move_map[path[num_states - 1]] == -1)
{
exit(-1);
}
- enum tap_state cur_state=cmd_queue_cur_state;
- int i;
for (i=0; i<num_states; i++)
{
if ((tap_transitions[cur_state].low != path[i])&&
cmd_queue_cur_state = path[num_states - 1];
- int retval=interface_jtag_add_pathmove(num_states, path);
+ retval=interface_jtag_add_pathmove(num_states, path);
if (retval!=ERROR_OK)
jtag_error=retval;
}
void jtag_add_runtest(int num_cycles, enum tap_state state)
{
+ int retval;
+
jtag_prelude(state);
/* executed by sw or hw fifo */
- int retval=interface_jtag_add_runtest(num_cycles, cmd_queue_end_state);
+ retval=interface_jtag_add_runtest(num_cycles, cmd_queue_end_state);
if (retval!=ERROR_OK)
jtag_error=retval;
}
usleep(us);
}
+int cwvx_device_num = -1, cwvx_version_num, cwvx_part_num;
+
/* Try to examine chain layout according to IEEE 1149.1 ยง12
*/
int jtag_examine_chain()
LOG_INFO("JTAG device found: 0x%8.8x (Manufacturer: 0x%3.3x, Part: 0x%4.4x, Version: 0x%1.1x)",
idcode, manufacturer, part, version);
+ /* Total hacky hack! PORGES */
+ if (manufacturer == 0x1a2) {
+ cwvx_device_num = device_count-1;
+ cwvx_part_num = part;
+ cwvx_version_num = version;
+ }
+
bit_count += 32;
}
}
#include <stdlib.h>
#include <unistd.h>
-#include <sys/time.h>
-#include <time.h>
-
/* PRESTO access library includes */
#if BUILD_PRESTO_FTD2XX == 1
#include <ftd2xx.h>