apps/network: implemented ping request.
This commit is contained in:
@@ -111,6 +111,8 @@ AppNetwork_HandleMsg:
|
|||||||
sbiw xh:xl, NETMSG_OFFS_CMD
|
sbiw xh:xl, NETMSG_OFFS_CMD
|
||||||
cpi r16, NETMSG_CMD_REBOOT_REQUEST
|
cpi r16, NETMSG_CMD_REBOOT_REQUEST
|
||||||
breq AppNetwork_HandleMsg_handleRebootMsg
|
breq AppNetwork_HandleMsg_handleRebootMsg
|
||||||
|
cpi r16, NETMSG_CMD_PING
|
||||||
|
breq AppNetwork_HandleMsg_handlePingMsg
|
||||||
cpi r16, NETMSG_CMD_NEED_ADDRESS
|
cpi r16, NETMSG_CMD_NEED_ADDRESS
|
||||||
brcs AppNetwork_HandleMsg_clcRet ; lower than "HAVE_NEED"
|
brcs AppNetwork_HandleMsg_clcRet ; lower than "HAVE_NEED"
|
||||||
cpi r16, NETMSG_CMD_ADDRESS_RANGE
|
cpi r16, NETMSG_CMD_ADDRESS_RANGE
|
||||||
@@ -138,6 +140,13 @@ AppNetwork_HandleMsg_handleRebootMsg:
|
|||||||
pop xh
|
pop xh
|
||||||
pop xl
|
pop xl
|
||||||
ret
|
ret
|
||||||
|
AppNetwork_HandleMsg_handlePingMsg:
|
||||||
|
push xl
|
||||||
|
push xh
|
||||||
|
rcall appNetworkHandlePingRequest
|
||||||
|
pop xh
|
||||||
|
pop xl
|
||||||
|
ret
|
||||||
AppNetwork_HandleMsg_clcRet:
|
AppNetwork_HandleMsg_clcRet:
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
@@ -162,6 +171,27 @@ appNetworkHandleRebootRequest_end:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
appNetworkHandlePingRequest:
|
||||||
|
adiw xh:xl, NETMSG_OFFS_SRCADDR
|
||||||
|
ld r17, X
|
||||||
|
push r17
|
||||||
|
rcall NET_Buffer_Alloc ; (R16, R17, X)
|
||||||
|
pop r17
|
||||||
|
brcc appNetworkHandlePingRequest_end ; jmp on error
|
||||||
|
push r16 ; buffer num
|
||||||
|
mov r16, r17 ; DEST addr
|
||||||
|
ldi r18, NETMSG_CMD_PONG ; msg type
|
||||||
|
adiw xh:xl, 1
|
||||||
|
ldi yl, LOW(netInterfaceData)
|
||||||
|
ldi yh, HIGH(netInterfaceData)
|
||||||
|
rcall NETMSG_SimpleMsgWrite ; (R16, R17, R18, R19, R20, X)
|
||||||
|
sbiw xh:xl, 1
|
||||||
|
pop r16 ; buffer num
|
||||||
|
rcall NET_Interface_AddOrReleaseOutMsg ; (R16, R17, R18, X)
|
||||||
|
appNetworkHandlePingRequest_end:
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
appNetworkTimerTable:
|
appNetworkTimerTable:
|
||||||
rjmp appNetworkHandleStateInitialWait
|
rjmp appNetworkHandleStateInitialWait
|
||||||
@@ -233,7 +263,6 @@ appNetworkHandleStateUp:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine appNetworkSendMsgNextState
|
; @routine appNetworkSendMsgNextState
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -196,6 +196,7 @@
|
|||||||
.include "apps/network/main.asm"
|
.include "apps/network/main.asm"
|
||||||
.include "modules/network/msg/reboot-d.asm"
|
.include "modules/network/msg/reboot-d.asm"
|
||||||
.include "modules/network/msg/reboot-r.asm"
|
.include "modules/network/msg/reboot-r.asm"
|
||||||
|
.include "modules/network/msg/simplemsg-w.asm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user