From e9f47c4d08b46b7de3c5e04bbb97ab59be41dc35 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 5 Jan 2006 00:36:46 +0000 Subject: [PATCH] actually implement crash reset protocol correctly --- cebpic/README.protocol | 2 ++ detpic/panic.asm | 22 +++++++++++++++++++--- detpic/program.asm | 9 ++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/cebpic/README.protocol b/cebpic/README.protocol index 42caca3..3c923e7 100644 --- a/cebpic/README.protocol +++ b/cebpic/README.protocol @@ -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: ; diff --git a/detpic/panic.asm b/detpic/panic.asm index 12705cb..bc250d4 100644 --- a/detpic/panic.asm +++ b/detpic/panic.asm @@ -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 diff --git a/detpic/program.asm b/detpic/program.asm index 4f8c3aa..a2b904c 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -91,6 +91,11 @@ master_interrupt_low @ ;---------------------------------------------------------------------- serialrx_table_section code 0x2000 +;-------------------- +command_tellmode + mov_lw 0x09 + goto serial_addbyte + ;-------------------- serialrx_generalmsg @ ;command_ 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 ;----- -- 2.30.2