apps/network: implemented ping request.
This commit is contained in:
@@ -111,6 +111,8 @@ AppNetwork_HandleMsg:
|
||||
sbiw xh:xl, NETMSG_OFFS_CMD
|
||||
cpi r16, NETMSG_CMD_REBOOT_REQUEST
|
||||
breq AppNetwork_HandleMsg_handleRebootMsg
|
||||
cpi r16, NETMSG_CMD_PING
|
||||
breq AppNetwork_HandleMsg_handlePingMsg
|
||||
cpi r16, NETMSG_CMD_NEED_ADDRESS
|
||||
brcs AppNetwork_HandleMsg_clcRet ; lower than "HAVE_NEED"
|
||||
cpi r16, NETMSG_CMD_ADDRESS_RANGE
|
||||
@@ -138,6 +140,13 @@ AppNetwork_HandleMsg_handleRebootMsg:
|
||||
pop xh
|
||||
pop xl
|
||||
ret
|
||||
AppNetwork_HandleMsg_handlePingMsg:
|
||||
push xl
|
||||
push xh
|
||||
rcall appNetworkHandlePingRequest
|
||||
pop xh
|
||||
pop xl
|
||||
ret
|
||||
AppNetwork_HandleMsg_clcRet:
|
||||
clc
|
||||
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:
|
||||
rjmp appNetworkHandleStateInitialWait
|
||||
@@ -233,7 +263,6 @@ appNetworkHandleStateUp:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine appNetworkSendMsgNextState
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user