chiark / gitweb /
actually implement crash reset protocol correctly
authorian <ian>
Thu, 5 Jan 2006 00:36:46 +0000 (00:36 +0000)
committerian <ian>
Thu, 5 Jan 2006 00:36:46 +0000 (00:36 +0000)
cebpic/README.protocol
detpic/panic.asm
detpic/program.asm

index 42caca3cc3ea5182359667025061037600279a36..3c923e7d9bbdade7bf18aad507408cf015fdb31b 100644 (file)
@@ -24,6 +24,8 @@ From host to PIC:
  > 0 0010 000             (10) OFF       Power off
 
  > 00000000                     CRASHED   Acknowledge panic, go to readout mode
+ > 00001002               (0a) TELLMODE  Confirm mode - say HELLO or CRASHED
+                                           if crashed, undoes the effect of ack
 
 ; In crash readout mode:
 ;
index 12705cb5ac94357ca8a4d7fddcc630c44646c139..bc250d484b93866015c325c1220df0f95093c707 100644 (file)
@@ -428,7 +428,7 @@ panicd_process_input_byte
 ;----------
 write_ifnot_00
        bt_f_if0 panicst, panicst_acked ; well, ignore that !
-       return
+       bra     write_only_tellmode
        ; OK, we have an instruction:
 
        bt_w_if1 7 ; huh?
@@ -445,10 +445,15 @@ write_ifnot_00
        bra     write_if_master_masterread
        bt_w_if0 3
        bra     write_if_master_slaveread
-
+;...
 write_ifnot0_ifnotmaster
        xor_lw  0x09
        bra_z   panic_reset
+       xor_lw  0x09
+;...
+write_only_tellmode
+       xor_lw  0x0a
+       bra_z   panic_tellmode
        ; nope, well, we ignore it
        return
 
@@ -469,10 +474,21 @@ panic_crashread_setpointer
 panic_noop
        return
 
-;======================================================================
+;======================================================================#
+; SPECIAL COMMANDS 0x08..0x0f
+
+;----------
 panic_reset
        reset
 
+;----------
+panic_tellmode
+       bt_f_if0 idloc1,idloc1_master
+       return
+       mov_lw  0x0b
+       bc_f    panicst, panicst_acked
+       goto    serial_write_char
+
 ;======================================================================
 ; MASTER READOUT AND MASTER READOUT OF SLAVES
 
index 4f8c3aaba481b0bee47381689e790dd877392c83..a2b904c74b07912e270200dca881c1783862abac 100644 (file)
@@ -91,6 +91,11 @@ master_interrupt_low @
 ;----------------------------------------------------------------------
 serialrx_table_section code    0x2000
 
+;--------------------
+command_tellmode
+       mov_lw  0x09
+       goto    serial_addbyte
+
 ;--------------------
 serialrx_generalmsg @
 ;command_<something>  has same calling convention:
@@ -104,8 +109,10 @@ serialrx_generalmsg @
 
        xor_lw  0x11
        bra_z   command_power_on
-       xor_lw  0x01
+       xor_lw  0x10 ^ 0x11
        bra_z   command_power_off
+       xor_lw  0x0a ^ 0x10
+       bra_z   command_tellmode
        bra     serialrx_bad
 
 ;-----