; *************************************************************************** ; copyright : (C) 2025 by Martin Preuss ; email : martin@libchipcard.de ; ; *************************************************************************** ; * This file is part of the project "AqHome". * ; * Please see toplevel file COPYING of that project for license details. * ; *************************************************************************** ; *************************************************************************** ; defines ; --------------------------------------------------------------------------- ; network interfaces .equ NETDEV0_IFACENUM = 1 .equ NETDEV1_IFACENUM = 2 ; *************************************************************************** ; code .cseg ; --------------------------------------------------------------------------- ; @routine AppRouter_Init @global AppRouter_Init: ; set interface number for NETDEV0 ldi r16, NETDEV0_IFACENUM sts netInterfaceData+NET_IFACE_OFFS_IFACENUM, r16 ; set interface number for NETDEV1 ldi r16, NETDEV1_IFACENUM sts netInterfaceData2+NET_IFACE_OFFS_IFACENUM, r16 ret ; @end ; --------------------------------------------------------------------------- ; @routine AppRouter_Run @global ; ; Read messages from either interface and forward to the other one. AppRouter_Run: rjmp appRouterCheckRecvdMsg ; @end ; --------------------------------------------------------------------------- ; @routine appRouterCheckRecvdMsg ; ; Read messages from either interface and forward to the other one. appRouterCheckRecvdMsg: rcall NET_PeekNextIncomingMsgNum ; check read queue (bufNum->r16) brcc appRouterCheckRecvdMsg_end ; no msg, jmp rcall NET_Buffer_Locate ; (R17) ; let system handle incoming messages push r16 adiw xh:xl, 1 rcall appRouterLetSysHandleMsg sbiw xh:xl, 1 pop r16 ; forward to other interface ld r17, X andi r17, (1<