t03: adapted to latest changes.
This commit is contained in:
@@ -103,7 +103,8 @@ devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; v
|
|||||||
firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR
|
firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR
|
||||||
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
|
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
|
||||||
|
|
||||||
firmwareStart: rjmp main ; will be overwritten when flashing
|
firmwareStart:
|
||||||
|
rjmp main ; will be overwritten when flashing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -130,6 +131,7 @@ main:
|
|||||||
.include "modules/flash/eeprom.asm"
|
.include "modules/flash/eeprom.asm"
|
||||||
.include "modules/flash/io.asm"
|
.include "modules/flash/io.asm"
|
||||||
.include "modules/flash/io_uart1.asm"
|
.include "modules/flash/io_uart1.asm"
|
||||||
|
.include "modules/flash/flashxp.asm"
|
||||||
.include "modules/flash/flash4p.asm"
|
.include "modules/flash/flash4p.asm"
|
||||||
.include "modules/flash/flashprocess.asm"
|
.include "modules/flash/flashprocess.asm"
|
||||||
.include "modules/flash/wait.asm"
|
.include "modules/flash/wait.asm"
|
||||||
|
|||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
;.equ SEND_DEVICE_EVERY = 3000
|
;.equ SEND_DEVICE_EVERY = 3000
|
||||||
.equ SEND_DEVICE_EVERY = 3000 ; every 5mins
|
.equ SEND_DEVICE_EVERY = 3000 ; every 5mins
|
||||||
;.equ SEND_STATS_EVERY = 3100 ; about every 5mins
|
.equ SEND_STATS_EVERY = 3100 ; about every 5mins
|
||||||
.equ SEND_STATS_EVERY = 300 ; every 30s
|
;.equ SEND_STATS_EVERY = 300 ; every 30s
|
||||||
.equ SEND_DEBUG_EVERY = 110
|
;.equ SEND_DEBUG_EVERY = 110
|
||||||
|
|
||||||
|
;#define WITH_SEND_DEBUG
|
||||||
|
|
||||||
|
|
||||||
.nolist
|
.nolist
|
||||||
.include "include/tn841def.inc" ; Define device ATtiny841
|
.include "include/tn841def.inc" ; Define device ATtiny841
|
||||||
@@ -159,6 +162,14 @@ firmwareStart:
|
|||||||
|
|
||||||
sei
|
sei
|
||||||
main_loop:
|
main_loop:
|
||||||
|
rcall BaseTimer_Run
|
||||||
|
rcall TtyOnUart1_Run
|
||||||
|
rcall ComOnUart0_Run
|
||||||
|
|
||||||
|
; check incoming msg
|
||||||
|
rcall checkRecvdMsg
|
||||||
|
; rcall freeRecvdMsg
|
||||||
|
|
||||||
; only modify SE, SM1 and SM0
|
; only modify SE, SM1 and SM0
|
||||||
cli
|
cli
|
||||||
in r16, MCUCR
|
in r16, MCUCR
|
||||||
@@ -170,13 +181,6 @@ main_loop:
|
|||||||
sei ; make sure interrupts really are enabled
|
sei ; make sure interrupts really are enabled
|
||||||
sleep ; sleep, wait for interrupt
|
sleep ; sleep, wait for interrupt
|
||||||
|
|
||||||
rcall BaseTimer_Run
|
|
||||||
rcall TtyOnUart1_Run
|
|
||||||
rcall ComOnUart0_Run
|
|
||||||
|
|
||||||
; check incoming msg
|
|
||||||
rcall checkRecvdMsg
|
|
||||||
; rcall freeRecvdMsg
|
|
||||||
rjmp main_loop
|
rjmp main_loop
|
||||||
|
|
||||||
|
|
||||||
@@ -209,7 +213,9 @@ onSystemTimerTick:
|
|||||||
#endif
|
#endif
|
||||||
rcall TtyOnUart1_Periodically
|
rcall TtyOnUart1_Periodically
|
||||||
rcall ComOnUart0_Periodically
|
rcall ComOnUart0_Periodically
|
||||||
; rcall sendDebug
|
#ifdef WITH_SEND_DEBUG
|
||||||
|
rcall sendDebug
|
||||||
|
#endif
|
||||||
; rcall maybeSendDeviceMsg
|
; rcall maybeSendDeviceMsg
|
||||||
rcall maybeSendTStatsMsg
|
rcall maybeSendTStatsMsg
|
||||||
rcall maybeSendRStatsMsg
|
rcall maybeSendRStatsMsg
|
||||||
@@ -270,10 +276,12 @@ initModules:
|
|||||||
ldi r16, HIGH(SEND_STATS_EVERY+20)
|
ldi r16, HIGH(SEND_STATS_EVERY+20)
|
||||||
sts sendMStatsCounter+1, r16
|
sts sendMStatsCounter+1, r16
|
||||||
|
|
||||||
|
#ifdef WITH_SEND_DEBUG
|
||||||
ldi r16, LOW(SEND_DEBUG_EVERY)
|
ldi r16, LOW(SEND_DEBUG_EVERY)
|
||||||
sts debugMsgCounter, r16
|
sts debugMsgCounter, r16
|
||||||
ldi r16, HIGH(SEND_DEBUG_EVERY)
|
ldi r16, HIGH(SEND_DEBUG_EVERY)
|
||||||
sts debugMsgCounter+1, r16
|
sts debugMsgCounter+1, r16
|
||||||
|
#endif
|
||||||
|
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
@@ -303,6 +311,7 @@ initModules:
|
|||||||
.include "modules/network/iface.asm"
|
.include "modules/network/iface.asm"
|
||||||
.include "modules/network/msg/defs.asm"
|
.include "modules/network/msg/defs.asm"
|
||||||
.include "modules/network/msg/common.asm"
|
.include "modules/network/msg/common.asm"
|
||||||
|
.include "modules/network/msg/crc.asm"
|
||||||
.include "modules/network/msg/device-w.asm"
|
.include "modules/network/msg/device-w.asm"
|
||||||
.include "modules/network/msg/sendstats-w.asm"
|
.include "modules/network/msg/sendstats-w.asm"
|
||||||
.include "modules/network/msg/recvstats-w.asm"
|
.include "modules/network/msg/recvstats-w.asm"
|
||||||
@@ -500,7 +509,7 @@ checkRecvdMsg:
|
|||||||
rcall NET_Buffer_Locate ; (R17)
|
rcall NET_Buffer_Locate ; (R17)
|
||||||
ld r17, X
|
ld r17, X
|
||||||
andi r17, (NET_IFACE_BUFFER_IFACENUM1_BIT | NET_IFACE_BUFFER_IFACENUM0_BIT)
|
andi r17, (NET_IFACE_BUFFER_IFACENUM1_BIT | NET_IFACE_BUFFER_IFACENUM0_BIT)
|
||||||
rcall reverseInterfaceNum
|
rcall reverseInterfaceNum ; (R17)
|
||||||
; ldi r17, TTYONUART1_IFACENUM ; DEBUG: send everything to uart1 to test that code first
|
; ldi r17, TTYONUART1_IFACENUM ; DEBUG: send everything to uart1 to test that code first
|
||||||
rcall addMsgToInterface
|
rcall addMsgToInterface
|
||||||
brcc checkRecvdMsg_end ; could not add, jmp
|
brcc checkRecvdMsg_end ; could not add, jmp
|
||||||
@@ -557,7 +566,7 @@ addMsgToInterface_end:
|
|||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WITH_SEND_DEBUG
|
||||||
sendDebug:
|
sendDebug:
|
||||||
ldi yl, LOW(ttyOnUart1_iface)
|
ldi yl, LOW(ttyOnUart1_iface)
|
||||||
ldi yh, HIGH(ttyOnUart1_iface)
|
ldi yh, HIGH(ttyOnUart1_iface)
|
||||||
@@ -650,6 +659,7 @@ writeBufferInfoToRegs:
|
|||||||
ldd r18, Y+(1+3) ; source addr
|
ldd r18, Y+(1+3) ; source addr
|
||||||
writeBufferInfoToRegs_end:
|
writeBufferInfoToRegs_end:
|
||||||
ret
|
ret
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -730,7 +740,9 @@ programRamBegin:
|
|||||||
sendTStatsCounter: .byte 2
|
sendTStatsCounter: .byte 2
|
||||||
sendRStatsCounter: .byte 2
|
sendRStatsCounter: .byte 2
|
||||||
sendMStatsCounter: .byte 2
|
sendMStatsCounter: .byte 2
|
||||||
|
#ifdef WITH_SEND_DEBUG
|
||||||
debugMsgCounter: .byte 2
|
debugMsgCounter: .byte 2
|
||||||
|
#endif
|
||||||
programRamEnd:
|
programRamEnd:
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user