avr: added devices, more work on modules.
This commit is contained in:
@@ -61,12 +61,10 @@ COM2_BEGIN:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Com2_Init
|
||||
; @routine Com2_Init @global
|
||||
;
|
||||
; IN:
|
||||
; OUT:
|
||||
; - CFLAG: set if okay, clear on error
|
||||
; USED: R16, R17, X, Y
|
||||
; @return CFLAG set if okay, clear on error
|
||||
; @clobbers R16, R17, X, Y
|
||||
|
||||
Com2_Init:
|
||||
; preset SRAM data area
|
||||
@@ -81,6 +79,7 @@ Com2_Init:
|
||||
sts com2Address, r16
|
||||
|
||||
rjmp COMIO_Init
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
@@ -151,15 +150,16 @@ com2HandleNextPacketInQueue_retNc:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine COM2_WriteMsgWithCmdAndSrcAddr @global
|
||||
;
|
||||
; Write a simple packet into the given buffer with payload being only CMD and source address.
|
||||
;
|
||||
; IN:
|
||||
; - R16: destination address
|
||||
; - R18: command (e.g. CPRO_CMD_PING or CPRO_CMD_PONG)
|
||||
; - X : pointer to buffer to write to
|
||||
; OUT:
|
||||
; - CFLAG: set if okay, clear otherwise
|
||||
; REGS: R16, R17, X, Y (R3, R4, R15, R16, R17, R18, R19, R20, R21)
|
||||
; @param R16 destination address
|
||||
; @param R18 command (e.g. CPRO_CMD_PING or CPRO_CMD_PONG)
|
||||
; @param X pointer to buffer to write to
|
||||
; @return CFLAG set if okay, clear otherwise
|
||||
; @clobbers R16, R17, X, Y (R3, R4, R15, R16, R17, R18, R19, R20, R21)
|
||||
|
||||
COM2_WriteMsgWithCmdAndSrcAddr:
|
||||
ldi r17, COM2_PAYLOAD_FLAGS_SECONDS
|
||||
@@ -174,13 +174,15 @@ COM2_WriteMsgWithCmdAndSrcAddr:
|
||||
COM2_WriteMsgWithCmdAndSrcAddr_error:
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine COM2_BeginMsgWithVariablePayload @global
|
||||
;
|
||||
; begin packet with variable payload.
|
||||
;
|
||||
; IN:
|
||||
; @param R16 destination address
|
||||
; @param R17 flags
|
||||
; @param R18 command (e.g. CPRO_CMD_PING)
|
||||
@@ -212,6 +214,7 @@ COM2_BeginMsgWithVariablePayload_l1:
|
||||
rcall COM2_AddUidToBuffer
|
||||
COM2_BeginMsgWithVariablePayload_l2:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
@@ -246,7 +249,7 @@ COM2_AddUidToBuffer:
|
||||
;
|
||||
; @return X points to behind written seconds
|
||||
; @param X pointer to packet buffer
|
||||
; @clobbers: r16
|
||||
; @clobbers r16
|
||||
|
||||
COM2_AddSecsToBuffer:
|
||||
lds r16, timerModuleCounterSecs ; add current seconds counter
|
||||
@@ -292,11 +295,9 @@ COM2_AddNextMsgIdToBuffer:
|
||||
;
|
||||
; Calculate payload size from given flags
|
||||
;
|
||||
; IN:
|
||||
; - R16: flags
|
||||
; OUT:
|
||||
; - R16: payload size
|
||||
; MODIFIED REGS: R4, R16, R17
|
||||
; @param R16 flags
|
||||
; @return R16 payload size
|
||||
; @clobbers R4, R16, R17
|
||||
|
||||
com2CalcPayloadSize:
|
||||
clr r4
|
||||
@@ -312,6 +313,7 @@ com2CalcPayloadSize_l2:
|
||||
lsr r16 ; shift out reserved1, after this R16 contains COM2_PAYLOAD_FLAGS_NUM0-4
|
||||
add r16, r4 ; add previous bytes to R16
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
@@ -321,6 +323,7 @@ com2CalcPayloadSize_l2:
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine COM2_SendPacket
|
||||
;
|
||||
; send packet from sendBuffer, if line free.
|
||||
;
|
||||
; @return CFLAG set if okay (packet sent), cleared on error
|
||||
@@ -330,6 +333,7 @@ COM2_SendPacket:
|
||||
ldi xl, LOW(com2SendBuffer)
|
||||
ldi xh, HIGH(com2SendBuffer)
|
||||
rjmp COMIO_SendPacket
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user