diff --git a/avr/modules/com2w/com2w.asm b/avr/modules/com2w/com2w.asm index a71e181..a1d4cbd 100644 --- a/avr/modules/com2w/com2w.asm +++ b/avr/modules/com2w/com2w.asm @@ -174,6 +174,7 @@ com2wReceiveNextPkg: ; msg received, alloc buffer for it rcall NET_Buffer_Alloc ; R16=buffer num (R16, R17, X) brcs com2wReceiveNextPkg_gotBuffer + ; out of memory ldi r16, NET_IFACE_OFFS_ERR_NOBUF_LOW rcall NET_Interface_IncCounter16 ; (R24, R25) rjmp com2wReceiveNextPkg_end @@ -187,8 +188,8 @@ com2wReceiveNextPkg_gotBuffer: push zh mov zl, yl mov zh, yh - adiw zh:zl, COM2W_IFACE_OFFS_BUFFER - adiw xh:xl, 1 + adiw zh:zl, COM2W_IFACE_OFFS_BUFFER ; Z=SRC + adiw xh:xl, 1 ; X=DEST ldd r18, Z+NETMSG_OFFS_MSGLEN inc r18 inc r18 @@ -232,49 +233,6 @@ com2wReceiveNextPkg_end: -#if 0 -; --------------------------------------------------------------------------- -; @routine com2wReceiveAndCheckMsg -; -; Receive a packet into buffer pointed to by X. -; Expects interrupts to be disabled. -; -; @param R18 COM address to listen to -; @param R19 max buffer size -; @param X buffer to receive to -; @return CFLAG set if msg received, cleared on error -; @clobbers R16 (R17, R18, R19, R20, R22, R24, R25) - -com2wReceiveAndCheckMsg: - push xl - push xh - rcall com2wRecvMsg ; (r16, r17, r18, r19, r20, r22, r24, r25, X) - pop xh - pop xl - brcs com2wReceiveAndCheckMsg_recvd - ; fall-through, return with CF cleared (from com2wRecvMsg) - ret -com2wReceiveAndCheckMsg_recvd: - push xl - push xh - rcall NETMSG_CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X) - pop xh - pop xl - brcs com2wReceiveAndCheckMsg_msgOk - ldi r16, NET_IFACE_OFFS_ERR_CONTENT_LOW - rcall NET_Interface_IncCounter16 ; (R24, R25) - clc - ret -com2wReceiveAndCheckMsg_msgOk: - ldi r16, NET_IFACE_OFFS_PACKETSIN_LOW - rcall NET_Interface_IncCounter16 ; (R24, R25) - sec - ret -; @end -#endif - - - ; --------------------------------------------------------------------------- ; @routine com2wSendNextPkg @global ;