1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.1 KiB

/*! \file enc28j60conf.h \brief Microchip ENC28J60 Ethernet Interface Driver Configuration. */
//*****************************************************************************
//
// File Name : 'enc28j60conf.h'
// Title : Microchip ENC28J60 Ethernet Interface Driver Configuration
// Author : Pascal Stang
// Created : 10/5/2004
// Revised : 8/22/2005
// Version : 0.1
// Target MCU : Atmel AVR series
// Editor Tabs : 4
//
// Description : This driver provides initialization and transmit/receive
// functions for the ENC28J60 10Mb Ethernet Controller and PHY.
//
// This code is distributed under the GNU Public License
// which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************
#ifndef ENC28J60CONF_H
#define ENC28J60CONF_H
// Check for preference overrides
#include "main.h"
// ENC28J60 SPI port
#define ENC28J60_SPI_PORT PORTB
#define ENC28J60_SPI_DDR DDRB
// ENC28J60 control port
#define ENC28J60_CONTROL_PORT PORTB
#define ENC28J60_CONTROL_DDR DDRB
// ENC28J60 port pins
//#ifdef __AVR_ATmega8__ || __AVR_ATmega168__
#define ENC28J60_SPI_SCK 5
#define ENC28J60_SPI_MOSI 3
#define ENC28J60_SPI_MISO 4
#define ENC28J60_SPI_SS 2
#define ENC28J60_CONTROL_CS 2
#define ENC28J60_CONTROL_HRESET 1
// #elif __AVR_ATmega128__
// #define ENC28J60_SPI_SCK 1
// #define ENC28J60_SPI_MOSI 2
// #define ENC28J60_SPI_MISO 3
// #define ENC28J60_SPI_SS 0
//
// #define ENC28J60_CONTROL_CS 0
// #define ENC28J60_CONTROL_HRESET 4
// #else
// #define ENC28J60_SPI_SCK 7
// #define ENC28J60_SPI_MOSI 5
// #define ENC28J60_SPI_MISO 6
// #define ENC28J60_SPI_SS 4
//
// #define ENC28J60_CONTROL_CS 4
// #define ENC28J60_CONTROL_HRESET 3
// #endif
/**
* If commented, the ENC will receive all "loose packets",
* this can be a lot for our little µC so we will only
* accept packets that are sent to our MAC, except for ARP.
**/
#define ENC28J60_PACKET_FILTER_ENABLED /* Unimplemented */
#define ENC28J60_LAMPS_MODE 0x3476 /* Default (with Errata #9 correction) applied if this is undefied */
#define ENC28J60_CHECKSUM_ENABLED
/**
* Lamps reference
* 0x3D56 # Default full duplex: LEDA: Display link status and transmit/receive activity LEDB: Display duplex status
* 0x3D36 # Default half duplex: LEDA: Display link status and transmit/receive activity LEDB: Display collision activity
* 0x3476 # Prefered half duplex: LEDA: Link status LEDB: Rx/Tx acitity
* 0x3996 # All lamps off
* 0x3886 # All lamps on
**/
// Use this if you want to disable the hard reset (can be useful if you your the ENC's CLKOUT)
//#define ENC28J60_HARD_RESET_DISABLED
// Use this if you will run the µC using CLKOUT
//#define ENC28J60_USE_CLKOUT /* Unimplemented */
// MAC address for this interface
#ifdef ETHADDR0
#define ENC28J60_MAC0 ETHADDR0
#define ENC28J60_MAC1 ETHADDR1
#define ENC28J60_MAC2 ETHADDR2
#define ENC28J60_MAC3 ETHADDR3
#define ENC28J60_MAC4 ETHADDR4
#define ENC28J60_MAC5 ETHADDR5
#else
#define ENC28J60_MAC0 'C'
#define ENC28J60_MAC1 '0'
#define ENC28J60_MAC2 'F'
#define ENC28J60_MAC3 'F'
#define ENC28J60_MAC4 'E'
#define ENC28J60_MAC5 'E'
#endif
#endif