com2wi2: test with two interfaces.
This commit is contained in:
@@ -85,6 +85,9 @@
|
||||
|
||||
rcall NET_Interface_Init ; (R16, R17, X)
|
||||
|
||||
ldi r16, @0 +1
|
||||
std Y+NET_IFACE_OFFS_IFACENUM, r16
|
||||
|
||||
ldi r16, COM_MASK_CLK@0
|
||||
std Y+COM2WI_IFACE_OFFS_PINMASK_CLK, r16
|
||||
ldi r16, COM_MASK_DATA@0
|
||||
@@ -103,7 +106,37 @@
|
||||
|
||||
|
||||
|
||||
.if COM_PORTS >0
|
||||
com2wi0_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >1
|
||||
com2wi1_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >2
|
||||
com2wi2_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >3
|
||||
com2wi3_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >4
|
||||
com2wi4_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >5
|
||||
com2wi5_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >6
|
||||
com2wi6_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >7
|
||||
com2wi7_iface: .byte COM2WI_IFACE_SIZE
|
||||
.endif
|
||||
|
||||
|
||||
|
||||
@@ -115,7 +148,34 @@ com2wi0_iface: .byte COM2WI_IFACE_SIZE
|
||||
; @routine COM2WI_Init
|
||||
|
||||
COM2WI_Init:
|
||||
.if COM_PORTS >0
|
||||
mCOM2WI_INIT 0
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >1
|
||||
mCOM2WI_INIT 1
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >2
|
||||
mCOM2WI_INIT 2
|
||||
.endif
|
||||
.if COM_PORTS >3
|
||||
mCOM2WI_INIT 3
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >4
|
||||
mCOM2WI_INIT 4
|
||||
.endif
|
||||
.if COM_PORTS >5
|
||||
mCOM2WI_INIT 5
|
||||
.endif
|
||||
|
||||
.if COM_PORTS >6
|
||||
mCOM2WI_INIT 6
|
||||
.endif
|
||||
.if COM_PORTS >7
|
||||
mCOM2WI_INIT 7
|
||||
.endif
|
||||
|
||||
rcall com2wiSetupTimer1
|
||||
ret
|
||||
@@ -141,9 +201,7 @@ COM2WI_Timer1Isr:
|
||||
push yh
|
||||
push zl
|
||||
push zh
|
||||
ldi yl, LOW(com2wi0_iface)
|
||||
ldi yh, HIGH(com2wi0_iface)
|
||||
rcall com2wiHandleIrq ; (r16, r17, Z)
|
||||
rcall COM2WI_HandleTimerIrq ; (r16, r17, r18, Y, Z)
|
||||
pop zh
|
||||
pop zl
|
||||
pop yh
|
||||
@@ -164,7 +222,53 @@ COM2WI_Timer1Isr:
|
||||
COM2WI_Run:
|
||||
ldi yl, LOW(com2wi0_iface)
|
||||
ldi yh, HIGH(com2wi0_iface)
|
||||
rcall com2wiRun
|
||||
ldi r18, COM_PORTS
|
||||
clr r19
|
||||
COM2WI_Run_loop:
|
||||
push r18
|
||||
push r19
|
||||
rcall com2wiRun
|
||||
pop r19
|
||||
pop r18
|
||||
sbci r19, 0
|
||||
ldi r16, COM2WI_IFACE_SIZE
|
||||
add yl, r16
|
||||
adc yh, r16
|
||||
sub yh, r16
|
||||
dec r18
|
||||
brne COM2WI_Run_loop
|
||||
|
||||
; check for repeat request
|
||||
tst r19
|
||||
clc
|
||||
breq COM2WI_Run_end
|
||||
sec
|
||||
COM2WI_Run_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine COM2WI_HandleTimerIrq
|
||||
;
|
||||
; @param Y pointer to interface data in SRAM
|
||||
; @clobbers R16, R17, R18, Y, Z
|
||||
|
||||
COM2WI_HandleTimerIrq:
|
||||
ldi yl, LOW(com2wi0_iface)
|
||||
ldi yh, HIGH(com2wi0_iface)
|
||||
ldi r18, COM_PORTS
|
||||
COM2WI_HandleTimerIrq_loop:
|
||||
push r18
|
||||
rcall com2wiHandleIrq ; R16, R17, R18, Z
|
||||
pop r18
|
||||
ldi r16, COM2WI_IFACE_SIZE
|
||||
add yl, r16
|
||||
adc yh, r16
|
||||
sub yh, r16
|
||||
dec r18
|
||||
brne COM2WI_HandleTimerIrq_loop
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -349,6 +453,7 @@ com2wiDataSetLow:
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine com2wiHandleIrq
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user