reverse.fin \
routines-led.fin \
serout.fin \
+ tick.fin \
vectors.fin \
VARSFILES= variables
include reverse.fin
include routines-led.fin
include serout.fin
+ include tick.fin
include variables+vars.fin
include vectors.fin
near_getwritebyteyes code
;----------------------------------------
-getwritebyte_yes
+i2c_getwritebyte_yes
pop ; we don't care where we were in i2cmu_write_next_byte
bc_f STATUS, Z ; yes, we want to write this byte
return ; from i2cmu_write_next_byte
;----------------------------------------
i2cmu_write_next_byte
; add calls to getwritebyte_<foo> here:
- call getwritebyte_polarity
- call getwritebyte_points
+ call polarity_getwritebyte
+ call points_getwritebyte
; end of list of calls to getwritebyte_<foo>
; so, no-one wants this slave:
bs_f STATUS, Z
mov_lw ste_size
add_wff cslot ; cslot -> next ste_flags
mov_lfsr slavetable, 1 ; FSR1H -> slavetable
- mov_fw cslot, FSR1L ; FSR1 -> new ste_flags
+ mov_ff cslot, FSR1L ; FSR1 -> new ste_flags
bt_f_if1 POSTDEC1, stf_sentinel ; FSR1 -> ste_slave
bra nextslave_looparound
; Anyone else to write to ?
; add calls to needwrite_<foo> here:
- call needwrite_polarity
- call needwrite_points
+ call polarity_needwrite
+ call points_needwrite
; end of list of calls to needwrite_<foo>
; no, if we're here, no-one wants to write
bra mascan_init_loop
; we've read the whole flash table
- if slavetable = 0x400
+ if slavetable == 0x400
bt_f_if1 FSR0H, 0
bra mascan_bad_toomany
endif
extern i2cm_intrl
+ extern mascan_init
extern loopback_read_byte
+ extern i2c_needwrite
+ extern i2c_consider_restartread
+ extern i2c_getwritebyte_yes
DB detect:message_buffer ; slave_add_short_message overrun
DF ::t ; slave pic2detinfo[0] invalid bits
DG ::t ; too many slaves in pic2detinfo
-DM ::buf0 : master has MM bit set in buf0
+DM ::buf0 ; master has MM bit set in buf0
# Messages for specific peripherals:
# R - Reversers (polarity)
extern point_local_do
extern points_local_init
extern points_local_intrl
+ extern points_needwrite
+ extern points_getwritebyte
extern cdu_init
extern got_pointed
mov_fw polarity_cmds ; there's always a board 0, us
call polarity_local_do
- rcall needwrite_polarity ; does `return' because it will find one
+ rcall polarity_needwrite ; does `return' because it will find one
return ; ... or maybe not if only 1 rev board
;----------
; need to set up polarity_cmds
;----------------------------------------------------------------------
-needwrite_polarity
+polarity_needwrite
; needwrite_<something> will see if we need to talk to a slave
; if not it will simply return
; if we _do_, it will put the slave no. in W, and then pop
near_getwritebyteyes code
;----------------------------------------------------------------------
-getwritebyte_polarity
+polarity_getwritebyte
; getwritebyte_<something> finds a byte to write to a particular
; slave. If we have something to write, puts the byte in W
; and does `goto getwritebyte_yes'. Otherwise simply returns.
; W undefined trashed byte for slave
;
mov_lfsr polarity_cmds, 0
- add_wf FSR0L
+ mov_fw cwslave
+ add_wff FSR0L
mov_fw INDF0
- bra_n getwritebyte_yes
+ bra_n i2c_getwritebyte_yes
; no:
return
extern command_polarity
extern polarity_local_do
extern polarity_local_init
+ extern polarity_master_init
+ extern polarity_needwrite
+ extern polarity_getwritebyte
serialtxfc_init
bs_f INTCON, RBIE
bc_f INTCON2, RBIP
- rcall porb_read
+ rcall portb_read
return
;----------------------------------------------------------------------
extern serial_addbyte
extern serial_addbyte_another
+ extern serialtx_intrl
+ extern serialtxfc_init
+ extern serialtxbuf_init
+ extern portb_read
--- /dev/null
+ extern ticker_intrl
bitnum2bit_section udata 0x0f8
bitnum2bit res 8 ; bitnum2bit[x] = 1<<x
-slavetable_section udata 0x400
+slavetable equ 0x400
+slavetable_section udata slavetable
; each board actually present has an entry in this table
ste_szln2 equ 3
ste_size equ (1<<ste_szln2)
-slavetable res maxpics * ste_size
+ res maxpics * ste_size
; each entry is a number of bytes, at these offsets:
ste_slave equ 0 ; Gk slave number