chiark / gitweb /
move manipulation of flags_polarising into energy; debugging of this and of bugs...
authorian <ian>
Fri, 30 Dec 2005 03:03:02 +0000 (03:03 +0000)
committerian <ian>
Fri, 30 Dec 2005 03:03:02 +0000 (03:03 +0000)
detpic/energy.asm
detpic/i2clib.asm
detpic/program.asm
detpic/reverse.asm

index 5f3032cdaa998c50bf50b560a99cbecef60046fa..bb4c3f47f3fead1365b98423d487d49f777b546b 100644 (file)
@@ -47,22 +47,30 @@ power_polarising_begin @
        return
 
 ;--------------------
-power_polarising_settling @
+power_polarising_nonetodo @
 ; idempotent
+ bs_f xdebug+6, 2
+       bt_f_if0 flags, flags_polarising
+       return
+ bs_f xdebug+6, 3
        tst_f_ifnz settling
        return
        mov_lw  settling_timeout / tick_us
        mov_wf  settling
+ bs_f xdebug+6, 4
        return
 
 ;--------------------
 power_polarising_tick @
+ bs_f xdebug+6, 6
        tst_f_ifnz settling
        dec_f_ifnz settling ; decrement if not zero
        return ; return if not dec'd, or if decrement didn't make zero
        ; settle timeout complete:
 
+ bs_f xdebug+6, 7
        bc_f    flags, flags_polarising
+       pin_vh  p0_booster_pwm
        call    nmra_restartmessage
        bs_f    INTCON, TMR0IE ; reenables NMRA interrupt
        goto    i2c_consider_restartread
index efd3ae47b7a5f2bb7f7acec0512218a958e2c4b9..7c7fbdffa6dbdd7376aff810f4f205456091f5a1 100644 (file)
@@ -117,6 +117,7 @@ i2cm_interrupt
                ; We have an interrupt:
 ;...
 i2cm_interrupt_definite
+ bs_f xdebug+0, 5
                mov_ff  SSPSTAT, sspstat
                mov_ff  SSPCON1, sspcon1
                mov_ff  SSPCON2, sspcon2
@@ -169,6 +170,7 @@ m_start
 ;      W                       slave number            any
 ;      slave                   any                     slave_number
 ; expects to return directly to main program (caller)
+ bs_f xdebug+0, 2
                mov_wf  slave
                bs_f    SSPCON2, SEN
 m_start_or_restart
@@ -235,9 +237,7 @@ i2cm_write_start
 ;                              At call         On return
 ;   State                  Idle/Reading-Wait   Writing-Setup
 ;   W                          slave number    any
- mov_wf xdebug+3
- mov_ff st, xdebug+4
- set_f xdebug+5
+ bs_f xdebug+0, 1
                tst_f_ifnz st
                bra     m_write_start_busy
 
@@ -364,13 +364,11 @@ m_event_done_acking
                mov_fw  slave_next
                bra_z   m_stop
 ; ok, we want to read another:
- mov_wf xdebug+2
                mov_wf  slave
                clr_f   slave_next
                bt_f_if0 st, st_writing ; because of i2cm_write_start ?
                bs_f    st, st_reading ; no, then we will want to read
                bs_f    SSPCON2, RSEN
- set_f xdebug+0
                bra     m_start_or_restart
 
 ;----------
index 0126bdf2773214892f8ab085e5b635f194b3776b..ab538d4eb9cca482b9b71a528273a3d687a3af23 100644 (file)
@@ -83,6 +83,7 @@ master_init
        call    tick_init
        call    power_polarising_init
        call    power_fault_init
+ clr_f xdebug+0
        return
 
 ;----------------------------------------
@@ -91,10 +92,15 @@ master_interrupt_low @
        call    tick_intrl
        call    nmra_serialrx_intrl
        call    power_fault_intrl
+ mov_ff PIR1, xdebug+2
+ mov_ff PIE1, xdebug+3
+ mov_ff IPR1, xdebug+4
+ mov_ff INTCON, xdebug+5
        call    serialtxfc_intrl
        call    serialtx_intrl
        call    points_local_intrl
        call    i2cm_intrl
+ bs_f  xdebug+0, 5
        panic   morse_IL
 
 ;----------------------------------------------------------------------
index d0c40aa2eca237a036153acb1855ecb3eb8065ab..8c9040ee9b383b94b4f19f00f5faae39805d66de 100644 (file)
@@ -116,6 +116,8 @@ command_polarity @
 ;              and so on until f for bit 5.  (See polarity_do_here, below.)
 ;
 ; we accumulate (`gather') the `g' bits in t.
+ clr_f xdebug+0
+ clr_f xdebug+6
        mov_lfsr polarity_cmds, 1
        mov_fw  POSTINC0        ; W =           10010RRR
        mov_wf  t               ; t =           10010ggg
@@ -229,6 +231,7 @@ polarity_needwrite @
 ;    if we _do_, it will put the slave no. in W, and then pop
 ;     and branch to i2c_needwrite.  See mascan.asm.
 ;  nb register usage may need to be adjusted for wiring into mascan i2cm_...
+ bs_f xdebug+6, 0
        mov_lfsr polarity_cmds, 0
 polarity_needwrite_loop
        rlc_fw  PREINC0         ; W = 1RRRRRR? C=1  reverse command
@@ -240,11 +243,10 @@ polarity_needwrite_loop
        bra     polarity_needwrite_found
        ; we found the sentinel:
 
-       bt_f_if0 flags, flags_polarising
-       return
-       goto    power_polarising_settling
+       goto    power_polarising_nonetodo
 
 polarity_needwrite_found
+ bs_f xdebug+6, 1
        mov_fw  FSR0L
        add_lw  -polarity_cmds
        pop
@@ -268,6 +270,7 @@ polarity_getwritebyte @
        clr_f   INDF0 ; we're about to write this
        bra_n   i2c_getwritebyte_yes
        ; no:
+       bs_f xdebug+0, 7
        return
 
 ;======================================================================