From: ian Date: Sun, 1 Jan 2006 13:52:05 +0000 (+0000) Subject: remove various debugging junk: all uses of xdebug removed (but not the xdebug memory... X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=3072eaa5bd8270b67c56377111f241c787e48a05;p=trains.git remove various debugging junk: all uses of xdebug removed (but not the xdebug memory reservation); all mention of qq* removed; all debugging statements turned into calls to D macros or removed; D macros improved (from just D to Dv, Dl, Df); remove all D calls and debugging stuff from i2clib.asm; all uses of any morse_TI* removed (but definitions remain in morse.messages) --- diff --git a/detpic/common.inc b/detpic/common.inc index f54e818..116c007 100644 --- a/detpic/common.inc +++ b/detpic/common.inc @@ -122,11 +122,48 @@ tickdiv_us equ tick_us * tickdiv @ macro endm -D macro v - mov_lw v +;---------------------------------------- +; For adding a byte to the debug buffer. +; Not for use in High ISR. In all cases: +; +; STATUS any trashed +; all others any preserved + + ifndef NDEBUG +;---------- +Dv macro ; sorry, but assembler's dw directive isn't case-sensitive +; +; W message byte preserved +; call debugbyte endm +;---------- +Dl macro debug_literal_value +; +; W any literal value as specified +; + mov_lw debug_literal_value + Dv + endm + +;---------- +Df macro debug_register_file_address +; +; W any value from specified memory location +; + mov_fw debug_register_file_address + Dv + endm + else +Dv macro + endm +Dl macro debug_literal_value + endm +Df macro debug_register_file_address + endm + endif + ;---------------------------------------- ; For entering and leaving Low ISR, saving and restoring STATUS and W ; See above under _intrl, and {master,slave}_interrupt_low diff --git a/detpic/energy.asm b/detpic/energy.asm index 7229d2b..57ab317 100644 --- a/detpic/energy.asm +++ b/detpic/energy.asm @@ -121,9 +121,7 @@ command_power_on @ ; must be Off: pin_vl p0_booster_shutdown - D 0x81 - bt_f_if1 xdebug+6, 0 - bs_f xdebug+6, 1 + Dl 0x81 goto cdu_on ;---------- diff --git a/detpic/i2clib.asm b/detpic/i2clib.asm index ed70623..ebbf62d 100644 --- a/detpic/i2clib.asm +++ b/detpic/i2clib.asm @@ -3,16 +3,15 @@ ; ; 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 @@ -113,13 +112,11 @@ 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 @@ -130,12 +127,8 @@ 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 @@ -61,7 +47,7 @@ i2cmu_write_next_byte i2cm_intrl @ ; handles i2c interrupt using i2cm_interrupt[_definite], ; according to the rules for _intrl. - D 0x60 + Dl 0x90 bt_f_if0 PIR1, SSPIF return call i2cm_interrupt_definite @@ -81,13 +67,11 @@ i2cmu_read_got_byte ; W = received byte mov_wf b ; W = b = received byte - D 0x70 - mov_fw cslot - call debugbyte - mov_fw cbyte - call debugbyte - mov_fw b - call debugbyte + Dl 0x90 + Df cslot + Df cbyte + Df b ; also restores b to W + mov_lfsr slavetable, 1 mov_ff cslot, FSR1L ; FSR1 -> slave's flags @@ -105,7 +89,6 @@ read_got_first_detectors ; b = MdBBdddd mov_fw POSTINC1 ; W = detbasel; FSR1 -> lastd0 rcall read_got_detectbyte_prep ; b = 0d00dddd ; u = 0C00CCCC - ;mov_ff b, xdebug+5 bt_f_if1 b, 6 ; b bit .d...... bs_f b, 4 ; b = 0d0ddddd ; ^ ^ copies of same bit @@ -135,9 +118,6 @@ read_got_detectors_b1 ; b = dddddddd add_lw 5 ; W = adjdetbasel bs_f FSR1L, 2 ; FSR1L -> lastd1 bc_f cbyte, 4 ; cbyte = M0B00000 - mov_ff xdebug+4, xdebug+5 - mov_ff xdebug+3, xdebug+4 - mov_ff b, xdebug+3 rcall read_got_detectbyte_prep goto addmsgs_all @@ -168,12 +148,12 @@ read_got_detectbyte_prep_ifsomething ; FSR1 -> lastd ; mov_wf u ; u = [C0]* - D 0x74 - mov_fw FSR1L - call debugbyte - mov_fw u - call debugbyte - xor_wff INDF1 ; lastd = [d0]* + + Dl 0x74 + Df FSR1L + Df u ; also restores u to W + + xor_wff INDF1 ; lastd = [d0]* ; to force test of repeated detection notification, ; comment out previous line mov_lw 0x07 @@ -220,11 +200,10 @@ read_got_detectbyte_prep ; NOS return address for i2cmu_read_got_byte ; mov_wf t ; t = adjdetbasel - D 0x73 - mov_fw INDF1 - call debugbyte + Dl 0x73 + Df INDF1 mov_fw b ; W = [d0]* - call debugbyte + Dv xor_wfw INDF1 ; W = [C0]*, Z iff same ; where C set iff change to that detection segment bra_nz read_got_detectbyte_prep_ifsomething @@ -278,27 +257,18 @@ nextslave_nowrite bra nextslave_looparound ; Ok, we have a slave: - D 0x71 + Dl 0x91 mov_fw INDF1 ; W = new slave number goto i2cm_read_start nextslave_looparound - bt_f_if1 xdebug+6,2 - goto boom2 - - bt_f_if1 xdebug+6,1 - bs_f xdebug+6,2 - ; now we do our own detection mov_lw (slavetable + ste_flags) & 0xff ; select our own slot mov_wf cslot - D 0x72 + Dl 0x72 call read_detection_head_master goto i2cmu_read_got_byte -boom2 - panic morse_TI1 - ;---------------------------------------- i2c_needwrite @ ; Informs mascan that we need to write to some slave. @@ -490,11 +460,8 @@ addmsg_one ; TOS - 4 -> bt_f_if1 u, b'bbb' ; TOSL ???bbb00 ; other conditions on entry and exit as for entry to addmsgs_, above - ;dec_f_ifz xdebug+7 - ;bra boom - D 0x75 - mov_fw TOSL - call debugbyte + Dl 0x75 + Df TOSL rr_fw TOSL ; W = 0???bbb0 rr_w ; W = 00???bbb ior_lw 0xf8 ; W = 11111bbb @@ -510,19 +477,14 @@ addmsg_one bt_f_if0 STATUS, Z mov_lw 0x08 ; train: W = 0 000 0 000; none: W = 0 000 1 000 xor_wfw INDF1 ; W = 1 001 Y SSS (det msg high byte) - call debugbyte + Dv call serial_addbyte - ;bt_f_if1 xdebug+6, 0 - ;bra boom - mov_fw v ; W = 0 SSSSSSS (det msg low byte) - call debugbyte + Dv goto serial_addbyte_another addmsg_bad panic morse_DJ -boom - panic morse_TI5 ;====================================================================== include final.inc diff --git a/detpic/points.asm b/detpic/points.asm index d3bc3e6..ac50cff 100644 --- a/detpic/points.asm +++ b/detpic/points.asm @@ -369,7 +369,6 @@ cdu_discharged ;-------------------- cdu_on @ - clr_f xdebug+0 pin_h p0_cdu_enable return diff --git a/detpic/program.asm b/detpic/program.asm index 8c1db57..dfa21b9 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -59,8 +59,6 @@ master_init ; Master-specific initialisation. call memory_erase clr_f flags - set_f xdebug+7 - clr_f xdebug+6 call serial_init call i2cm_init call serialtxbuf_init @@ -75,34 +73,19 @@ master_init call power_polarising_init call power_fault_init call watchdog_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 + Dl 0x80 call tick_intrl - D 0x01 call nmra_serialrx_intrl - D 0x02 call power_fault_intrl - 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 ;---------------------------------------------------------------------- @@ -163,7 +146,6 @@ command_ping call serial_addbyte mov_fw t bra_n command_ping_bad - mov_wf xdebug+6 goto serial_addbyte_another command_ping_bad panic morse_HP diff --git a/detpic/variables.asm b/detpic/variables.asm index 302b805..95fbe32 100644 --- a/detpic/variables.asm +++ b/detpic/variables.asm @@ -31,22 +31,6 @@ xdebug res 8 cwslave res 1 ; slave we're currently actually writing to ; undefined except in _needwrite -qqtrislat_start equ 0x50 -qqtrislat_section udata qqtrislat_start -qqtrislat res 15 - -qqTRISA equ qqtrislat_start + 1 -qqTRISB equ qqtrislat_start + 2 -qqTRISC equ qqtrislat_start + 3 -qqTRISD equ qqtrislat_start + 4 -qqTRISE equ qqtrislat_start + 5 - -qqLATA equ qqtrislat_start + 7 -qqLATB equ qqtrislat_start + 8 -qqLATC equ qqtrislat_start + 9 -qqLATD equ qqtrislat_start + 0xa -qqLATE equ qqtrislat_start + 0xb - ;---------------------------------------------------------------------- ; NON-ACCESS-BANK SECTIONS (TABLES)