added more bigcall/bigjmp as we go along with larger code.

This commit is contained in:
Martin Preuss
2025-06-02 01:02:06 +02:00
parent 1f537849a9
commit 3582659018
8 changed files with 41 additions and 41 deletions

View File

@@ -124,7 +124,7 @@ AppNetwork_HandleMsg_handleRangeMsg:
rjmp AppNetwork_HandleMsg_clcRet
AppNetwork_HandleMsg_handleAddrMsg:
rcall NETMSG_Address_Read ; R18=cmd, R19=addr(R18, R19)
bigcall NETMSG_Address_Read ; R18=cmd, R19=addr(R18, R19)
mov r16, r18
subi r16, NETMSG_CMD_NEED_ADDRESS
ldi zl, LOW(appNetworkMsgTable)
@@ -175,18 +175,18 @@ appNetworkHandlePingRequest:
adiw xh:xl, NETMSG_OFFS_SRCADDR
ld r17, X
push r17
rcall NET_Buffer_Alloc ; (R16, R17, X)
bigcall NET_Buffer_Alloc ; (R16, R17, X)
pop r17
brcc appNetworkHandlePingRequest_end ; jmp on error
push r16 ; buffer num
mov r16, r17 ; DEST addr
brcc appNetworkHandlePingRequest_end ; jmp on error
push r16 ; buffer num
mov r16, r17 ; DEST addr
adiw xh:xl, 1
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
rcall NETMSG_Pong_Write ; (R16, R17, R18, R19, R20, X)
bigcall NETMSG_Pong_Write ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 1
pop r16 ; buffer num
rcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
pop r16 ; buffer num
bigcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
appNetworkHandlePingRequest_end:
ret
@@ -393,16 +393,16 @@ appNetworkHandleMsgDenyAddr_end:
; @clobbers R16 (R17, R18, R19, R20, R21, X)
appNetworkSendAddrMsg:
rcall NET_Buffer_Alloc ; (R16, R17, X)
bigcall NET_Buffer_Alloc ; (R16, R17, X)
brcc appNetworkSendAddrMsg_end
adiw xh:xl, 1
push r16
rcall NETMSG_Address_Write ; (R16, R17, R18, R19, R20, R21)
bigcall NETMSG_Address_Write ; (R16, R17, R18, R19, R20, R21)
pop r16
sbiw xh:xl, 1
rcall NET_Interface_AddOutgoingMsgNum ; (R17, R18, X)
bigcall NET_Interface_AddOutgoingMsgNum ; (R17, R18, X)
brcs appNetworkSendAddrMsg_end
rcall NET_Buffer_ReleaseByNum ; (R16, X)
bigcall NET_Buffer_ReleaseByNum ; (R16, X)
clc
appNetworkSendAddrMsg_end:
ret

View File

@@ -18,14 +18,14 @@
; @clobbers R16, X (R17, R18, R19, R20, R21, Z)
AppNetwork_SendTxdStats:
rcall NET_Buffer_Alloc ; (R16, R17, X)
bigcall NET_Buffer_Alloc ; (R16, R17, X)
brcc AppNetwork_SendTxdStats_end
push r16
adiw xh:xl, 1
rcall NETMSG_SendStats_Write ; (R16, R17, R18, R19, R20, R21, Z)
bigcall NETMSG_SendStats_Write ; (R16, R17, R18, R19, R20, R21, Z)
sbiw xh:xl, 1
pop r16
rcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
bigcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
AppNetwork_SendTxdStats_end:
ret
; @end
@@ -39,14 +39,14 @@ AppNetwork_SendTxdStats_end:
; @clobbers R16, X (R17, R18, R19, R20, R21, Z)
AppNetwork_SendRxdStats:
rcall NET_Buffer_Alloc ; (R16, R17, X)
bigcall NET_Buffer_Alloc ; (R16, R17, X)
brcc AppNetwork_SendRxdStats_end
push r16
adiw xh:xl, 1
rcall NETMSG_RecvStats_Write ; (R16, R17, R18, R19, R20, R21, Z)
bigcall NETMSG_RecvStats_Write ; (R16, R17, R18, R19, R20, R21, Z)
sbiw xh:xl, 1
pop r16
rcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
bigcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
AppNetwork_SendRxdStats_end:
ret
; @end
@@ -60,14 +60,14 @@ AppNetwork_SendRxdStats_end:
; @clobbers R16, X (R17, R18, R19, R20, R21, Z)
AppNetwork_SendMemStats:
rcall NET_Buffer_Alloc ; (R16, R17, X)
bigcall NET_Buffer_Alloc ; (R16, R17, X)
brcc AppNetwork_SendMemStats_end
push r16
adiw xh:xl, 1
rcall NETMSG_MemStats_Write ; (R16, R17, R18, R19, R20, R21)
bigcall NETMSG_MemStats_Write ; (R16, R17, R18, R19, R20, R21)
sbiw xh:xl, 1
pop r16
rcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
bigcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
AppNetwork_SendMemStats_end:
ret
; @end
@@ -81,14 +81,14 @@ AppNetwork_SendMemStats_end:
; @clobbers R16, X (R17, R18, R19, R20, R21, Z)
AppNetwork_SendDevice:
rcall NET_Buffer_Alloc ; (R16, R17, X)
bigcall NET_Buffer_Alloc ; (R16, R17, X)
brcc AppNetwork_SendDevice_end
push r16
adiw xh:xl, 1
rcall NETMSG_Device_Write ; (R16, R17, R18, R19, R20, R21, Z)
bigcall NETMSG_Device_Write ; (R16, R17, R18, R19, R20, R21, Z)
sbiw xh:xl, 1
pop r16
rcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
bigcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
AppNetwork_SendDevice_end:
ret
; @end

View File

@@ -25,13 +25,13 @@ NETMSG_Device_Write:
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
ldi zh, HIGH(devInfoBlock*2) ; 6-17: devInfoBlock
ldi zl, LOW(devInfoBlock*2)
ldi r18, 12
bigcall Utils_CopyFromFlash ; (R17, R18, X, Z)
sbiw xh:xl, 20 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
bigcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 21 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload, 1 byte crc)
ret
; @end

View File

@@ -27,7 +27,7 @@ NETMSG_MemStats_Write:
st X+, r16 ; src address
; uid
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
; timestamp (0 for now)
clr r16
st X+, r16
@@ -53,7 +53,7 @@ NETMSG_MemStats_Write:
; current buffers used
push xl
push xh
rcall NET_Buffer_CountUsed ; (r16, r17, r18, X)
bigcall NET_Buffer_CountUsed ; (r16, r17, r18, X)
pop xh
pop xl
st X+, r16
@@ -67,7 +67,7 @@ NETMSG_MemStats_Write:
st X+, r16
sbiw xh:xl, 18 ; go back to beginning of message (1 byte dst addr, 1 byte length, 16 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
bigcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 19 ; go back to beginning of message (1 byte dst addr, 1 byte length, 16 bytes payload, 1 byte crc)
ret
; @end

View File

@@ -18,17 +18,17 @@
; @clobbers R16 (R17, R18, R19, R20, R21, Z)
NETMSG_Pong_Write:
st X+, r16 ; dest address
ldi r16, 6 ; msg code+src address+4 payload bytes
st X+, r16 ; msg len
st X+, r16 ; dest address
ldi r16, 6 ; msg code+src address+4 payload bytes
st X+, r16 ; msg len
ldi r16, NETMSG_CMD_PONG
st X+, r16 ; msg code
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
st X+, r16 ; src address
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
sbiw xh:xl, 8 ; go back to beginning of message (1 byte dst addr, 1 byte length, 6 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
bigcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 9 ; go back to beginning of message (1 byte dst addr, 1 byte length, 6 bytes payload, 1 byte crc)
ret
; @end

View File

@@ -31,7 +31,7 @@ NETMSG_RebootRequestRead:
push xl
push xh
adiw xh:xl, NETMSG_REBOOTREQ_OFFS_UID
rcall NETMSG_CheckUidInMsg ; (r16, r18, r19, r20, r21, X)
bigcall NETMSG_CheckUidInMsg ; (r16, r18, r19, r20, r21, X)
pop xh
pop xl
pop r16

View File

@@ -25,14 +25,14 @@ NETMSG_RecvStats_Write:
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
adiw yh:yl, NET_IFACE_OFFS_PACKETSIN_LOW
ldi r18, 12
bigcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
sbiw yh:yl, NET_IFACE_OFFS_PACKETSIN_LOW+12
sbiw xh:xl, 20 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
bigcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 21 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload, 1 byte crc)
ret
; @end

View File

@@ -25,14 +25,14 @@ NETMSG_SendStats_Write:
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
adiw yh:yl, NET_IFACE_OFFS_PACKETSOUT_LOW
ldi r18, 6
bigcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
sbiw yh:yl, NET_IFACE_OFFS_PACKETSOUT_LOW+6
sbiw xh:xl, 14 ; go back to beginning of message (1 byte dst addr, 1 byte length, 12 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
bigcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 15 ; go back to beginning of message (1 byte dst addr, 1 byte length, 12 bytes payload, 1 byte crc)
ret
; @end