/* flaneth - flash and ethernet - dartboard mod
* version 0.1 date 2008-11-09
* Copyright (C) 2007-2008 Stefan Schuermans <stefan@schuermans.info>
* Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
* a BlinkenArea project - http://www.blinkenarea.org/
*/
#include <avr/io.h>
#include "bus.h"
#include "config.h"
#include "debug.h"
#include "ethernet.h"
#include "macros.h"
#include "random.h"
#include "rtl8019.h"
#include "timing.h"
// maximum receive unit
#define RTL_MRU (640)
// reinitialization timeout
// - if no reception is detected for this time, the RTL8019 is reinitialized
#define RtlReinitTimeoutTicks (50) // in 200ms steps
// IO pins of RTL8019
#define RTL_DDR_INT (DDRE)
#define RTL_PORT_INT (PORTE)
#define RTL_BIT_INT (5)
#define RTL_DDR_nAEN (DDRE)
#define RTL_PORT_nAEN (PORTE)
#define RTL_BIT_nAEN (4)
#define RTL_DDR_RST (DDRE)
#define RTL_PORT_RST (PORTE)
#define RTL_BIT_RST (3)
// special pin commands
#define RTL_AEN_ACT( ) (bit_clear( RTL_PORT_nAEN, RTL_BIT_nAEN ))
#define RTL_AEN_IDLE( ) (bit_set( RTL_PORT_nAEN, RTL_BIT_nAEN ))
#define RTL_RESET_ACT( ) (bit_set( RTL_PORT_RST, RTL_BIT_RST ))
#define RTL_RESET_IDLE( ) (bit_clear( RTL_PORT_RST, RTL_BIT_RST ))
// IO pins of RTL8019 EEPROM interface
#define RTL_DDR_EECS (DDRD)
#define RTL_PORT_EECS (PORTD)
#define RTL_PIN_EECS (PIND)
#define RTL_BIT_EECS (7)
#define RTL_DDR_EESK (DDRD)
#define RTL_PORT_EESK (PORTD)
#define RTL_PIN_EESK (PIND)
#define RTL_BIT_EESK (4)
#define RTL_DDR_EEDI (DDRD)