diff options
author | pav <pav@FreeBSD.org> | 2005-07-14 04:02:34 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2005-07-14 04:02:34 +0800 |
commit | bb5307dda0e25a8d5e8caee5060f60d08ee36440 (patch) | |
tree | db13aebfd13478e051d7de5416e51dcad04f6d98 /devel | |
parent | fb3f693beacb81cac6566b6f779feb1fce0d7e3c (diff) | |
download | freebsd-ports-gnome-bb5307dda0e25a8d5e8caee5060f60d08ee36440.tar.gz freebsd-ports-gnome-bb5307dda0e25a8d5e8caee5060f60d08ee36440.tar.zst freebsd-ports-gnome-bb5307dda0e25a8d5e8caee5060f60d08ee36440.zip |
- Add "Werner Almesberger" patch which adds --slow option
- Change default serial device to /dev/cuaa0
PR: ports/83174
Submitted by: Erik Greenwald <erik@smluc.org> (maintainer)
Diffstat (limited to 'devel')
-rw-r--r-- | devel/picprog/Makefile | 1 | ||||
-rw-r--r-- | devel/picprog/files/patch-main.cc | 47 | ||||
-rw-r--r-- | devel/picprog/files/patch-picport.cc | 82 | ||||
-rw-r--r-- | devel/picprog/files/patch-picport.h | 13 | ||||
-rw-r--r-- | devel/picprog/files/patch-program.h | 6 |
5 files changed, 140 insertions, 9 deletions
diff --git a/devel/picprog/Makefile b/devel/picprog/Makefile index c3702c7958c6..5c33af5ff0bf 100644 --- a/devel/picprog/Makefile +++ b/devel/picprog/Makefile @@ -7,6 +7,7 @@ PORTNAME= picprog PORTVERSION= 1.7 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= http://hyvatti.iki.fi/~jaakko/pic/ diff --git a/devel/picprog/files/patch-main.cc b/devel/picprog/files/patch-main.cc index c80f425c9813..3a63f7c3f841 100644 --- a/devel/picprog/files/patch-main.cc +++ b/devel/picprog/files/patch-main.cc @@ -1,10 +1,49 @@ ---- main.cc.orig Tue Nov 19 12:50:51 2002 -+++ main.cc Tue Nov 19 12:51:11 2002 -@@ -32,6 +32,7 @@ +--- main.cc.orig Thu Apr 29 00:41:25 2004 ++++ main.cc Fri Jul 8 22:02:29 2005 +@@ -31,6 +31,7 @@ #include <sysexits.h> #include <unistd.h> +#define HAVE_DECL_GETOPT 1 #include <getopt.h> + #include <string.h> - #include "hexfile.h" +@@ -41,7 +42,7 @@ + + program prog; + +-char short_opts [] = "d:p:i:o:c:qh?"; ++char short_opts [] = "d:p:i:o:c:qsh?"; + + int + main (int argc, char **argv) +@@ -52,7 +53,7 @@ + int opt_usage = 0; + + int opt_format = hexfile::unknown; +- char *opt_port = (char *)"/dev/ttyS0"; ++ char *opt_port = (char *)"/dev/cuaa0"; + char *opt_input = NULL; + char *opt_output = NULL; + char *opt_cc = NULL; +@@ -81,6 +82,7 @@ + {"erase", no_argument, &opt_erase, 1}, + {"burn", no_argument, &opt_burn, 1}, + {"force-calibration", no_argument, &opt_calibration, 1}, ++ {"slow", no_argument, NULL, 's'}, + {0, 0, 0, 0} + }; + +@@ -113,6 +115,12 @@ + case 'q': + opt_quiet = 1; + break; ++ case 's': ++ // Add extra delays for capacity added by very long cable ++ picport::t_edge = 10; // 10 us ++ picport::t_on = 200000; // 200 ms ++ picport::t_off = 700000; // 700 ms - I'm not kidding ! ++ break; + default: // -? -h --help unknown flag + opt_usage = 1; + } diff --git a/devel/picprog/files/patch-picport.cc b/devel/picprog/files/patch-picport.cc index 0b4f619e0294..4abd6b1db38b 100644 --- a/devel/picprog/files/patch-picport.cc +++ b/devel/picprog/files/patch-picport.cc @@ -1,5 +1,5 @@ ---- picport.cc.orig Thu Apr 29 06:08:10 2004 -+++ picport.cc Wed May 25 11:09:06 2005 +--- picport.cc.orig Thu Apr 29 00:08:10 2004 ++++ picport.cc Fri Jul 8 21:46:07 2005 @@ -40,7 +40,7 @@ #include <unistd.h> #include <termios.h> @@ -9,3 +9,81 @@ #include <sched.h> #include "picport.h" +@@ -54,6 +54,11 @@ + unsigned int picport::tsc_1000ns = 0; + int picport::use_nanosleep = -1; + ++// Extra delays for long cables, in us ++int picport::t_on = 0; ++int picport::t_off = 0; ++int picport::t_edge = 0; ++ + void + picport::set_clock_data (int rts, int dtr) + { +@@ -102,7 +107,7 @@ + // Before first call to set_clock_data, read the modem status. + ioctl (fd, TIOCMGET, &modembits); + set_clock_data (0, 0); +- usleep (50); ++ usleep (50+t_edge); + // Check the CTS. If it is up, even when we just lowered DTR, + // we probably are not talking to a JDM type programmer. + int i; +@@ -200,13 +205,13 @@ + cerr << "Unable to start break on tty " << tty << ":" << strerror (e) << endl; + exit (EX_IOERR); + } +- usleep (10); ++ usleep (10+t_off); + } + + picport::~picport () + { + ioctl (fd, TIOCCBRK, 0); +- usleep (1); ++ usleep (1+t_off); + tcsetattr (fd, TCSANOW, &saved); + close (fd); + delete [] portname; +@@ -216,15 +221,15 @@ + { + set_clock_data (0, 0); + ioctl (fd, TIOCCBRK, 0); +- usleep (50); ++ usleep (50+t_off); + ioctl (fd, TIOCSBRK, 0); +- usleep (10); ++ usleep (10+t_on); + addr = 0; + } + + void picport::delay (long ns) + { +- if (1 == use_nanosleep) { ++ if (1 == use_nanosleep && !t_edge) { + timespec ts = {ns / 1000000000, ns % 1000000000}, ts2; + while (nanosleep (&ts, &ts2) && EINTR == errno) + ts = ts2; +@@ -232,7 +237,7 @@ + } + + #ifdef RDTSC_WORKS +- if (tsc_1000ns > 1) { ++ if (tsc_1000ns > 1 && !t_edge) { + unsigned long a1, d1, a2, d2; + asm volatile("rdtsc":"=a" (a1), "=d" (d1)); + d2 = d1; +@@ -259,10 +264,10 @@ + volatile int i; + gettimeofday (&tv1, 0); + tv2.tv_sec = tv1.tv_sec; +- tv2.tv_usec = 0xffffffff & (tv1.tv_usec + 1 + (ns + 999)/1000); ++ tv2.tv_usec = 0xffffffff & (tv1.tv_usec + 1 + (ns + 999)/1000+t_edge); + if (tv2.tv_usec < tv1.tv_usec) + tv2.tv_sec++; +- for (i = 0; i < 10000; i++) { ++ for (i = 0; i < 10000 || t_edge; i++) { + gettimeofday (&tv1, 0); + if (tv1.tv_sec > tv2.tv_sec + || tv1.tv_sec == tv2.tv_sec && tv1.tv_usec >= tv2.tv_usec) diff --git a/devel/picprog/files/patch-picport.h b/devel/picprog/files/patch-picport.h new file mode 100644 index 000000000000..16ed4fe0f3c3 --- /dev/null +++ b/devel/picprog/files/patch-picport.h @@ -0,0 +1,13 @@ +--- picport.h.orig Thu Apr 29 00:09:38 2004 ++++ picport.h Fri Jul 8 21:46:07 2005 +@@ -59,6 +59,10 @@ + + public: + ++ static int t_on; ++ static int t_off; ++ static int t_edge; ++ + static void delay (long ns); + + enum commands { diff --git a/devel/picprog/files/patch-program.h b/devel/picprog/files/patch-program.h index 2dedb1df5bc3..266d0cc5df78 100644 --- a/devel/picprog/files/patch-program.h +++ b/devel/picprog/files/patch-program.h @@ -1,6 +1,6 @@ ---- program.h.orig Tue Nov 19 12:53:12 2002 -+++ program.h Tue Nov 19 12:53:20 2002 -@@ -31,6 +31,7 @@ +--- program.h.orig Thu Jan 1 20:35:09 2004 ++++ program.h Fri Jul 8 21:44:23 2005 +@@ -30,6 +30,7 @@ #ifndef H_PROGRAM #define H_PROGRAM |