Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / misc / urjtag / patches / patch-ae
blob1bef9ef3010e1807c8ba28e7041552cf3cbeeec6
1 $NetBSD$
3 --- src/tap/cable/generic.c.orig        2009-04-17 20:24:10.000000000 +0000
4 +++ src/tap/cable/generic.c
5 @@ -202,7 +202,7 @@ generic_flush_using_transfer( cable_t *c
6  
7         do
8         {
9 -               int r, bits = 0, tdo = 0;
10 +               int r, bits = 0, savbits;
12  #ifdef VERBOSE
13                 printf("flush(%d)\n", cable->todo.num_items);
14 @@ -254,6 +254,7 @@ generic_flush_using_transfer( cable_t *c
15  #ifdef VERBOSE
16                 printf("%d combined into one (%d bits)\n", n, bits);
17  #endif
18 +               savbits = bits;
20                 if(bits == 0 || n <= 1)
21                 {
22 @@ -309,17 +310,21 @@ generic_flush_using_transfer( cable_t *c
23                         {
24                                 if(cable->todo.data[i].action == CABLE_CLOCK)
25                                 {
26 -                                       int k;
27 -                                       for(k=0;k<cable->todo.data[i].arg.clock.n;k++)
28 -                                               tdo = out[bits++];
30 +                                       bits += cable->todo.data[i].arg.clock.n;
31                                 }
32                                 else if(cable->todo.data[i].action == CABLE_GET_TDO)
33                                 {
34 +                                       int tdo;
35                                         int c = cable_add_queue_item( cable, &(cable->done) );
36  #ifdef VERBOSE
37                                         printf("add result from transfer to %p.%d\n", &(cable->done), c);
38  #endif
39                                         cable->done.data[c].action = CABLE_GET_TDO;
40 +                                       if (bits < savbits)
41 +                                               tdo = out[bits];
42 +                                       else
43 +                                               tdo = cable->driver->get_tdo(cable);
44                                         cable->done.data[c].arg.value.val = tdo;
45                                 }
46                                 else if(cable->todo.data[i].action == CABLE_TRANSFER)
47 @@ -340,7 +345,6 @@ generic_flush_using_transfer( cable_t *c
48                                                 if(len > 0) memcpy(p, out+bits, len);
49                                         }
50                                         if(len>0) bits += len;
51 -                                       if(bits>0) tdo = out[bits-1];
52                                 }
53                                 i++;
54                                 if(i >= cable->todo.max_items) i = 0;