/* flaneth - flash and ethernet
   Copyright (C) 2007-2012 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
   a BlinkenArea project - http://www.blinkenarea.org/ */

#ifndef INC_bus
#define INC_bus

#include "macros.h"

// IO pins of bus
#define BUS_ADDR_DDR (DDRG)
#define BUS_ADDR (PORTG)
#define BUS_DATA_DDR (DDRA)
#define BUS_DATA (PORTA)
#define BUS_DATA_IN (PINA)
#define BUS_DDR_nRD (DDRE)
#define BUS_PORT_nRD (PORTE)
#define BUS_BIT_nRD (6)
#define BUS_DDR_nWR (DDRE)
#define BUS_PORT_nWR (PORTE)
#define BUS_BIT_nWR (7)

// special pin commands
#define BUS_READ_ACT( ) (bit_clear( BUS_PORT_nRD, BUS_BIT_nRD ))
#define BUS_READ_IDLE( ) (bit_set( BUS_PORT_nRD, BUS_BIT_nRD ))
#define BUS_WRITE_ACT( ) (bit_clear( BUS_PORT_nWR, BUS_BIT_nWR ))
#define BUS_WRITE_IDLE( ) (bit_set( BUS_PORT_nWR, BUS_BIT_nWR ))

// initialize
extern void BusInit(void);

#endif // #ifndef INC_bus
