[ 1940323 ] OS X support for UrJTAG (by Ville Voipio)

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1167 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent 7b44334ca1
commit de70664578

@ -1,3 +1,9 @@
2008-04-11 Kolja Waschk <kawk>
* src/bsdl/bsdl.c, src/tap/parport/ftd2xx.c, src/tap/parport/ftdi.c,
src/tap/usbconn/libusb.c, src/lib/fclock.c, src/jtag.c:
[ 1940323 ] OS X support for UrJTAG (by Ville Voipio)
2008-04-11 Arnim Laeuger <arniml@users.sourceforge.net>
* src/tap/parport/ftdi.c (ftdi_flush_output): removed unused variables

@ -63,6 +63,7 @@ Holger Schurig
Robert Sedevici
Juergen Stuber
Hartley Sweeten
Ville Voipio
David Vrabel
Alan Wallace
Jeff Wittrock

@ -198,8 +198,10 @@ void bsdl_set_path(chain_t *chain, const char *pathlist)
bsdl_globs_t *globs = &(chain->bsdl);
char *delim;
char *elem;
char *pathelem;
int num;
size_t len;
/* free memory of current path list */
if (globs->path_list) {
for (num = 0; globs->path_list[num]; num++)
@ -217,7 +219,14 @@ void bsdl_set_path(chain_t *chain, const char *pathlist)
/* extend path list array */
globs->path_list = (char **)realloc(globs->path_list, (num+1) * sizeof(char *));
/* enter path element up to the delimeter */
globs->path_list[num-1] = strndup(elem, (size_t)(delim - elem));
if (delim == NULL)
len = strlen(elem);
else
len = delim-elem;
pathelem = malloc(len + 1);
memcpy(pathelem, elem, len);
pathelem[len] = '\0';
globs->path_list[num-1] = pathelem;
globs->path_list[num] = NULL;
}
elem = delim ? delim + 1 : elem + strlen(elem);

@ -150,7 +150,7 @@ static int jtag_readline_multiple_commands_support(chain_t *chain, char * line)
if (!line || !(strlen( line ) > 0))
return 1;
do {
line = nextcmd;
@ -176,6 +176,9 @@ jtag_readline_loop( chain_t *chain, const char *prompt )
{
#ifdef HAVE_LIBREADLINE
char *line = NULL;
#ifdef HAVE_READLINE_HISTORY
HIST_ENTRY *hptr;
#endif
/* Iterate */
while (jtag_readline_multiple_commands_support( chain, line )) {
@ -194,8 +197,22 @@ jtag_readline_loop( chain_t *chain, const char *prompt )
#ifdef HAVE_READLINE_HISTORY
/* Check if we actually got something , Don't add duplicate lines*/
if (strlen( line ) &&( !history_length ||strcmp(line,history_get(history_length)->line)))
add_history( line );
if (strlen( line )) {
if (history_length == 0)
add_history( line );
else {
hptr = history_get( history_length );
/* Apple leopard libreadline emulation screws up indexing, try the other one */
if (hptr == NULL)
hptr = history_get( history_length-1 );
if (hptr != NULL) {
if (strcmp( line, hptr->line ))
add_history( line );
}
else
add_history( line );
}
}
#endif
}
free( line );
@ -204,7 +221,7 @@ jtag_readline_loop( chain_t *chain, const char *prompt )
line[0] = 0;
do
{
jtag_readline_multiple_commands_support( line );
jtag_readline_multiple_commands_support( chain, line );
printf("%s", prompt);
fflush(stdout);
}
@ -404,7 +421,6 @@ main( int argc, char *const argv[] )
printf( _("Out of memory\n") );
return -1;
}
jtag_parse_stream( chain, stdin );
cleanup( chain );

@ -30,6 +30,12 @@
#include <math.h>
#include <assert.h>
#ifdef __APPLE__
#include <mach/mach_time.h>
#include <sys/types.h>
#include <sys/time.h>
#endif
#ifndef CLK_TCK
static clock_t CLK_TCK = 0;
@ -50,6 +56,24 @@ long double
frealtime()
{
long double result;
#ifdef __APPLE__
static uint64_t start_mat;
static long double start_time;
static double multiplier;
mach_timebase_info_data_t mtid;
struct timeval tv;
if(!mtid.denom == 0) {
mach_timebase_info(&mtid);
multiplier = (double)mtid.numer / (double)mtid.denom;
gettimeofday(&tv, NULL);
start_time = (long double)tv.tv_sec + (long double)tv.tv_usec * 1000.0;
start_mat = mach_absolute_time();
}
result = start_time + (mach_absolute_time() - start_mat) * multiplier;
#else
#ifdef _POSIX_TIMERS
struct timespec t;
if (clock_gettime(CLOCK_REALTIME, &t)==-1) {
@ -65,6 +89,7 @@ frealtime()
exit(EXIT_FAILURE);
}
result = (long double)c/CLK_TCK;
#endif
#endif
assert(isnormal(result));
assert(result > 0);

@ -33,8 +33,6 @@
#include <unistd.h>
#if __CYGWIN__
#include <windows.h>
#else
#include <linux/ioctl.h>
#endif
#ifdef HAVE_STROPTS_H
#include <stropts.h>

@ -33,7 +33,6 @@
#include <stropts.h>
#endif
#include <unistd.h>
#include <linux/ioctl.h>
#include <stdlib.h>
#include <string.h>

@ -31,8 +31,6 @@
#include <fcntl.h>
#if __CYGWIN__
#include <windows.h>
#else
#include <linux/ioctl.h>
#endif
#include <stdio.h>
#include <string.h>

Loading…
Cancel
Save