com2wi2: test with two interfaces.
This commit is contained in:
@@ -11,7 +11,8 @@
|
|||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; defines
|
; defines
|
||||||
|
|
||||||
.equ APP_STATS_INTERVAL_MINS = 30
|
;.equ APP_STATS_INTERVAL_MINS = 30
|
||||||
|
.equ APP_STATS_INTERVAL_MINS = 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -74,18 +75,20 @@ AppStats_OnEveryMinute_store:
|
|||||||
andi r17, 3
|
andi r17, 3
|
||||||
brne AppStats_OnEveryMinute_sendStats
|
brne AppStats_OnEveryMinute_sendStats
|
||||||
; send device announcement
|
; send device announcement
|
||||||
push yl
|
push r16
|
||||||
push yh
|
push yl
|
||||||
ldi yl, LOW(netInterfaceData)
|
push yh
|
||||||
ldi yh, HIGH(netInterfaceData)
|
ldi yl, LOW(netInterfaceData)
|
||||||
rcall AppNetwork_SendDevice
|
ldi yh, HIGH(netInterfaceData)
|
||||||
|
rcall AppNetwork_SendDevice
|
||||||
#ifdef APP_STATS_NETDEV2
|
#ifdef APP_STATS_NETDEV2
|
||||||
ldi yl, LOW(netInterfaceData2)
|
ldi yl, LOW(netInterfaceData2)
|
||||||
ldi yh, HIGH(netInterfaceData2)
|
ldi yh, HIGH(netInterfaceData2)
|
||||||
rcall AppNetwork_SendDevice
|
rcall AppNetwork_SendDevice
|
||||||
#endif
|
#endif
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
|
pop r16
|
||||||
AppStats_OnEveryMinute_sendStats:
|
AppStats_OnEveryMinute_sendStats:
|
||||||
cpi r16, 2
|
cpi r16, 2
|
||||||
breq AppStats_OnEveryMinute_sendMemStats
|
breq AppStats_OnEveryMinute_sendMemStats
|
||||||
@@ -106,6 +109,8 @@ AppStats_OnEveryMinute_sendStats:
|
|||||||
; add more here
|
; add more here
|
||||||
ret
|
ret
|
||||||
AppStats_OnEveryMinute_sendMemStats:
|
AppStats_OnEveryMinute_sendMemStats:
|
||||||
|
ldi yl, LOW(netInterfaceData)
|
||||||
|
ldi yh, HIGH(netInterfaceData)
|
||||||
rjmp AppNetwork_SendMemStats
|
rjmp AppNetwork_SendMemStats
|
||||||
|
|
||||||
AppStats_OnEveryMinute_sendRecvStats1:
|
AppStats_OnEveryMinute_sendRecvStats1:
|
||||||
|
|||||||
@@ -133,9 +133,16 @@
|
|||||||
.equ COM_MASK_IRQ7 = (1<<PCINT7)
|
.equ COM_MASK_IRQ7 = (1<<PCINT7)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
.equ COM_PORTS = 2
|
||||||
|
|
||||||
.equ COM_MASK_CLK0 = (1<<PINA6)
|
.equ COM_MASK_CLK0 = (1<<PINA6)
|
||||||
.equ COM_MASK_DATA0 = (1<<PINC6)
|
.equ COM_MASK_DATA0 = (1<<PINC6)
|
||||||
.equ COM_MASK_IRQ0 = (1<<PCINT6)
|
.equ COM_MASK_IRQ0 = (1<<PCINT6)
|
||||||
|
|
||||||
|
.equ COM_MASK_CLK1 = (1<<PINA5)
|
||||||
|
.equ COM_MASK_DATA1 = (1<<PINC5)
|
||||||
|
.equ COM_MASK_IRQ1 = (1<<PCINT5)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
; firmware settings including list of modules used
|
; firmware settings including list of modules used
|
||||||
|
|
||||||
;#define MAIN_WITHOUT_MSG_HANDLING ; message handling done here
|
;#define MAIN_WITHOUT_MSG_HANDLING ; message handling done here
|
||||||
;#define APP_STATS_NETDEV2
|
#define APP_STATS_NETDEV2
|
||||||
#define COM_ACCEPT_ALL_DEST ; accept all messages!
|
#define COM_ACCEPT_ALL_DEST ; accept all messages!
|
||||||
|
|
||||||
; #define MODULES_TIMER
|
; #define MODULES_TIMER
|
||||||
@@ -240,8 +240,8 @@ onEveryLoop:
|
|||||||
|
|
||||||
;.equ netInterfaceData = netUartIface
|
;.equ netInterfaceData = netUartIface
|
||||||
;.equ netInterfaceData = uart_bitbang_iface
|
;.equ netInterfaceData = uart_bitbang_iface
|
||||||
.equ netInterfaceData = com2wi0_iface
|
.equ netInterfaceData = com2wi0_iface
|
||||||
;.equ netInterfaceData2 = com2w5_iface
|
.equ netInterfaceData2 = com2wi1_iface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,9 @@
|
|||||||
|
|
||||||
rcall NET_Interface_Init ; (R16, R17, X)
|
rcall NET_Interface_Init ; (R16, R17, X)
|
||||||
|
|
||||||
|
ldi r16, @0 +1
|
||||||
|
std Y+NET_IFACE_OFFS_IFACENUM, r16
|
||||||
|
|
||||||
ldi r16, COM_MASK_CLK@0
|
ldi r16, COM_MASK_CLK@0
|
||||||
std Y+COM2WI_IFACE_OFFS_PINMASK_CLK, r16
|
std Y+COM2WI_IFACE_OFFS_PINMASK_CLK, r16
|
||||||
ldi r16, COM_MASK_DATA@0
|
ldi r16, COM_MASK_DATA@0
|
||||||
@@ -103,7 +106,37 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.if COM_PORTS >0
|
||||||
com2wi0_iface: .byte COM2WI_IFACE_SIZE
|
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
|
; @routine COM2WI_Init
|
||||||
|
|
||||||
COM2WI_Init:
|
COM2WI_Init:
|
||||||
|
.if COM_PORTS >0
|
||||||
mCOM2WI_INIT 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
|
rcall com2wiSetupTimer1
|
||||||
ret
|
ret
|
||||||
@@ -141,9 +201,7 @@ COM2WI_Timer1Isr:
|
|||||||
push yh
|
push yh
|
||||||
push zl
|
push zl
|
||||||
push zh
|
push zh
|
||||||
ldi yl, LOW(com2wi0_iface)
|
rcall COM2WI_HandleTimerIrq ; (r16, r17, r18, Y, Z)
|
||||||
ldi yh, HIGH(com2wi0_iface)
|
|
||||||
rcall com2wiHandleIrq ; (r16, r17, Z)
|
|
||||||
pop zh
|
pop zh
|
||||||
pop zl
|
pop zl
|
||||||
pop yh
|
pop yh
|
||||||
@@ -164,7 +222,53 @@ COM2WI_Timer1Isr:
|
|||||||
COM2WI_Run:
|
COM2WI_Run:
|
||||||
ldi yl, LOW(com2wi0_iface)
|
ldi yl, LOW(com2wi0_iface)
|
||||||
ldi yh, HIGH(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
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -349,6 +453,7 @@ com2wiDataSetLow:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine com2wiHandleIrq
|
; @routine com2wiHandleIrq
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user