summaryrefslogtreecommitdiff
path: root/devel/picprog/files/patch-picport.cc
diff options
context:
space:
mode:
authorDmitry Marakasov <amdmi3@FreeBSD.org>2009-12-11 23:56:23 +0000
committerDmitry Marakasov <amdmi3@FreeBSD.org>2009-12-11 23:56:23 +0000
commit5da09645a7789ec090a998ba6d1598470b9553a7 (patch)
treea3851782328c5d0255735a2adbeae4be029306cf /devel/picprog/files/patch-picport.cc
parent- envvars needs to be sourced before _all_ commands if it exists (diff)
- Update to 0.9.0
PR: 141385 Submitted by: Erik Greenwald <erik@smluc.org> (maintainer)
Notes
Notes: svn path=/head/; revision=245574
Diffstat (limited to 'devel/picprog/files/patch-picport.cc')
-rw-r--r--devel/picprog/files/patch-picport.cc102
1 files changed, 16 insertions, 86 deletions
diff --git a/devel/picprog/files/patch-picport.cc b/devel/picprog/files/patch-picport.cc
index 4abd6b1db38b..d5ff62f1b42c 100644
--- a/devel/picprog/files/patch-picport.cc
+++ b/devel/picprog/files/patch-picport.cc
@@ -1,89 +1,19 @@
---- 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>
- #include <sysexits.h>
--#include <string.h>
-+#include <string>
- #include <sched.h>
+--- picport.cc.orig 2009-12-11 16:33:39.000000000 -0500
++++ picport.cc 2009-12-11 16:33:53.000000000 -0500
+@@ -33,7 +33,6 @@
+ #include <string>
- #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 @@
+ #include <sys/ioctl.h>
+-#include <sys/io.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <time.h>
+@@ -159,8 +158,6 @@
+ // Not root. Cannot use realtime scheduling.
+ use_nanosleep = 0;
}
+- if (iopl (3))
+- disable_interrupts = 0;
- #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)
+ #ifdef CPU_SETSIZE
+ // When computing the delay loops, we do not want the cpu's to change.