increase irq frequency (now every 10us).

This commit is contained in:
Martin Preuss
2025-09-09 00:47:24 +02:00
parent 17a7dddd02
commit 0dc9f0330c

View File

@@ -15,20 +15,20 @@
.equ COM2WI_BUFFER_SIZE = NET_BUFFERS_SIZE-1
.equ COM2WI_R_MAX_WAIT_HI_TIME = 50 ; max 1ms
.equ COM2WI_S_MAX_WAIT_HI_TIME = 50 ; max 1ms
.equ COM2WI_S_MAX_WAIT_LO_TIME = 50 ; max 1ms
.equ COM2WI_R_MAX_WAIT_HI_TIME = 100 ; max 1ms
.equ COM2WI_S_MAX_WAIT_HI_TIME = 100 ; max 1ms
.equ COM2WI_S_MAX_WAIT_LO_TIME = 100 ; max 1ms
.equ COM2WI_W_MAX_WAIT_BUSFREE = 50 ; max 1ms
.equ COM2WI_W_MAX_WAIT_BUSFREE = 100 ; max 1ms
.equ COM2WI_STATETIMER_W_BYTEHOLDCLOCKLOW = 1 ; 20 us
.equ COM2WI_STATETIMER_W_BITHOLDCLOCKLOW = 1 ; 20 us
.equ COM2WI_STATETIMER_W_BITSETDATA = 1 ; 20 us
.equ COM2WI_STATETIMER_W_BITHOLDCLOCKHIGH = 1 ; 20 us
.equ COM2WI_STATETIMER_R_WAITFORCLOCKHIGH = 50 ; 1 ms
.equ COM2WI_STATETIMER_R_WAITFORCLOCKLOW = 50 ; 1 ms
.equ COM2WI_STATETIMER_S_WAITFORCLOCKLOW = 50 ; 1 ms
.equ COM2WI_STATETIMER_W_BYTEHOLDCLOCKLOW = 2 ; 20 us
.equ COM2WI_STATETIMER_W_BITHOLDCLOCKLOW = 2 ; 20 us
.equ COM2WI_STATETIMER_W_BITSETDATA = 2 ; 20 us
.equ COM2WI_STATETIMER_W_BITHOLDCLOCKHIGH = 2 ; 20 us
.equ COM2WI_STATETIMER_R_WAITFORCLOCKHIGH = 100 ; 1 ms
.equ COM2WI_STATETIMER_R_WAITFORCLOCKLOW = 100 ; 1 ms
.equ COM2WI_STATETIMER_S_WAITFORCLOCKLOW = 100 ; 1 ms
.equ COM2WI_STATE_IDLE = 0
@@ -159,6 +159,7 @@ COM2WI_Init:
.if COM_PORTS >2
mCOM2WI_INIT 2
.endif
.if COM_PORTS >3
mCOM2WI_INIT 3
.endif
@@ -166,6 +167,7 @@ COM2WI_Init:
.if COM_PORTS >4
mCOM2WI_INIT 4
.endif
.if COM_PORTS >5
mCOM2WI_INIT 5
.endif
@@ -173,6 +175,7 @@ COM2WI_Init:
.if COM_PORTS >6
mCOM2WI_INIT 6
.endif
.if COM_PORTS >7
mCOM2WI_INIT 7
.endif
@@ -330,8 +333,8 @@ com2wiSetupTimer1:
ldi r16, (0<<CS12) | (0<<CS11) | (1<<CS10) | (0<<WGM13) | (1<<WGM12)
outr TCCR1B, r16
clr r17 HIGH(400)
ldi r16, LOW(400)
clr r17 HIGH(200)
ldi r16, LOW(200)
outr OCR1AH, r17
outr OCR1AL, r16
@@ -1149,10 +1152,11 @@ com2wiRunStateRMsgRecvd_forMe:
rcall NET_Buffer_Alloc ; R16=buffer num (R16, R17, X)
brcc com2wiRunStateRMsgRecvd_noBuf
; copy into allocated buffer
; set interface number in msg header
mov r19, r16 ; save buffer num
rcall NET_Interface_SetIfaceNumInBuffer ; (R16, R17)
mov r16, r19 ; restore buffer num
; copy into allocated buffer
push zl
push zh
mov zl, yl
@@ -1187,6 +1191,7 @@ com2wiRunStateRMsgRecvd_goIdle:
rcall com2wiEnterStateIdle
out SREG, r15
pop r15
sec
rjmp com2wiRunStateRMsgRecvd_ret
com2wiRunStateRMsgRecvd_noBuf:
ldi r16, NET_IFACE_OFFS_ERR_NOBUF_LOW
@@ -1199,7 +1204,7 @@ com2wiRunStateRMsgRecvd_crcError:
com2wReceiveNextPkg_eMissed:
rcall NET_Buffer_ReleaseByNum ; (R16, X)
ldi r16, NET_IFACE_OFFS_ERR_MISSED_LOW
rcall NET_Interface_IncCounter16 ; (R24, R25)
rcall NET_Interface_IncCounter16 ; (R24, R25)
rjmp com2wiRunStateRMsgRecvd_goIdle
com2wiRunStateRMsgRecvd_ret:
ret