avr: cleanup, added labels to calculate module sizes.

This commit is contained in:
Martin Preuss
2023-04-08 18:18:19 +02:00
parent 4a915a3c85
commit 0f678d7d5a
21 changed files with 416 additions and 167 deletions

View File

@@ -16,6 +16,8 @@
.cseg
COM_LOWLEVEL_BEGIN:
; ---------------------------------------------------------------------------
; comSendByte
@@ -114,19 +116,19 @@ comReceiveByte_error:
; ---------------------------------------------------------------------------
; comWaitForDataLow
;
; Waits up to COM_MAXWAIT loops for low data line
; Waits up to COM_MAXWAIT_US loops for low data line
; IN:
; OUT:
; - CFLAG: set if okay, clear otherwise
; MODIFIED REGISTERS: r17, r22
comWaitForDataLow:
ldi r17, COM_MAXWAIT
ldi r17, COM_MAXWAIT_US
comWaitForDataLow_loop:
sbis COM_PIN_DATA, COM_PINNUM_DATA
rjmp comWaitForDataLow_done
Utils_WaitNanoSecs 100, 0, r22 ; wait for 100 nanosecs
rcall comWaitFor1000ns
dec r17
brne comWaitForDataLow_loop
clc ; timeout
@@ -141,19 +143,19 @@ comWaitForDataLow_done:
; ---------------------------------------------------------------------------
; comWaitForDataHigh
;
; Waits up to COM_MAXWAIT loops for high data line
; Waits up to COM_MAXWAIT_US loops for high data line
; IN:
; OUT:
; - CFLAG: set if okay, clear otherwise
; MODIFIED REGISTERS: r17, r22, X
comWaitForDataHigh:
ldi r17, COM_MAXWAIT
ldi r17, COM_MAXWAIT_US
comWaitForDataHigh_loop:
sbic COM_PIN_DATA, COM_PINNUM_DATA
rjmp comWaitForDataHigh_done
Utils_WaitNanoSecs 100, 0, r22 ; wait for 100 nanosecs
rcall comWaitFor1000ns
dec r17
brne comWaitForDataHigh_loop
clc ; timeout
@@ -168,19 +170,19 @@ comWaitForDataHigh_done:
; ---------------------------------------------------------------------------
; comWaitForAttnHigh
;
; Waits up to COM_MAXWAIT loops for high ATTN line
; Waits up to COM_MAXWAIT_US loops for high ATTN line
; IN:
; OUT:
; - CFLAG: set if okay, clear otherwise
; MODIFIED REGISTERS: r17, r22, X
comWaitForAttnHigh:
ldi r17, COM_MAXWAIT
ldi r17, COM_MAXWAIT_US
comWaitForAttnHigh_loop:
sbic COM_PIN_ATTN, COM_PINNUM_ATTN
rjmp comWaitForAttnHigh_done
Utils_WaitNanoSecs 100, 0, r22 ; wait for 100 nanosecs
rcall comWaitFor1000ns
dec r17
brne comWaitForAttnHigh_loop
clc ; timeout
@@ -192,3 +194,22 @@ comWaitForAttnHigh_done:
; ---------------------------------------------------------------------------
; comWaitFor100ns
;
; Waits for 100 nanoseconds.
; IN:
; OUT:
; - CFLAG: set if okay, clear otherwise
; MODIFIED REGISTERS: r17, r22, X
comWaitFor1000ns:
Utils_WaitNanoSecs 1000, 7, r22 ; wait for 100 nanosecs (minus 3 cycles for rcall, 4 for ret)
ret
COM_LOWLEVEL_END:
.equ MODULE_SIZE_COM_LOWLEVEL = COM_LOWLEVEL_END-COM_LOWLEVEL_BEGIN