chiark / gitweb /
Merge and end branch-hostside-wip-2008-01-25 PROPERLY; cvs up -j branch-hostside...
[trains.git] / hostside / README
1 ./hostside-old [<options>] <nmra-command> <nmra-args...>    see nmra-packets.h
2 ./hostside-old [<options>] nmra_bytes <nmra-command-hex-no-csum>
3 ./hostside-old [<options>] nmra_raw <nmra-command-hex-with-csum>
4 ./hostside-old [<options>] command <literal-data-for-pic>
5  options
6   -s<serialport>   eg -s/dev/ttyS0  normally necessary
7   -w<repeatdelay>  usleep; 0 = no usleep; default is -1 = don't repeat at all
8   -i<iterations>   default is 0 = infinite; -1 means don't repeat
9                       *** the above seems wrong; -1 seems to mean infinite
10                         *** and 0 means once ?!
11   -f<fudgedelay>   usleep; each character; default is 0 = no usleep
12
13 Eg,
14  ./hostside-old -s/dev/ttyS0 -w10000 -i1000 nmra_bytes 0348
15 to tell decoder 3 to go speed 13 backwards every 10ms for 1000 times, ie 10s
16  (on norway this means it actually happens every 20ms, ie for 20s,
17    which makes it a bit of a fudge really)
18
19  ff       ff       80       e4       c1       17         output bytes
20  11111111 11111111 10000000 11100100 11000001 00010111   as bits
21  >1111111 >1111111 >0000000 >1100100 >1000001 $0010111   top bit: >/$ for pic
22
23  1111111 1111111  0 00000011 0 01001000 0 01001011 1     reorg bits for nmra:
24   preamble (14)   S 0AAAAAAA P 01DCSSSS 0 EEEEEEEE 1
25                     03    (+)  48       = 4b ok
26
27 To test:
28  ./hostside-old -st nmra_bytes 0348 && binview t
29
30
31
32
33 Protocol over new hostside stdin:
34                                             Example (always the same msg):
35  P> nmra [<slot>] [<nmra-command [<nmra-args>...]]    nmra speed28 3 13 1
36  P> nmra [<slot>] [=<nmra-bytes>]                     nmra =0348
37  P> nmra [<slot>] [:<nmra-bytes-with-csum>]           nmra :03484b
38  P> nmra [<slot>] [_<pic-literal-bytes>]              nmra _7f7f00644197
39    in each case <slot> (if present) is *<slotname> or %<slotname> and
40    indicates that the message should be put in the retransmission
41    cycle, and cancels any previous message with the same <slotname>.
42    <slotname> may be empty.  * indicates urgent
43  P> nmra <slot>
44    cancels the relevant retransmission.
45
46                                             Example (always the same msg):
47  P> pic =<pic-bytes>                                   pic =a003
48  P> pic <pic-command> [<pic-args...]                   pic point 3
49        the latter for commands with no `...' in README.protocol only
50
51  Keen readers will observe that
52     pic =<pic-bytes>    and
53     nmra _<pic-bytes>
54  do exactly the same.
55
56  P> polarity <bit-string-in-hex>....
57        where, eg, with 14 segments,
58                          [      1]    [111 1111]    reversible
59                [123]     [56 7890]    [123 4567]     segment number
60          1 0010 000    1 000 1000    0 111 1010     example POLARITY
61          1 0010 RRR    1 RRR RRRR    0 RRR R---      from README.protocol
62                 RRR      RRR RRRR      RRR R        actual R bits
63                 \__        ___/\__      ___/         ... which map ...
64                    RRRRRRRR       RRRRRR             ... into data ...
65                    RRRRRRRR       RRRRRR--           ... like this.
66                    00000010       00111100
67                                  [ 1111111]         reversible
68                   [12345678]     [90123456]          segment number
69                      0x02           0x3c            hex values
70                        023c                         hex data string
71
72  Up< pic-out <hex-bytes...>
73  Up< pic-in <hex-bytes...>
74
75  U< count <type> <number-in-decimal>
76       eg  count polarity 14
77  U< pic detect 1|0 <S>
78  U< pic point <P>
79  U< pic pointed <P>
80  U< pic charged <P>
81  U< polarity <bit-string-in-hex>....
82  U< polarised <bit-string-in-hex>....