avr: introduced network module

this will be the base module for network modules.
This commit is contained in:
Martin Preuss
2025-02-13 01:12:29 +01:00
parent c5ab06b6d0
commit bf61be029e
16 changed files with 501 additions and 838 deletions

View File

@@ -72,8 +72,8 @@
;#define MODULES_MOTION
.equ UART_HW_FIXEDBUFFERS_NUM = 32
.equ UART_HW_FIXEDBUFFERS_SIZE = 6
.equ NET_BUFFERS_NUM = 6
.equ NET_BUFFERS_SIZE = 32
.equ UART_HW_MSGNUMINBUF_SIZE = 6
.equ UART_HW_MSGNUMOUTBUF_SIZE = 6
@@ -233,7 +233,7 @@ initHardware:
initModules:
rcall BaseTimer_Init
rcall LedSimple_Init
rcall UART_HW_Init
rcall NET_Init
rcall TtyOnUart1_Init
ldi r16, LOW(SEND_DEVICE_EVERY)
@@ -265,13 +265,16 @@ initModules:
.include "modules/com2/defs.asm"
.include "modules/com2/crc.asm"
.include "modules/comproto/defs.asm"
.include "modules/network/defs.asm"
.include "modules/network/buffer.asm"
.include "modules/network/data.asm"
.include "modules/network/main.asm"
.include "modules/network/iface.asm"
.include "modules/uart_hw/defs.asm"
.include "modules/uart_hw/buffers.asm"
.include "modules/uart_hw/lowlevel.asm"
.include "modules/uart_hw/m_lowlevel_uart.asm"
.include "modules/uart_hw/lowlevel_uart1.asm"
;.include "modules/uart_hw/msglevel_recv.asm"
;.include "modules/uart_hw/msglevel_send.asm"
.include "modules/uart_hw/ttyonuart1.asm"
@@ -288,7 +291,7 @@ maybeSendDeviceMsg:
sbiw r25:r24, 1
brne maybeSendDeviceMsg_storeCounter
; send device msg
rcall UART_HW_FixedBuffers_Alloc
rcall NET_Buffer_Alloc ; (R16, R17, X)
brcc maybeSendDeviceMsg_resetCounter
push r16
adiw xh:xl, 1
@@ -299,7 +302,7 @@ maybeSendDeviceMsg:
rcall TtyOnUart1_SendBuffer
pop r16
brcs maybeSendDeviceMsg_resetCounter
rcall UART_HW_FixedBuffers_ReleaseByNum ; (R16, X)
rcall NET_Buffer_ReleaseByNum ; (R16, X)
rjmp maybeSendDeviceMsg_end
; reset counter
maybeSendDeviceMsg_resetCounter: