View | Details | Raw Unified | Return to bug 141385
Collapse All | Expand All

(-)devel/picprog/Makefile (-1 / +1 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	picprog
8
PORTNAME=	picprog
9
PORTVERSION=	1.8.1
9
PORTVERSION=	1.9.0
10
CATEGORIES=	devel
10
CATEGORIES=	devel
11
MASTER_SITES=	http://hyvatti.iki.fi/~jaakko/pic/
11
MASTER_SITES=	http://hyvatti.iki.fi/~jaakko/pic/
12
12
(-)devel/picprog/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (picprog-1.8.1.tar.gz) = 723369d679c5343af7b7dd5036299877
1
MD5 (picprog-1.9.0.tar.gz) = a43e33b760952834052695fbbe31b0f1
2
SHA256 (picprog-1.8.1.tar.gz) = 1e9e17a764611828a6af028cb1a6eda4abd6ad4c7fed17ca4b6ea246c74a4a19
2
SHA256 (picprog-1.9.0.tar.gz) = 1af3febb62855847a4de884c1a4d98c88f8d6c02f8193c876bce0b760c7606e6
3
SIZE (picprog-1.8.1.tar.gz) = 58040
3
SIZE (picprog-1.9.0.tar.gz) = 64398
(-)devel/picprog/files/patch-main.cc (-49 lines)
Lines 1-49 Link Here
1
--- main.cc.orig	Thu Apr 29 00:41:25 2004
2
+++ main.cc	Fri Jul  8 22:02:29 2005
3
@@ -31,6 +31,7 @@
4
 
5
 #include <sysexits.h>
6
 #include <unistd.h>
7
+#define HAVE_DECL_GETOPT 1
8
 #include <getopt.h>
9
 #include <string.h>
10
 
11
@@ -41,7 +42,7 @@
12
 
13
 program prog;
14
 
15
-char short_opts [] = "d:p:i:o:c:qh?";
16
+char short_opts [] = "d:p:i:o:c:qsh?";
17
 
18
 int
19
 main (int argc, char **argv)
20
@@ -52,7 +53,7 @@
21
   int opt_usage = 0;
22
 
23
   int opt_format = hexfile::unknown;
24
-  char *opt_port = (char *)"/dev/ttyS0";
25
+  char *opt_port = (char *)"/dev/cuaa0";
26
   char *opt_input = NULL;
27
   char *opt_output = NULL;
28
   char *opt_cc = NULL;
29
@@ -81,6 +82,7 @@
30
     {"erase", no_argument, &opt_erase, 1},
31
     {"burn", no_argument, &opt_burn, 1},
32
     {"force-calibration", no_argument, &opt_calibration, 1},
33
+    {"slow", no_argument, NULL, 's'},
34
     {0, 0, 0, 0}
35
   };
36
 
37
@@ -113,6 +115,12 @@
38
     case 'q':
39
       opt_quiet = 1;
40
       break;
41
+    case 's':
42
+	// Add extra delays for capacity added by very long cable
43
+	picport::t_edge = 10; // 10 us
44
+	picport::t_on = 200000;  // 200 ms
45
+	picport::t_off = 700000; // 700 ms - I'm not kidding !
46
+	break;
47
     default: // -? -h --help unknown flag
48
       opt_usage = 1;
49
     }
(-)devel/picprog/files/patch-picport.cc (-86 / +16 lines)
Lines 1-89 Link Here
1
--- picport.cc.orig	Thu Apr 29 00:08:10 2004
1
--- picport.cc.orig	2009-12-11 16:33:39.000000000 -0500
2
+++ picport.cc	Fri Jul  8 21:46:07 2005
2
+++ picport.cc	2009-12-11 16:33:53.000000000 -0500
3
@@ -40,7 +40,7 @@
3
@@ -33,7 +33,6 @@
4
 #include <unistd.h>
4
 #include <string>
5
 #include <termios.h>
6
 #include <sysexits.h>
7
-#include <string.h>
8
+#include <string>
9
 #include <sched.h>
10
 
5
 
11
 #include "picport.h"
6
 #include <sys/ioctl.h>
12
@@ -54,6 +54,11 @@
7
-#include <sys/io.h>
13
 unsigned int picport::tsc_1000ns = 0;
8
 #include <fcntl.h>
14
 int picport::use_nanosleep = -1;
9
 #include <errno.h>
15
 
10
 #include <time.h>
16
+// Extra delays for long cables, in us
11
@@ -159,8 +158,6 @@
17
+int picport::t_on = 0;
12
     // Not root.  Cannot use realtime scheduling.
18
+int picport::t_off = 0;
13
     use_nanosleep = 0;
19
+int picport::t_edge = 0;
20
+
21
 void
22
 picport::set_clock_data (int rts, int dtr)
23
 {
24
@@ -102,7 +107,7 @@
25
   // Before first call to set_clock_data, read the modem status.
26
   ioctl (fd, TIOCMGET, &modembits);
27
   set_clock_data (0, 0);
28
-  usleep (50);
29
+  usleep (50+t_edge);
30
   // Check the CTS.  If it is up, even when we just lowered DTR,
31
   // we probably are not talking to a JDM type programmer.
32
   int i;
33
@@ -200,13 +205,13 @@
34
     cerr << "Unable to start break on tty " << tty << ":" << strerror (e) << endl;
35
     exit (EX_IOERR);
36
   }
37
-  usleep (10);
38
+  usleep (10+t_off);
39
 }
40
 
41
 picport::~picport ()
42
 {
43
   ioctl (fd, TIOCCBRK, 0);
44
-  usleep (1);
45
+  usleep (1+t_off);
46
   tcsetattr (fd, TCSANOW, &saved);
47
   close (fd);
48
   delete [] portname;
49
@@ -216,15 +221,15 @@
50
 {
51
   set_clock_data (0, 0);
52
   ioctl (fd, TIOCCBRK, 0);
53
-  usleep (50);
54
+  usleep (50+t_off);
55
   ioctl (fd, TIOCSBRK, 0);
56
-  usleep (10);
57
+  usleep (10+t_on);
58
   addr = 0;
59
 }
60
 
61
 void picport::delay (long ns)
62
 {
63
-  if (1 == use_nanosleep) {
64
+  if (1 == use_nanosleep && !t_edge) {
65
     timespec ts = {ns / 1000000000, ns % 1000000000}, ts2;
66
     while (nanosleep (&ts, &ts2) && EINTR == errno)
67
       ts = ts2;
68
@@ -232,7 +237,7 @@
69
   }
14
   }
15
-  if (iopl (3))
16
-    disable_interrupts = 0;
70
 
17
 
71
 #ifdef RDTSC_WORKS
18
 #ifdef CPU_SETSIZE
72
-  if (tsc_1000ns > 1) {
19
   // When computing the delay loops, we do not want the cpu's to change.
73
+  if (tsc_1000ns > 1 && !t_edge) {
74
     unsigned long a1, d1, a2, d2;
75
     asm volatile("rdtsc":"=a" (a1), "=d" (d1));
76
     d2 = d1;
77
@@ -259,10 +264,10 @@
78
   volatile int i;
79
   gettimeofday (&tv1, 0);
80
   tv2.tv_sec = tv1.tv_sec;
81
-  tv2.tv_usec = 0xffffffff & (tv1.tv_usec + 1 + (ns + 999)/1000);
82
+  tv2.tv_usec = 0xffffffff & (tv1.tv_usec + 1 + (ns + 999)/1000+t_edge);
83
   if (tv2.tv_usec < tv1.tv_usec)
84
     tv2.tv_sec++;
85
-  for (i = 0; i < 10000; i++) {
86
+  for (i = 0; i < 10000 || t_edge; i++) {
87
     gettimeofday (&tv1, 0);
88
     if (tv1.tv_sec > tv2.tv_sec
89
 	|| tv1.tv_sec == tv2.tv_sec && tv1.tv_usec >= tv2.tv_usec)
(-)devel/picprog/files/patch-picport.h (-22 lines)
Lines 1-22 Link Here
1
--- picport.h.orig	Wed Jul 14 01:24:34 2004
2
+++ picport.h	Fri Dec 15 16:43:35 2006
3
@@ -45,7 +45,7 @@
4
   int W[16];
5
 
6
   int modembits;
7
-  void picport::set_clock_data (int rts, int dtr);
8
+  void set_clock_data (int rts, int dtr);
9
 
10
   void p_out (int b);
11
   int p_in ();
12
@@ -58,6 +58,10 @@
13
   static int use_nanosleep;
14
 
15
 public:
16
+
17
+  static int t_on;
18
+  static int t_off;
19
+  static int t_edge;
20
 
21
   static void delay (long ns);
22
 
(-)devel/picprog/files/patch-program.h (-10 lines)
Lines 1-10 Link Here
1
--- program.h.orig	Thu Jan  1 20:35:09 2004
2
+++ program.h	Fri Jul  8 21:44:23 2005
3
@@ -30,6 +30,7 @@
4
 #ifndef H_PROGRAM
5
 #define H_PROGRAM
6
 
7
+#define HAVE_DECL_GETOPT 1
8
 #include <getopt.h>
9
 
10
 class program {

Return to bug 141385