chiark / gitweb /
ping/pong spots loopback
authorian <ian>
Sat, 17 May 2008 14:45:46 +0000 (14:45 +0000)
committerian <ian>
Sat, 17 May 2008 14:45:46 +0000 (14:45 +0000)
cebpic/README.protocol
detpic/program.asm
hostside/skelproto-pic.h

index abc89e89e15199b6d69c9b8e6d2ce86d99aba1a9..f400d920d315e0fcc062f0e39591647aab0441a5 100644 (file)
@@ -17,7 +17,7 @@ From host to PIC:
 
  > 1 0100 TTT  0 TTTTTTT  (a0)  POINT    Point T fire
  > 1 1111 111  ....       (ff)  NMRADATA  NMRA data
- > 1 0001 XXX  0 XXXXXXX  (88+)        PING      Ping `X' (please Pong `X')
+ > 1 0001 XXX  0 XXXXXXX  (88+)        PING      Ping `X' (please Pong `X(+)0x5a')
  > 1 0010 RRR  E RRR...   (90+)        POLARITY  Set polarity
  > 1 0011 000  0 MMMMMMM  (98+)        WATCHDOG  W'dog reset, t/o <M*16>ms from now
  > 0 0010 001             (11) ON        Power on
@@ -61,7 +61,7 @@ From host to PIC:
 From PIC to host:
 
  < 1 001Y SSS  0 SSSSSSS  (9?) DETECT    Train is (Y=1) or is not (Y=0) at S
- < 1 0001 XXX  0 XXXXXXX  (88+)        PONG      Pong `X' (reply to Ping `X')
+ < 1 0001 XXX  0 XXXXXXX  (88+)        PONG      Pong `X' (reply to Ping `X(+)0x5a')
  < 1 100 0001  0 NNNNNNN  (ENQ) SPURIOUS  Number of spurious fault interrupts
  < 0 000 1001             (HT)  HELLO    I am booted
  < 0 000 1011             (VT)  AAARGH   Followed by debug chars (only)
@@ -117,19 +117,28 @@ should send FIXED but not fully reenable track power; track power
 should be reenabled when the host transmits ON.
 
 
-       Track and CDU                     Track and CDU
-        disabled      -------ON------->          enabled
-          .     __                   __
-         /|\   |`-._             ON  ,-'|    |
-          |         `-._          ,-'        |Short circuit detected
-         |         OFF `-._   ,-'           |
-       OFF|                 ,-' _          FAULT
-         |              ,-'     `-._        |
-         |           ,-'           `-._     V
-                    '                  `
-       Track disabled                     Wait for post-fault
-       CDU enabled     <-----500ms------   minimum off time
-       User Fault lit       RETRIABLE
+       Track and CDU                     Track and CDU  ----->-----.
+        disabled      -------ON------->          enabled                   \
+          .     __                   __                             |
+         /|\   |`-._             ON  ,-'|    |,--------<-------.     |
+                 |         `-._          ,-'        |                  |    |
+       OFF|         OFF `-._   ,-'           |Short                    |    |
+          |                 ,-' _       FAULT| circuit                 |    |
+     ,->-'|                     ,+'     `-._        | detected         |    |
+    /     |                  ,-' |         `-._     V                  |    |
+   |                '    |             `                       |    |
+   |   Track disabled     |               Wait for post-fault          |    |
+   |   CDU enabled     <-----500ms------   minimum off time    |    |
+   |   User Fault                |  RETRIABLE    User fault            |    |
+   |    flashes slowly           |                flashes rapidly      |    |
+   |                            /                                      |    |
+    \                          '                                       |    |
+     `----- Track disabled  ---------------->-------------------'   /
+                   CDU enabled     ----------------<----------------------'
+                   User Fault lit      WTIMEOUT        watchdog timer runs out
+
+
+
 
 
 If ON or OFF are issued in the first 500ms following a short circuit,
@@ -173,8 +182,9 @@ PING and PONG
 -------------
 
 The host may send PING at any time; the PIC should reply with PONG
-with the same X as was in the PING message.  The host may not send
-another PING until the first one's PONG has come back.
+with the same X as was in the PING message, but with the bottom byte
+xor'd with 0x5a..  The host may not send another PING until the first
+one's PONG has come back.
 
 
 POLARITY
index 8f2595d227f1179f81391df680b6895c6acf92e3..48180f12a47eed274b815740758f0b776a61af6e 100644 (file)
@@ -179,7 +179,8 @@ command_ping
        mov_fw  POSTINC0
        mov_ff  INDF0, t
        call    serial_addbyte
-       mov_fw  t
+       mov_lw  0x5a
+       xor_wfw t
        bra_n   command_ping_bad
        goto    serial_addbyte_another
 
index 5232693f9fe1b8f976b69f96abfc9fbb3c4c7b3a..b4ff6935897d65b5c7f5e49a74347d461233fc07 100644 (file)
@@ -40,4 +40,6 @@ struct PicInsnInfo {
 
 extern const PicInsnInfo pic_command_infos[], pic_reply_infos[];
 
+#define PING_PONG_PATTERN 0x5a
+
 #endif /*AUPROTO_PIC_H*/