From ba8f755fb78a7e2ae5fe8bf73fdee439ddd0b196 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 31 Dec 2005 19:00:37 +0000 Subject: [PATCH] fixes from nye debugging --- detpic/energy.asm | 2 +- detpic/i2clib.asm | 21 ++++++++++++++------- detpic/make-panicworthy | 3 ++- detpic/mascan.asm | 16 ++++++++++++++++ detpic/points.asm | 6 +++++- detpic/program.asm | 19 +++++++++++++------ detpic/reverse.asm | 9 +++++---- 7 files changed, 56 insertions(+), 20 deletions(-) diff --git a/detpic/energy.asm b/detpic/energy.asm index e196fb0..7229d2b 100644 --- a/detpic/energy.asm +++ b/detpic/energy.asm @@ -121,7 +121,7 @@ command_power_on @ ; must be Off: pin_vl p0_booster_shutdown - D 0x60 + D 0x81 bt_f_if1 xdebug+6, 0 bs_f xdebug+6, 1 goto cdu_on diff --git a/detpic/i2clib.asm b/detpic/i2clib.asm index 633657d..ed70623 100644 --- a/detpic/i2clib.asm +++ b/detpic/i2clib.asm @@ -3,15 +3,16 @@ ; ; See i2clib.asm for documentation of the interface to this file. - include /usr/share/gputils/header/p18f458.inc - radix dec - include ../iwjpictest/insn-aliases.inc + ; include /usr/share/gputils/header/p18f458.inc + ; radix dec + ; include ../iwjpictest/insn-aliases.inc - include ../iwjpictest/clockvaries.inc - include panic.inc - include morse+auto.inc - include i2clib.incm + ; include ../iwjpictest/clockvaries.inc + ; include panic.inc + ; include morse+auto.inc + ; include i2clib.incm + include common.inc ;====================================================================== ; NOTATION @@ -112,11 +113,13 @@ i2cm_init ;---------- i2cm_interrupt + D 0x50 ;!P bt_f_if0 PIR1, SSPIF return ; We have an interrupt: ;... i2cm_interrupt_definite + D 0x51 ;!P mov_ff SSPSTAT, sspstat mov_ff SSPCON1, sspcon1 mov_ff SSPCON2, sspcon2 @@ -127,8 +130,12 @@ i2cm_interrupt_definite and_wfw sspcon1 bra_nz m_event_bad + mov_fw st ;!P + call debugbyte ;!P + ; No ? Well, then the I2C should be idle now: mov_fw sspcon2 + call debugbyte ;!P and_lw ~((1< here: + D 0x62 + mov_lfsr 0x5f+2, 0 + mov_fw INDF0 + call debugbyte call polarity_getwritebyte + D 0x63 + mov_lfsr 0x5f+2, 0 + mov_fw INDF0 + call debugbyte call points_getwritebyte + D 0x64 + mov_lfsr 0x5f+2, 0 + mov_fw INDF0 + call debugbyte ; end of list of calls to getwritebyte_ ; so, no-one wants this slave: bs_f STATUS, Z @@ -46,6 +61,7 @@ i2cmu_write_next_byte i2cm_intrl @ ; handles i2c interrupt using i2cm_interrupt[_definite], ; according to the rules for _intrl. + D 0x60 bt_f_if0 PIR1, SSPIF return call i2cm_interrupt_definite diff --git a/detpic/points.asm b/detpic/points.asm index 5ec694c..d3bc3e6 100644 --- a/detpic/points.asm +++ b/detpic/points.asm @@ -23,6 +23,7 @@ ; (according to CDU Enable LAT bit) cdu_timeout equ 200 ; ms +cdu_inittimeout equ 750 ; ms ptix2latbit equ 0x300 ; has to be a multiple of 0x100 ptix2latbit_section udata ptix2latbit @@ -356,7 +357,10 @@ cdu_init @ cdu_off @ cdu_panichook @ pin_l p0_cdu_enable -;... + mov_lw (cdu_inittimeout * 1000) / tickdiv_us + 1 + mov_wf cducharging + return + ;----- cdu_discharged mov_lw (cdu_timeout * 1000) / tickdiv_us + 1 diff --git a/detpic/program.asm b/detpic/program.asm index c4ea72d..8c1db57 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -78,22 +78,29 @@ master_init clr_f xdebug+0 return +boom3 + panic morse_TI3 + ;---------------------------------------- master_interrupt_low @ enter_interrupt_low D 0x80 + mov_lfsr 0x5f+2, 0 + mov_fw INDF0 + xor_lw 0x40 + bra_nz boom3 call tick_intrl - ;Dl 0x01 + D 0x01 call nmra_serialrx_intrl - ;Dl 0x02 + D 0x02 call power_fault_intrl - ;Dl 0x03 + D 0x03 call serialtxfc_intrl - ;Dl 0x04 + D 0x04 call serialtx_intrl - ;Dl 0x05 + D 0x05 call points_local_intrl - ;Dl 0x06 + D 0x06 call i2cm_intrl bs_f xdebug+0, 5 panic morse_IL diff --git a/detpic/reverse.asm b/detpic/reverse.asm index 678919a..725edfc 100644 --- a/detpic/reverse.asm +++ b/detpic/reverse.asm @@ -262,12 +262,13 @@ polarity_getwritebyte @ mov_lfsr polarity_cmds, 0 mov_fw cwslave add_wff FSR0L + bt_f_if0 INDF0, 7 + return + ; yes, we have something: + mov_fw INDF0 clr_f INDF0 ; we're about to write this - bra_n i2c_getwritebyte_yes - ; no: - bs_f xdebug+0, 7 - return + bra i2c_getwritebyte_yes ;====================================================================== include final.inc -- 2.30.2