; ***************************************************************************
; copyright   : (C) 2026 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 AQH_AVR_NETWORK_DEFS_ASM
#define AQH_AVR_NETWORK_DEFS_ASM



; defs

.equ NET_BUFFERS_SIZE                   = 28 ; CAVEAT: need to adapt routine NET_Buffer_Locate when changing this value!!

.equ NET_IFACE_BUFFER_INUSE_BIT3        = 7
.equ NET_IFACE_BUFFER_INUSE_BIT2        = 6
.equ NET_IFACE_BUFFER_INUSE_BIT1        = 5
.equ NET_IFACE_BUFFER_INUSE_BIT0        = 4
.equ NET_IFACE_BUFFER_IFACENUM3_BIT     = 3
.equ NET_IFACE_BUFFER_IFACENUM2_BIT     = 2
.equ NET_IFACE_BUFFER_IFACENUM1_BIT     = 1
.equ NET_IFACE_BUFFER_IFACENUM0_BIT     = 0


; interface generic data 
.equ NET_IFACE_OFFS_IFACENUM            =  0 ; interface number (put into received messages)
.equ NET_IFACE_OFFS_ADDRESS             =  1
.equ NET_IFACE_OFFS_RANGE_BEGIN         =  2 ; used for address setup protocol
.equ NET_IFACE_OFFS_RANGE_END           =  3 ; used for address setup protocol
.equ NET_IFACE_OFFS_STATUS              =  4 ; used for address setup protocol
.equ NET_IFACE_OFFS_STATETIMER          =  5 ; used for address setup protocol
.equ NET_IFACE_OFFS_READTIMER           =  6
.equ NET_IFACE_OFFS_WRITETIMER          =  7
.equ NET_IFACE_OFFS_LASTMSGID_LOW       =  8
.equ NET_IFACE_OFFS_LASTMSGID_HIGH      =  9

; device stats
.equ NET_IFACE_OFFS_PACKETSIN_LOW       = 10
.equ NET_IFACE_OFFS_PACKETSIN_HIGH      = 11
.equ NET_IFACE_OFFS_PACKETSOUT_LOW      = 12
.equ NET_IFACE_OFFS_PACKETSOUT_HIGH     = 13
.equ NET_IFACE_OFFS_ERR_CONTENT_LOW     = 14
.equ NET_IFACE_OFFS_ERR_CONTENT_HIGH    = 15
.equ NET_IFACE_OFFS_ERR_IO_LOW          = 16
.equ NET_IFACE_OFFS_ERR_IO_HIGH         = 17
.equ NET_IFACE_OFFS_ERR_NOBUF_LOW       = 18
.equ NET_IFACE_OFFS_ERR_NOBUF_HIGH      = 19
.equ NET_IFACE_OFFS_ERR_COLLISIONS_LOW  = 20
.equ NET_IFACE_OFFS_ERR_COLLISIONS_HIGH = 21
.equ NET_IFACE_OFFS_ERR_BUSY_LOW        = 22
.equ NET_IFACE_OFFS_ERR_BUSY_HIGH       = 23
.equ NET_IFACE_OFFS_ERR_MSGSIZE_LOW     = 24
.equ NET_IFACE_OFFS_ERR_MSGSIZE_HIGH    = 25
.equ NET_IFACE_OFFS_ERR_MISSED_LOW      = 26
.equ NET_IFACE_OFFS_ERR_MISSED_HIGH     = 27

.equ NET_IFACE_OFFS_OUTMSGRINGBUF       = 28  ; RINGBUFFERY_SIZE+UART_HW_IFACE_OUTMSGBUF_SIZE

.equ NET_IFACE_SIZE                     = NET_IFACE_OFFS_OUTMSGRINGBUF+RINGBUFFERY_SIZE+NET_IFACE_OUTMSGBUF_SIZE



#endif

