diff --git a/avr/modules/uart_hw2/comonuart0.asm b/avr/modules/uart_hw2/comonuart0.asm new file mode 100644 index 0000000..c5cd661 --- /dev/null +++ b/avr/modules/uart_hw2/comonuart0.asm @@ -0,0 +1,847 @@ +; *************************************************************************** +; 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. * +; *************************************************************************** + +#ifndef AVR_MODULES_UART_HW2_COMONUART0_H +#define AVR_MODULES_UART_HW2_COMONUART0_H + + +.dseg + +comOnUart0_iface: .byte UART_HW2_IFACE_SIZE + + + +.cseg + + + +; --------------------------------------------------------------------------- +; @routine ComOnUart0_Init @global +; +; @clobbers R16, R17, Y (X) + +ComOnUart0_Init: + rcall comOnUart0StopRx + rcall comOnUart0StopTx + + ldi yl, LOW(comOnUart0_iface) + ldi yh, HIGH(comOnUart0_iface) + rcall NET_Interface_Init ; (R16, R17, X) + ldi r16, 0xff + std Y+UART_HW2_IFACE_OFFS_WRITEBUFNUM, r16 + ldi r16, UART_HW2_MODE_IDLE + std Y+UART_HW2_IFACE_OFFS_MODE, r16 + clr r16 + std Y+NET_IFACE_OFFS_IFACENUM, r16 + rcall comOnUart0SetAttnInput + + sbi COM_IRQ_ADDR_ATTN0, COM_IRQ_BIT_ATTN0 ; enable pin change irq for ATTN line + inr r16, GIMSK ; enable pin change irq PCIE0 or PCIE1 + sbr r16, (1<