From e82207a9f66827e0703e3954dca9de7d3bdb2b7a Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 30 Dec 2005 13:30:42 +0000 Subject: [PATCH] watchdog seems to work; fix up memory clearing too --- detpic/mascan.asm | 2 +- detpic/morse.messages | 5 +++++ detpic/nmra-stream.asm | 4 ++-- detpic/program.asm | 30 +++++++++++------------------- detpic/serout.asm | 2 +- detpic/watchdog.asm | 7 +++++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/detpic/mascan.asm b/detpic/mascan.asm index f1b783a..62e4397 100644 --- a/detpic/mascan.asm +++ b/detpic/mascan.asm @@ -234,7 +234,7 @@ nextslave_nowrite mov_lfsr slavetable, 1 ; FSR1H -> slavetable mov_ff cslot, FSR1L ; FSR1 -> new ste_flags - panic morse_TI3 + return bt_f_if1 POSTDEC1, stf_sentinel ; FSR1 -> ste_slave bra nextslave_looparound ; Ok, we have a slave: diff --git a/detpic/morse.messages b/detpic/morse.messages index a1a81e5..3966c7b 100644 --- a/detpic/morse.messages +++ b/detpic/morse.messages @@ -17,11 +17,16 @@ # Temporary entries for testing and development TM PIE1,SSPSTAT,SSPCON1,SSPCON2 ; Master got I2C interrupt +TI0 ; for iwj TI1 ; for iwj TI2 ; for iwj TI3 ; for iwj TI4 ; for iwj TI5 ; for iwj +TI6 ; for iwj +TI7 ; for iwj +TI8 ; for iwj +TI9 ; for iwj # Main message listing. Kept sorted by section for easy reference. # ----------------------------------------------------------------- diff --git a/detpic/nmra-stream.asm b/detpic/nmra-stream.asm index 6caea1e..0421bfd 100644 --- a/detpic/nmra-stream.asm +++ b/detpic/nmra-stream.asm @@ -212,8 +212,8 @@ nmra_restartmessage @ ; Entrypoint from power_polarising_tick, at end ;**************************************************************************** nmra_sendwatchdog_start @ - mov_lw 0x40 - mov_wf totrack + mov_lw 0x40 ; if we were in a message it's going to get + mov_wf totrack ; garbled; oh well. return nmra_sendwatchdog_stop @ diff --git a/detpic/program.asm b/detpic/program.asm index 6ea0d85..239e209 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -9,24 +9,10 @@ ;---------------------------------------- vector_reset @ - - set_f qqTRISA - set_f qqTRISB - set_f qqTRISC - set_f qqTRISD - set_f qqTRISE - mov_lw 0xaa - mov_wf qqLATA - mov_wf qqLATB - mov_wf qqLATC - mov_wf qqLATD - mov_wf qqLATE - clr_f INTCON bs_f RCON, IPEN ; interrupt priorities call idlocs_init - clr_f flags bt_f_if0 idloc1,idloc1_master call slave_init @@ -72,6 +58,7 @@ intrl_handled_routine @ master_init ; Master-specific initialisation. call memory_erase + clr_f flags call serial_init call i2cm_init call serialtxbuf_init @@ -92,16 +79,19 @@ master_init ;---------------------------------------- master_interrupt_low @ enter_interrupt_low + D 0x80 call tick_intrl + D 0x01 call nmra_serialrx_intrl + D 0x02 call power_fault_intrl - mov_ff PIR1, xdebug+2 - mov_ff PIE1, xdebug+3 - mov_ff IPR1, xdebug+4 - mov_ff INTCON, xdebug+5 + D 0x03 call serialtxfc_intrl + D 0x04 call serialtx_intrl + D 0x05 call points_local_intrl + D 0x06 call i2cm_intrl bs_f xdebug+0, 5 panic morse_IL @@ -137,7 +127,7 @@ serialrx_if_multibyte goto serialrx_bad ; 1 0000 xxx goto command_ping ; 1 0001 xxx goto command_polarity ; 1 0010 xxx - goto serialrx_bad ; 1 0011 xxx + goto command_watchdog ; 1 0011 xxx goto command_point ; 1 0100 xxx goto serialrx_bad ; 1 0101 xxx goto serialrx_bad ; 1 0110 xxx @@ -174,6 +164,8 @@ command_ping_bad panic morse_HP ;---------------------------------------- slave_init ; Slave-specific initialisation. + clr_f flags + mov_fw picno call i2cs_init diff --git a/detpic/serout.asm b/detpic/serout.asm index 85da2c7..f017701 100644 --- a/detpic/serout.asm +++ b/detpic/serout.asm @@ -111,7 +111,7 @@ serialtx_intrl @ bra_z tx_bufempty mov_fw INDF0 - xor_lw 0x02 + xor_lw 0xbb bra_z boo mov_fw INDF0 mov_wf TXREG diff --git a/detpic/watchdog.asm b/detpic/watchdog.asm index f0abe6c..f4b34a4 100644 --- a/detpic/watchdog.asm +++ b/detpic/watchdog.asm @@ -12,9 +12,9 @@ command_watchdog @ mov_fw POSTINC0 ; W = 10011OOO and_lw 0x07 ; W = 00000OOO bra_nz command_watchdog_bad - mov_wf INDF0 ; W = OMMMMMMM + mov_fw INDF0 ; W = OMMMMMMM bra_n command_watchdog_bad - mov_fw watchdog ; watchdog = OMMMMMMM + mov_wf watchdog ; watchdog = OMMMMMMM goto nmra_sendwatchdog_stop command_watchdog_bad panic morse_WX @@ -23,6 +23,7 @@ command_watchdog_bad panic morse_WX watchdog_tickdiv @ tst_f_ifnz watchdog dec_f_ifnz watchdog + return ; oops, we've timed out call nmra_sendwatchdog_start @@ -39,6 +40,8 @@ wdog_byte macro v mov_wf POSTINC1 endm + ; An extra idle byte: + set_f POSTINC1 ; ff ; Baseline Broadcast stop Forwards(I) non-Emergency S9.2 B l.98- ; as computed by ./hostside-old -st bstop set_f POSTINC1 ; ff -- 2.30.2