remove COM_* code.
This commit is contained in:
@@ -27,8 +27,6 @@
|
|||||||
; generic
|
; generic
|
||||||
|
|
||||||
.include "common/utils_wait.asm"
|
.include "common/utils_wait.asm"
|
||||||
.include "modules/com2/defs.asm"
|
|
||||||
.include "modules/comproto/defs.asm"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ ioRawWaitForValidMsg:
|
|||||||
ioRawWaitForValidMsg_attnLow:
|
ioRawWaitForValidMsg_attnLow:
|
||||||
ldi xl, LOW(flashRecvBuffer)
|
ldi xl, LOW(flashRecvBuffer)
|
||||||
ldi xh, HIGH(flashRecvBuffer)
|
ldi xh, HIGH(flashRecvBuffer)
|
||||||
ldi r16, COM2_MAINTENANCE_ADDR
|
ldi r16, NET_MAINTENANCE_ADDR
|
||||||
ldi r17, FLASH_RECVBUFFER_MAXLEN-3
|
ldi r17, FLASH_RECVBUFFER_MAXLEN-3
|
||||||
rcall ioRawReceivePacketIntoBuffer
|
rcall ioRawReceivePacketIntoBuffer
|
||||||
brcs ioRawWaitForValidMsg_packetReceived
|
brcs ioRawWaitForValidMsg_packetReceived
|
||||||
@@ -174,7 +174,6 @@ ioRawWaitForValidMsg_end:
|
|||||||
; @param R17 maximum value for accepted msg data (i.e. buffersize minus 3)
|
; @param R17 maximum value for accepted msg data (i.e. buffersize minus 3)
|
||||||
; @param X buffer to receive to
|
; @param X buffer to receive to
|
||||||
; @return CFLAG set if okay (packet received), cleared on error
|
; @return CFLAG set if okay (packet received), cleared on error
|
||||||
; @return R16 error code if CFLAG is cleared (COM2_ERROR_NOTFORME, COM2_ERROR_IOERROR, COM2_ERROR_DATAERROR)
|
|
||||||
; @clobbers: r16, r17, r18, X (r19, r20, r21, r22)
|
; @clobbers: r16, r17, r18, X (r19, r20, r21, r22)
|
||||||
|
|
||||||
ioRawReceivePacketIntoBuffer:
|
ioRawReceivePacketIntoBuffer:
|
||||||
@@ -183,7 +182,7 @@ ioRawReceivePacketIntoBuffer:
|
|||||||
; read destination address
|
; read destination address
|
||||||
rcall ioRawReceiveByte ; read byte (R16, R17, R20, R21, R22)
|
rcall ioRawReceiveByte ; read byte (R16, R17, R20, R21, R22)
|
||||||
pop r17 ; pop from R16 to R17
|
pop r17 ; pop from R16 to R17
|
||||||
brcc ioRawReceivePacketIntoBuffer_ioError
|
brcc ioRawReceivePacketIntoBuffer_error
|
||||||
#ifndef COM_ACCEPT_ALL_DEST ; accept every destination address
|
#ifndef COM_ACCEPT_ALL_DEST ; accept every destination address
|
||||||
; compare destination address (accept "FF" and own address)
|
; compare destination address (accept "FF" and own address)
|
||||||
cp r16, r17
|
cp r16, r17
|
||||||
@@ -197,27 +196,22 @@ ioRawReceivePacketIntoBuffer_acceptAddr:
|
|||||||
st X+, r16 ; store dest address, lock buffer
|
st X+, r16 ; store dest address, lock buffer
|
||||||
; read msg length
|
; read msg length
|
||||||
rcall ioRawReceiveByte ; read packet length (R16, R17, R20, R21, R22)
|
rcall ioRawReceiveByte ; read packet length (R16, R17, R20, R21, R22)
|
||||||
brcc ioRawReceivePacketIntoBuffer_ioError
|
brcc ioRawReceivePacketIntoBuffer_error
|
||||||
st X+, r16
|
st X+, r16
|
||||||
cp r16, r18 ; (COM2_BUFFER_SIZE-3)
|
cp r16, r18 ; (COM2_BUFFER_SIZE-3)
|
||||||
brcc ioRawReceivePacketIntoBuffer_contentError ; packet too long
|
brcc ioRawReceivePacketIntoBuffer_error ; packet too long
|
||||||
inc r16 ; account for checksum byte
|
inc r16 ; account for checksum byte
|
||||||
mov r17, r16
|
mov r17, r16
|
||||||
ioRawReceivePacketIntoBuffer_loop:
|
ioRawReceivePacketIntoBuffer_loop:
|
||||||
push r17
|
push r17
|
||||||
rcall ioRawReceiveByte ; read byte (R16, R17, R20, R21, R22)
|
rcall ioRawReceiveByte ; read byte (R16, R17, R20, R21, R22)
|
||||||
pop r17
|
pop r17
|
||||||
brcc ioRawReceivePacketIntoBuffer_ioError
|
brcc ioRawReceivePacketIntoBuffer_error
|
||||||
st X+, r16
|
st X+, r16
|
||||||
dec r17
|
dec r17
|
||||||
brne ioRawReceivePacketIntoBuffer_loop
|
brne ioRawReceivePacketIntoBuffer_loop
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
ioRawReceivePacketIntoBuffer_ioError:
|
|
||||||
ldi r16, COM2_ERROR_IOERROR
|
|
||||||
rjmp ioRawReceivePacketIntoBuffer_error
|
|
||||||
ioRawReceivePacketIntoBuffer_contentError:
|
|
||||||
ldi r16, COM2_ERROR_DATAERROR
|
|
||||||
ioRawReceivePacketIntoBuffer_error:
|
ioRawReceivePacketIntoBuffer_error:
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
@@ -281,36 +275,29 @@ ioRawReceiveByte_error:
|
|||||||
; @clobbers R16, R22 (R17, R21, X)
|
; @clobbers R16, R22 (R17, R21, X)
|
||||||
|
|
||||||
ioRawSendPacket:
|
ioRawSendPacket:
|
||||||
rcall ioRawAcquireBus ; (none)
|
rcall ioRawAcquireBus ; (none)
|
||||||
brcc ioRawSendPacket_lineBusyError
|
brcc ioRawSendPacket_ret
|
||||||
|
|
||||||
rcall ioRawWaitForOneBitLength ; wait for one bit duration (R22)
|
rcall ioRawWaitForOneBitLength ; wait for one bit duration (R22)
|
||||||
rcall ioRawWaitForOneBitLength ; wait for one bit duration (R22)
|
rcall ioRawWaitForOneBitLength ; wait for one bit duration (R22)
|
||||||
|
|
||||||
adiw xh:xl, COM2_MSG_OFFS_MSGLEN
|
adiw xh:xl, NETMSG_OFFS_MSGLEN
|
||||||
ld r17, X
|
ld r17, X
|
||||||
sbiw xh:xl, COM2_MSG_OFFS_MSGLEN
|
sbiw xh:xl, NETMSG_OFFS_MSGLEN
|
||||||
inc r17 ; account for dest addr
|
inc r17 ; account for dest addr
|
||||||
inc r17 ; account for msglen byte
|
inc r17 ; account for msglen byte
|
||||||
inc r17 ; account for crc byte
|
inc r17 ; account for crc byte
|
||||||
|
|
||||||
ioRawSendPacket_loop:
|
ioRawSendPacket_loop:
|
||||||
ld r16, X+
|
ld r16, X+
|
||||||
rcall ioRawSendByte ; send byte (R16, R21, R22)
|
rcall ioRawSendByte ; send byte (R16, R21, R22)
|
||||||
brcc ioRawSendPacket_releaseBusRet
|
brcc ioRawSendPacket_releaseBusRet
|
||||||
dec r17
|
dec r17
|
||||||
brne ioRawSendPacket_loop
|
brne ioRawSendPacket_loop
|
||||||
sec
|
sec
|
||||||
ioRawSendPacket_releaseBusRet:
|
ioRawSendPacket_releaseBusRet:
|
||||||
cbi COM_ATTN_DDR, COM_ATTN_PIN ; release ATTN line (by setting direction to IN)
|
cbi COM_ATTN_DDR, COM_ATTN_PIN ; release ATTN line (by setting direction to IN)
|
||||||
brcc ioRawSendPacket_ioError
|
ioRawSendPacket_ret:
|
||||||
; packet successfully sent
|
|
||||||
ret
|
|
||||||
ioRawSendPacket_ioError:
|
|
||||||
ldi r16,COM2_ERROR_COLLISION
|
|
||||||
ret
|
|
||||||
ioRawSendPacket_lineBusyError:
|
|
||||||
ldi r16,COM2_ERROR_BUSY
|
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user