Donatien Garnier / LwIPNetworking

Dependencies:   DebugLib Socket lwip lwip-sys

Dependents:   EthernetInterface

Fork of NetworkingCoreLib by Donatien Garnier

Committer:
donatien
Date:
Thu May 24 14:49:40 2012 +0000
Revision:
0:013f5d54248c
Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:013f5d54248c 1 /**********************************************************************
donatien 0:013f5d54248c 2 * $Id$ lpc17xx_emac.h 2010-05-21
donatien 0:013f5d54248c 3 *//**
donatien 0:013f5d54248c 4 * @file lpc17xx_emac.h
donatien 0:013f5d54248c 5 * @brief Contains all macro definitions and function prototypes
donatien 0:013f5d54248c 6 * support for Ethernet MAC firmware library on LPC17xx
donatien 0:013f5d54248c 7 * @version 2.0
donatien 0:013f5d54248c 8 * @date 21. May. 2010
donatien 0:013f5d54248c 9 * @author NXP MCU SW Application Team
donatien 0:013f5d54248c 10 *
donatien 0:013f5d54248c 11 * Copyright(C) 2010, NXP Semiconductor
donatien 0:013f5d54248c 12 * All rights reserved.
donatien 0:013f5d54248c 13 *
donatien 0:013f5d54248c 14 ***********************************************************************
donatien 0:013f5d54248c 15 * Software that is described herein is for illustrative purposes only
donatien 0:013f5d54248c 16 * which provides customers with programming information regarding the
donatien 0:013f5d54248c 17 * products. This software is supplied "AS IS" without any warranties.
donatien 0:013f5d54248c 18 * NXP Semiconductors assumes no responsibility or liability for the
donatien 0:013f5d54248c 19 * use of the software, conveys no license or title under any patent,
donatien 0:013f5d54248c 20 * copyright, or mask work right to the product. NXP Semiconductors
donatien 0:013f5d54248c 21 * reserves the right to make changes in the software without
donatien 0:013f5d54248c 22 * notification. NXP Semiconductors also make no representation or
donatien 0:013f5d54248c 23 * warranty that such application will be suitable for the specified
donatien 0:013f5d54248c 24 * use without further testing or modification.
donatien 0:013f5d54248c 25 **********************************************************************/
donatien 0:013f5d54248c 26
donatien 0:013f5d54248c 27 /* Peripheral group ----------------------------------------------------------- */
donatien 0:013f5d54248c 28 /** @defgroup EMAC EMAC (Ethernet Media Access Controller)
donatien 0:013f5d54248c 29 * @ingroup LPC1700CMSIS_FwLib_Drivers
donatien 0:013f5d54248c 30 * @{
donatien 0:013f5d54248c 31 */
donatien 0:013f5d54248c 32
donatien 0:013f5d54248c 33 #ifndef LPC17XX_EMAC_H_
donatien 0:013f5d54248c 34 #define LPC17XX_EMAC_H_
donatien 0:013f5d54248c 35
donatien 0:013f5d54248c 36 /* Includes ------------------------------------------------------------------- */
donatien 0:013f5d54248c 37 #include "LPC17xx.h"
donatien 0:013f5d54248c 38 #include "lpc_types.h"
donatien 0:013f5d54248c 39
donatien 0:013f5d54248c 40
donatien 0:013f5d54248c 41 #ifdef __cplusplus
donatien 0:013f5d54248c 42 extern "C"
donatien 0:013f5d54248c 43 {
donatien 0:013f5d54248c 44 #endif
donatien 0:013f5d54248c 45
donatien 0:013f5d54248c 46 #define MCB_LPC_1768
donatien 0:013f5d54248c 47 //#define IAR_LPC_1768
donatien 0:013f5d54248c 48
donatien 0:013f5d54248c 49 /* Public Macros -------------------------------------------------------------- */
donatien 0:013f5d54248c 50 /** @defgroup EMAC_Public_Macros EMAC Public Macros
donatien 0:013f5d54248c 51 * @{
donatien 0:013f5d54248c 52 */
donatien 0:013f5d54248c 53
donatien 0:013f5d54248c 54
donatien 0:013f5d54248c 55 /* EMAC PHY status type definitions */
donatien 0:013f5d54248c 56 #define EMAC_PHY_STAT_LINK (0) /**< Link Status */
donatien 0:013f5d54248c 57 #define EMAC_PHY_STAT_SPEED (1) /**< Speed Status */
donatien 0:013f5d54248c 58 #define EMAC_PHY_STAT_DUP (2) /**< Duplex Status */
donatien 0:013f5d54248c 59
donatien 0:013f5d54248c 60 /* EMAC PHY device Speed definitions */
donatien 0:013f5d54248c 61 #define EMAC_MODE_AUTO (0) /**< Auto-negotiation mode */
donatien 0:013f5d54248c 62 #define EMAC_MODE_10M_FULL (1) /**< 10Mbps FullDuplex mode */
donatien 0:013f5d54248c 63 #define EMAC_MODE_10M_HALF (2) /**< 10Mbps HalfDuplex mode */
donatien 0:013f5d54248c 64 #define EMAC_MODE_100M_FULL (3) /**< 100Mbps FullDuplex mode */
donatien 0:013f5d54248c 65 #define EMAC_MODE_100M_HALF (4) /**< 100Mbps HalfDuplex mode */
donatien 0:013f5d54248c 66
donatien 0:013f5d54248c 67 /**
donatien 0:013f5d54248c 68 * @}
donatien 0:013f5d54248c 69 */
donatien 0:013f5d54248c 70 /* Private Macros ------------------------------------------------------------- */
donatien 0:013f5d54248c 71 /** @defgroup EMAC_Private_Macros EMAC Private Macros
donatien 0:013f5d54248c 72 * @{
donatien 0:013f5d54248c 73 */
donatien 0:013f5d54248c 74
donatien 0:013f5d54248c 75
donatien 0:013f5d54248c 76 /* EMAC Memory Buffer configuration for 16K Ethernet RAM */
donatien 0:013f5d54248c 77 #define EMAC_NUM_RX_FRAG 4 /**< Num.of RX Fragments 4*1536= 6.0kB */
donatien 0:013f5d54248c 78 #define EMAC_NUM_TX_FRAG 3 /**< Num.of TX Fragments 3*1536= 4.6kB */
donatien 0:013f5d54248c 79 #define EMAC_ETH_MAX_FLEN 1536 /**< Max. Ethernet Frame Size */
donatien 0:013f5d54248c 80 #define EMAC_TX_FRAME_TOUT 0x00100000 /**< Frame Transmit timeout count */
donatien 0:013f5d54248c 81
donatien 0:013f5d54248c 82 /* --------------------- BIT DEFINITIONS -------------------------------------- */
donatien 0:013f5d54248c 83 /*********************************************************************//**
donatien 0:013f5d54248c 84 * Macro defines for MAC Configuration Register 1
donatien 0:013f5d54248c 85 **********************************************************************/
donatien 0:013f5d54248c 86 #define EMAC_MAC1_REC_EN 0x00000001 /**< Receive Enable */
donatien 0:013f5d54248c 87 #define EMAC_MAC1_PASS_ALL 0x00000002 /**< Pass All Receive Frames */
donatien 0:013f5d54248c 88 #define EMAC_MAC1_RX_FLOWC 0x00000004 /**< RX Flow Control */
donatien 0:013f5d54248c 89 #define EMAC_MAC1_TX_FLOWC 0x00000008 /**< TX Flow Control */
donatien 0:013f5d54248c 90 #define EMAC_MAC1_LOOPB 0x00000010 /**< Loop Back Mode */
donatien 0:013f5d54248c 91 #define EMAC_MAC1_RES_TX 0x00000100 /**< Reset TX Logic */
donatien 0:013f5d54248c 92 #define EMAC_MAC1_RES_MCS_TX 0x00000200 /**< Reset MAC TX Control Sublayer */
donatien 0:013f5d54248c 93 #define EMAC_MAC1_RES_RX 0x00000400 /**< Reset RX Logic */
donatien 0:013f5d54248c 94 #define EMAC_MAC1_RES_MCS_RX 0x00000800 /**< Reset MAC RX Control Sublayer */
donatien 0:013f5d54248c 95 #define EMAC_MAC1_SIM_RES 0x00004000 /**< Simulation Reset */
donatien 0:013f5d54248c 96 #define EMAC_MAC1_SOFT_RES 0x00008000 /**< Soft Reset MAC */
donatien 0:013f5d54248c 97
donatien 0:013f5d54248c 98 /*********************************************************************//**
donatien 0:013f5d54248c 99 * Macro defines for MAC Configuration Register 2
donatien 0:013f5d54248c 100 **********************************************************************/
donatien 0:013f5d54248c 101 #define EMAC_MAC2_FULL_DUP 0x00000001 /**< Full-Duplex Mode */
donatien 0:013f5d54248c 102 #define EMAC_MAC2_FRM_LEN_CHK 0x00000002 /**< Frame Length Checking */
donatien 0:013f5d54248c 103 #define EMAC_MAC2_HUGE_FRM_EN 0x00000004 /**< Huge Frame Enable */
donatien 0:013f5d54248c 104 #define EMAC_MAC2_DLY_CRC 0x00000008 /**< Delayed CRC Mode */
donatien 0:013f5d54248c 105 #define EMAC_MAC2_CRC_EN 0x00000010 /**< Append CRC to every Frame */
donatien 0:013f5d54248c 106 #define EMAC_MAC2_PAD_EN 0x00000020 /**< Pad all Short Frames */
donatien 0:013f5d54248c 107 #define EMAC_MAC2_VLAN_PAD_EN 0x00000040 /**< VLAN Pad Enable */
donatien 0:013f5d54248c 108 #define EMAC_MAC2_ADET_PAD_EN 0x00000080 /**< Auto Detect Pad Enable */
donatien 0:013f5d54248c 109 #define EMAC_MAC2_PPREAM_ENF 0x00000100 /**< Pure Preamble Enforcement */
donatien 0:013f5d54248c 110 #define EMAC_MAC2_LPREAM_ENF 0x00000200 /**< Long Preamble Enforcement */
donatien 0:013f5d54248c 111 #define EMAC_MAC2_NO_BACKOFF 0x00001000 /**< No Backoff Algorithm */
donatien 0:013f5d54248c 112 #define EMAC_MAC2_BACK_PRESSURE 0x00002000 /**< Backoff Presurre / No Backoff */
donatien 0:013f5d54248c 113 #define EMAC_MAC2_EXCESS_DEF 0x00004000 /**< Excess Defer */
donatien 0:013f5d54248c 114
donatien 0:013f5d54248c 115 /*********************************************************************//**
donatien 0:013f5d54248c 116 * Macro defines for Back-to-Back Inter-Packet-Gap Register
donatien 0:013f5d54248c 117 **********************************************************************/
donatien 0:013f5d54248c 118 /** Programmable field representing the nibble time offset of the minimum possible period
donatien 0:013f5d54248c 119 * between the end of any transmitted packet to the beginning of the next */
donatien 0:013f5d54248c 120 #define EMAC_IPGT_BBIPG(n) (n&0x7F)
donatien 0:013f5d54248c 121 /** Recommended value for Full Duplex of Programmable field representing the nibble time
donatien 0:013f5d54248c 122 * offset of the minimum possible period between the end of any transmitted packet to the
donatien 0:013f5d54248c 123 * beginning of the next */
donatien 0:013f5d54248c 124 #define EMAC_IPGT_FULL_DUP (EMAC_IPGT_BBIPG(0x15))
donatien 0:013f5d54248c 125 /** Recommended value for Half Duplex of Programmable field representing the nibble time
donatien 0:013f5d54248c 126 * offset of the minimum possible period between the end of any transmitted packet to the
donatien 0:013f5d54248c 127 * beginning of the next */
donatien 0:013f5d54248c 128 #define EMAC_IPGT_HALF_DUP (EMAC_IPGT_BBIPG(0x12))
donatien 0:013f5d54248c 129
donatien 0:013f5d54248c 130 /*********************************************************************//**
donatien 0:013f5d54248c 131 * Macro defines for Non Back-to-Back Inter-Packet-Gap Register
donatien 0:013f5d54248c 132 **********************************************************************/
donatien 0:013f5d54248c 133 /** Programmable field representing the Non-Back-to-Back Inter-Packet-Gap */
donatien 0:013f5d54248c 134 #define EMAC_IPGR_NBBIPG_P2(n) (n&0x7F)
donatien 0:013f5d54248c 135 /** Recommended value for Programmable field representing the Non-Back-to-Back Inter-Packet-Gap Part 1 */
donatien 0:013f5d54248c 136 #define EMAC_IPGR_P2_DEF (EMAC_IPGR_NBBIPG_P2(0x12))
donatien 0:013f5d54248c 137 /** Programmable field representing the optional carrierSense window referenced in
donatien 0:013f5d54248c 138 * IEEE 802.3/4.2.3.2.1 'Carrier Deference' */
donatien 0:013f5d54248c 139 #define EMAC_IPGR_NBBIPG_P1(n) ((n&0x7F)<<8)
donatien 0:013f5d54248c 140 /** Recommended value for Programmable field representing the Non-Back-to-Back Inter-Packet-Gap Part 2 */
donatien 0:013f5d54248c 141 #define EMAC_IPGR_P1_DEF EMAC_IPGR_NBBIPG_P1(0x0C)
donatien 0:013f5d54248c 142
donatien 0:013f5d54248c 143 /*********************************************************************//**
donatien 0:013f5d54248c 144 * Macro defines for Collision Window/Retry Register
donatien 0:013f5d54248c 145 **********************************************************************/
donatien 0:013f5d54248c 146 /** Programmable field specifying the number of retransmission attempts following a collision before
donatien 0:013f5d54248c 147 * aborting the packet due to excessive collisions */
donatien 0:013f5d54248c 148 #define EMAC_CLRT_MAX_RETX(n) (n&0x0F)
donatien 0:013f5d54248c 149 /** Programmable field representing the slot time or collision window during which collisions occur
donatien 0:013f5d54248c 150 * in properly configured networks */
donatien 0:013f5d54248c 151 #define EMAC_CLRT_COLL(n) ((n&0x3F)<<8)
donatien 0:013f5d54248c 152 /** Default value for Collision Window / Retry register */
donatien 0:013f5d54248c 153 #define EMAC_CLRT_DEF ((EMAC_CLRT_MAX_RETX(0x0F))|(EMAC_CLRT_COLL(0x37)))
donatien 0:013f5d54248c 154
donatien 0:013f5d54248c 155 /*********************************************************************//**
donatien 0:013f5d54248c 156 * Macro defines for Maximum Frame Register
donatien 0:013f5d54248c 157 **********************************************************************/
donatien 0:013f5d54248c 158 /** Represents a maximum receive frame of 1536 octets */
donatien 0:013f5d54248c 159 #define EMAC_MAXF_MAXFRMLEN(n) (n&0xFFFF)
donatien 0:013f5d54248c 160
donatien 0:013f5d54248c 161 /*********************************************************************//**
donatien 0:013f5d54248c 162 * Macro defines for PHY Support Register
donatien 0:013f5d54248c 163 **********************************************************************/
donatien 0:013f5d54248c 164 #define EMAC_SUPP_SPEED 0x00000100 /**< Reduced MII Logic Current Speed */
donatien 0:013f5d54248c 165 #define EMAC_SUPP_RES_RMII 0x00000800 /**< Reset Reduced MII Logic */
donatien 0:013f5d54248c 166
donatien 0:013f5d54248c 167 /*********************************************************************//**
donatien 0:013f5d54248c 168 * Macro defines for Test Register
donatien 0:013f5d54248c 169 **********************************************************************/
donatien 0:013f5d54248c 170 #define EMAC_TEST_SHCUT_PQUANTA 0x00000001 /**< Shortcut Pause Quanta */
donatien 0:013f5d54248c 171 #define EMAC_TEST_TST_PAUSE 0x00000002 /**< Test Pause */
donatien 0:013f5d54248c 172 #define EMAC_TEST_TST_BACKP 0x00000004 /**< Test Back Pressure */
donatien 0:013f5d54248c 173
donatien 0:013f5d54248c 174 /*********************************************************************//**
donatien 0:013f5d54248c 175 * Macro defines for MII Management Configuration Register
donatien 0:013f5d54248c 176 **********************************************************************/
donatien 0:013f5d54248c 177 #define EMAC_MCFG_SCAN_INC 0x00000001 /**< Scan Increment PHY Address */
donatien 0:013f5d54248c 178 #define EMAC_MCFG_SUPP_PREAM 0x00000002 /**< Suppress Preamble */
donatien 0:013f5d54248c 179 #define EMAC_MCFG_CLK_SEL(n) ((n&0x0F)<<2) /**< Clock Select Field */
donatien 0:013f5d54248c 180 #define EMAC_MCFG_RES_MII 0x00008000 /**< Reset MII Management Hardware */
donatien 0:013f5d54248c 181 #define EMAC_MCFG_MII_MAXCLK 2500000UL /**< MII Clock max */
donatien 0:013f5d54248c 182
donatien 0:013f5d54248c 183 /*********************************************************************//**
donatien 0:013f5d54248c 184 * Macro defines for MII Management Command Register
donatien 0:013f5d54248c 185 **********************************************************************/
donatien 0:013f5d54248c 186 #define EMAC_MCMD_READ 0x00000001 /**< MII Read */
donatien 0:013f5d54248c 187 #define EMAC_MCMD_SCAN 0x00000002 /**< MII Scan continuously */
donatien 0:013f5d54248c 188
donatien 0:013f5d54248c 189 #define EMAC_MII_WR_TOUT 0x00050000 /**< MII Write timeout count */
donatien 0:013f5d54248c 190 #define EMAC_MII_RD_TOUT 0x00050000 /**< MII Read timeout count */
donatien 0:013f5d54248c 191
donatien 0:013f5d54248c 192 /*********************************************************************//**
donatien 0:013f5d54248c 193 * Macro defines for MII Management Address Register
donatien 0:013f5d54248c 194 **********************************************************************/
donatien 0:013f5d54248c 195 #define EMAC_MADR_REG_ADR(n) (n&0x1F) /**< MII Register Address field */
donatien 0:013f5d54248c 196 #define EMAC_MADR_PHY_ADR(n) ((n&0x1F)<<8) /**< PHY Address Field */
donatien 0:013f5d54248c 197
donatien 0:013f5d54248c 198 /*********************************************************************//**
donatien 0:013f5d54248c 199 * Macro defines for MII Management Write Data Register
donatien 0:013f5d54248c 200 **********************************************************************/
donatien 0:013f5d54248c 201 #define EMAC_MWTD_DATA(n) (n&0xFFFF) /**< Data field for MMI Management Write Data register */
donatien 0:013f5d54248c 202
donatien 0:013f5d54248c 203 /*********************************************************************//**
donatien 0:013f5d54248c 204 * Macro defines for MII Management Read Data Register
donatien 0:013f5d54248c 205 **********************************************************************/
donatien 0:013f5d54248c 206 #define EMAC_MRDD_DATA(n) (n&0xFFFF) /**< Data field for MMI Management Read Data register */
donatien 0:013f5d54248c 207
donatien 0:013f5d54248c 208 /*********************************************************************//**
donatien 0:013f5d54248c 209 * Macro defines for MII Management Indicators Register
donatien 0:013f5d54248c 210 **********************************************************************/
donatien 0:013f5d54248c 211 #define EMAC_MIND_BUSY 0x00000001 /**< MII is Busy */
donatien 0:013f5d54248c 212 #define EMAC_MIND_SCAN 0x00000002 /**< MII Scanning in Progress */
donatien 0:013f5d54248c 213 #define EMAC_MIND_NOT_VAL 0x00000004 /**< MII Read Data not valid */
donatien 0:013f5d54248c 214 #define EMAC_MIND_MII_LINK_FAIL 0x00000008 /**< MII Link Failed */
donatien 0:013f5d54248c 215
donatien 0:013f5d54248c 216 /* Station Address 0 Register */
donatien 0:013f5d54248c 217 /* Station Address 1 Register */
donatien 0:013f5d54248c 218 /* Station Address 2 Register */
donatien 0:013f5d54248c 219
donatien 0:013f5d54248c 220
donatien 0:013f5d54248c 221 /* Control register definitions --------------------------------------------------------------------------- */
donatien 0:013f5d54248c 222 /*********************************************************************//**
donatien 0:013f5d54248c 223 * Macro defines for Command Register
donatien 0:013f5d54248c 224 **********************************************************************/
donatien 0:013f5d54248c 225 #define EMAC_CR_RX_EN 0x00000001 /**< Enable Receive */
donatien 0:013f5d54248c 226 #define EMAC_CR_TX_EN 0x00000002 /**< Enable Transmit */
donatien 0:013f5d54248c 227 #define EMAC_CR_REG_RES 0x00000008 /**< Reset Host Registers */
donatien 0:013f5d54248c 228 #define EMAC_CR_TX_RES 0x00000010 /**< Reset Transmit Datapath */
donatien 0:013f5d54248c 229 #define EMAC_CR_RX_RES 0x00000020 /**< Reset Receive Datapath */
donatien 0:013f5d54248c 230 #define EMAC_CR_PASS_RUNT_FRM 0x00000040 /**< Pass Runt Frames */
donatien 0:013f5d54248c 231 #define EMAC_CR_PASS_RX_FILT 0x00000080 /**< Pass RX Filter */
donatien 0:013f5d54248c 232 #define EMAC_CR_TX_FLOW_CTRL 0x00000100 /**< TX Flow Control */
donatien 0:013f5d54248c 233 #define EMAC_CR_RMII 0x00000200 /**< Reduced MII Interface */
donatien 0:013f5d54248c 234 #define EMAC_CR_FULL_DUP 0x00000400 /**< Full Duplex */
donatien 0:013f5d54248c 235
donatien 0:013f5d54248c 236 /*********************************************************************//**
donatien 0:013f5d54248c 237 * Macro defines for Status Register
donatien 0:013f5d54248c 238 **********************************************************************/
donatien 0:013f5d54248c 239 #define EMAC_SR_RX_EN 0x00000001 /**< Enable Receive */
donatien 0:013f5d54248c 240 #define EMAC_SR_TX_EN 0x00000002 /**< Enable Transmit */
donatien 0:013f5d54248c 241
donatien 0:013f5d54248c 242 /*********************************************************************//**
donatien 0:013f5d54248c 243 * Macro defines for Transmit Status Vector 0 Register
donatien 0:013f5d54248c 244 **********************************************************************/
donatien 0:013f5d54248c 245 #define EMAC_TSV0_CRC_ERR 0x00000001 /**< CRC error */
donatien 0:013f5d54248c 246 #define EMAC_TSV0_LEN_CHKERR 0x00000002 /**< Length Check Error */
donatien 0:013f5d54248c 247 #define EMAC_TSV0_LEN_OUTRNG 0x00000004 /**< Length Out of Range */
donatien 0:013f5d54248c 248 #define EMAC_TSV0_DONE 0x00000008 /**< Tramsmission Completed */
donatien 0:013f5d54248c 249 #define EMAC_TSV0_MCAST 0x00000010 /**< Multicast Destination */
donatien 0:013f5d54248c 250 #define EMAC_TSV0_BCAST 0x00000020 /**< Broadcast Destination */
donatien 0:013f5d54248c 251 #define EMAC_TSV0_PKT_DEFER 0x00000040 /**< Packet Deferred */
donatien 0:013f5d54248c 252 #define EMAC_TSV0_EXC_DEFER 0x00000080 /**< Excessive Packet Deferral */
donatien 0:013f5d54248c 253 #define EMAC_TSV0_EXC_COLL 0x00000100 /**< Excessive Collision */
donatien 0:013f5d54248c 254 #define EMAC_TSV0_LATE_COLL 0x00000200 /**< Late Collision Occured */
donatien 0:013f5d54248c 255 #define EMAC_TSV0_GIANT 0x00000400 /**< Giant Frame */
donatien 0:013f5d54248c 256 #define EMAC_TSV0_UNDERRUN 0x00000800 /**< Buffer Underrun */
donatien 0:013f5d54248c 257 #define EMAC_TSV0_BYTES 0x0FFFF000 /**< Total Bytes Transferred */
donatien 0:013f5d54248c 258 #define EMAC_TSV0_CTRL_FRAME 0x10000000 /**< Control Frame */
donatien 0:013f5d54248c 259 #define EMAC_TSV0_PAUSE 0x20000000 /**< Pause Frame */
donatien 0:013f5d54248c 260 #define EMAC_TSV0_BACK_PRESS 0x40000000 /**< Backpressure Method Applied */
donatien 0:013f5d54248c 261 #define EMAC_TSV0_VLAN 0x80000000 /**< VLAN Frame */
donatien 0:013f5d54248c 262
donatien 0:013f5d54248c 263 /*********************************************************************//**
donatien 0:013f5d54248c 264 * Macro defines for Transmit Status Vector 1 Register
donatien 0:013f5d54248c 265 **********************************************************************/
donatien 0:013f5d54248c 266 #define EMAC_TSV1_BYTE_CNT 0x0000FFFF /**< Transmit Byte Count */
donatien 0:013f5d54248c 267 #define EMAC_TSV1_COLL_CNT 0x000F0000 /**< Transmit Collision Count */
donatien 0:013f5d54248c 268
donatien 0:013f5d54248c 269 /*********************************************************************//**
donatien 0:013f5d54248c 270 * Macro defines for Receive Status Vector Register
donatien 0:013f5d54248c 271 **********************************************************************/
donatien 0:013f5d54248c 272 #define EMAC_RSV_BYTE_CNT 0x0000FFFF /**< Receive Byte Count */
donatien 0:013f5d54248c 273 #define EMAC_RSV_PKT_IGNORED 0x00010000 /**< Packet Previously Ignored */
donatien 0:013f5d54248c 274 #define EMAC_RSV_RXDV_SEEN 0x00020000 /**< RXDV Event Previously Seen */
donatien 0:013f5d54248c 275 #define EMAC_RSV_CARR_SEEN 0x00040000 /**< Carrier Event Previously Seen */
donatien 0:013f5d54248c 276 #define EMAC_RSV_REC_CODEV 0x00080000 /**< Receive Code Violation */
donatien 0:013f5d54248c 277 #define EMAC_RSV_CRC_ERR 0x00100000 /**< CRC Error */
donatien 0:013f5d54248c 278 #define EMAC_RSV_LEN_CHKERR 0x00200000 /**< Length Check Error */
donatien 0:013f5d54248c 279 #define EMAC_RSV_LEN_OUTRNG 0x00400000 /**< Length Out of Range */
donatien 0:013f5d54248c 280 #define EMAC_RSV_REC_OK 0x00800000 /**< Frame Received OK */
donatien 0:013f5d54248c 281 #define EMAC_RSV_MCAST 0x01000000 /**< Multicast Frame */
donatien 0:013f5d54248c 282 #define EMAC_RSV_BCAST 0x02000000 /**< Broadcast Frame */
donatien 0:013f5d54248c 283 #define EMAC_RSV_DRIB_NIBB 0x04000000 /**< Dribble Nibble */
donatien 0:013f5d54248c 284 #define EMAC_RSV_CTRL_FRAME 0x08000000 /**< Control Frame */
donatien 0:013f5d54248c 285 #define EMAC_RSV_PAUSE 0x10000000 /**< Pause Frame */
donatien 0:013f5d54248c 286 #define EMAC_RSV_UNSUPP_OPC 0x20000000 /**< Unsupported Opcode */
donatien 0:013f5d54248c 287 #define EMAC_RSV_VLAN 0x40000000 /**< VLAN Frame */
donatien 0:013f5d54248c 288
donatien 0:013f5d54248c 289 /*********************************************************************//**
donatien 0:013f5d54248c 290 * Macro defines for Flow Control Counter Register
donatien 0:013f5d54248c 291 **********************************************************************/
donatien 0:013f5d54248c 292 #define EMAC_FCC_MIRR_CNT(n) (n&0xFFFF) /**< Mirror Counter */
donatien 0:013f5d54248c 293 #define EMAC_FCC_PAUSE_TIM(n) ((n&0xFFFF)<<16) /**< Pause Timer */
donatien 0:013f5d54248c 294
donatien 0:013f5d54248c 295 /*********************************************************************//**
donatien 0:013f5d54248c 296 * Macro defines for Flow Control Status Register
donatien 0:013f5d54248c 297 **********************************************************************/
donatien 0:013f5d54248c 298 #define EMAC_FCS_MIRR_CNT(n) (n&0xFFFF) /**< Mirror Counter Current */
donatien 0:013f5d54248c 299
donatien 0:013f5d54248c 300
donatien 0:013f5d54248c 301 /* Receive filter register definitions -------------------------------------------------------- */
donatien 0:013f5d54248c 302 /*********************************************************************//**
donatien 0:013f5d54248c 303 * Macro defines for Receive Filter Control Register
donatien 0:013f5d54248c 304 **********************************************************************/
donatien 0:013f5d54248c 305 #define EMAC_RFC_UCAST_EN 0x00000001 /**< Accept Unicast Frames Enable */
donatien 0:013f5d54248c 306 #define EMAC_RFC_BCAST_EN 0x00000002 /**< Accept Broadcast Frames Enable */
donatien 0:013f5d54248c 307 #define EMAC_RFC_MCAST_EN 0x00000004 /**< Accept Multicast Frames Enable */
donatien 0:013f5d54248c 308 #define EMAC_RFC_UCAST_HASH_EN 0x00000008 /**< Accept Unicast Hash Filter Frames */
donatien 0:013f5d54248c 309 #define EMAC_RFC_MCAST_HASH_EN 0x00000010 /**< Accept Multicast Hash Filter Fram.*/
donatien 0:013f5d54248c 310 #define EMAC_RFC_PERFECT_EN 0x00000020 /**< Accept Perfect Match Enable */
donatien 0:013f5d54248c 311 #define EMAC_RFC_MAGP_WOL_EN 0x00001000 /**< Magic Packet Filter WoL Enable */
donatien 0:013f5d54248c 312 #define EMAC_RFC_PFILT_WOL_EN 0x00002000 /**< Perfect Filter WoL Enable */
donatien 0:013f5d54248c 313
donatien 0:013f5d54248c 314 /*********************************************************************//**
donatien 0:013f5d54248c 315 * Macro defines for Receive Filter WoL Status/Clear Registers
donatien 0:013f5d54248c 316 **********************************************************************/
donatien 0:013f5d54248c 317 #define EMAC_WOL_UCAST 0x00000001 /**< Unicast Frame caused WoL */
donatien 0:013f5d54248c 318 #define EMAC_WOL_BCAST 0x00000002 /**< Broadcast Frame caused WoL */
donatien 0:013f5d54248c 319 #define EMAC_WOL_MCAST 0x00000004 /**< Multicast Frame caused WoL */
donatien 0:013f5d54248c 320 #define EMAC_WOL_UCAST_HASH 0x00000008 /**< Unicast Hash Filter Frame WoL */
donatien 0:013f5d54248c 321 #define EMAC_WOL_MCAST_HASH 0x00000010 /**< Multicast Hash Filter Frame WoL */
donatien 0:013f5d54248c 322 #define EMAC_WOL_PERFECT 0x00000020 /**< Perfect Filter WoL */
donatien 0:013f5d54248c 323 #define EMAC_WOL_RX_FILTER 0x00000080 /**< RX Filter caused WoL */
donatien 0:013f5d54248c 324 #define EMAC_WOL_MAG_PACKET 0x00000100 /**< Magic Packet Filter caused WoL */
donatien 0:013f5d54248c 325 #define EMAC_WOL_BITMASK 0x01BF /**< Receive Filter WoL Status/Clear bitmasl value */
donatien 0:013f5d54248c 326
donatien 0:013f5d54248c 327
donatien 0:013f5d54248c 328 /* Module control register definitions ---------------------------------------------------- */
donatien 0:013f5d54248c 329 /*********************************************************************//**
donatien 0:013f5d54248c 330 * Macro defines for Interrupt Status/Enable/Clear/Set Registers
donatien 0:013f5d54248c 331 **********************************************************************/
donatien 0:013f5d54248c 332 #define EMAC_INT_RX_OVERRUN 0x00000001 /**< Overrun Error in RX Queue */
donatien 0:013f5d54248c 333 #define EMAC_INT_RX_ERR 0x00000002 /**< Receive Error */
donatien 0:013f5d54248c 334 #define EMAC_INT_RX_FIN 0x00000004 /**< RX Finished Process Descriptors */
donatien 0:013f5d54248c 335 #define EMAC_INT_RX_DONE 0x00000008 /**< Receive Done */
donatien 0:013f5d54248c 336 #define EMAC_INT_TX_UNDERRUN 0x00000010 /**< Transmit Underrun */
donatien 0:013f5d54248c 337 #define EMAC_INT_TX_ERR 0x00000020 /**< Transmit Error */
donatien 0:013f5d54248c 338 #define EMAC_INT_TX_FIN 0x00000040 /**< TX Finished Process Descriptors */
donatien 0:013f5d54248c 339 #define EMAC_INT_TX_DONE 0x00000080 /**< Transmit Done */
donatien 0:013f5d54248c 340 #define EMAC_INT_SOFT_INT 0x00001000 /**< Software Triggered Interrupt */
donatien 0:013f5d54248c 341 #define EMAC_INT_WAKEUP 0x00002000 /**< Wakeup Event Interrupt */
donatien 0:013f5d54248c 342
donatien 0:013f5d54248c 343 /*********************************************************************//**
donatien 0:013f5d54248c 344 * Macro defines for Power Down Register
donatien 0:013f5d54248c 345 **********************************************************************/
donatien 0:013f5d54248c 346 #define EMAC_PD_POWER_DOWN 0x80000000 /**< Power Down MAC */
donatien 0:013f5d54248c 347
donatien 0:013f5d54248c 348 /* Descriptor and status formats ---------------------------------------------------- */
donatien 0:013f5d54248c 349 /*********************************************************************//**
donatien 0:013f5d54248c 350 * Macro defines for RX Descriptor Control Word
donatien 0:013f5d54248c 351 **********************************************************************/
donatien 0:013f5d54248c 352 #define EMAC_RCTRL_SIZE(n) (n&0x7FF) /**< Buffer size field */
donatien 0:013f5d54248c 353 #define EMAC_RCTRL_INT 0x80000000 /**< Generate RxDone Interrupt */
donatien 0:013f5d54248c 354
donatien 0:013f5d54248c 355 /*********************************************************************//**
donatien 0:013f5d54248c 356 * Macro defines for RX Status Hash CRC Word
donatien 0:013f5d54248c 357 **********************************************************************/
donatien 0:013f5d54248c 358 #define EMAC_RHASH_SA 0x000001FF /**< Hash CRC for Source Address */
donatien 0:013f5d54248c 359 #define EMAC_RHASH_DA 0x001FF000 /**< Hash CRC for Destination Address */
donatien 0:013f5d54248c 360
donatien 0:013f5d54248c 361 /*********************************************************************//**
donatien 0:013f5d54248c 362 * Macro defines for RX Status Information Word
donatien 0:013f5d54248c 363 **********************************************************************/
donatien 0:013f5d54248c 364 #define EMAC_RINFO_SIZE 0x000007FF /**< Data size in bytes */
donatien 0:013f5d54248c 365 #define EMAC_RINFO_CTRL_FRAME 0x00040000 /**< Control Frame */
donatien 0:013f5d54248c 366 #define EMAC_RINFO_VLAN 0x00080000 /**< VLAN Frame */
donatien 0:013f5d54248c 367 #define EMAC_RINFO_FAIL_FILT 0x00100000 /**< RX Filter Failed */
donatien 0:013f5d54248c 368 #define EMAC_RINFO_MCAST 0x00200000 /**< Multicast Frame */
donatien 0:013f5d54248c 369 #define EMAC_RINFO_BCAST 0x00400000 /**< Broadcast Frame */
donatien 0:013f5d54248c 370 #define EMAC_RINFO_CRC_ERR 0x00800000 /**< CRC Error in Frame */
donatien 0:013f5d54248c 371 #define EMAC_RINFO_SYM_ERR 0x01000000 /**< Symbol Error from PHY */
donatien 0:013f5d54248c 372 #define EMAC_RINFO_LEN_ERR 0x02000000 /**< Length Error */
donatien 0:013f5d54248c 373 #define EMAC_RINFO_RANGE_ERR 0x04000000 /**< Range Error (exceeded max. size) */
donatien 0:013f5d54248c 374 #define EMAC_RINFO_ALIGN_ERR 0x08000000 /**< Alignment Error */
donatien 0:013f5d54248c 375 #define EMAC_RINFO_OVERRUN 0x10000000 /**< Receive overrun */
donatien 0:013f5d54248c 376 #define EMAC_RINFO_NO_DESCR 0x20000000 /**< No new Descriptor available */
donatien 0:013f5d54248c 377 #define EMAC_RINFO_LAST_FLAG 0x40000000 /**< Last Fragment in Frame */
donatien 0:013f5d54248c 378 #define EMAC_RINFO_ERR 0x80000000 /**< Error Occured (OR of all errors) */
donatien 0:013f5d54248c 379 #define EMAC_RINFO_ERR_MASK (EMAC_RINFO_FAIL_FILT | EMAC_RINFO_CRC_ERR | EMAC_RINFO_SYM_ERR | \
donatien 0:013f5d54248c 380 EMAC_RINFO_LEN_ERR | EMAC_RINFO_ALIGN_ERR | EMAC_RINFO_OVERRUN)
donatien 0:013f5d54248c 381
donatien 0:013f5d54248c 382 /*********************************************************************//**
donatien 0:013f5d54248c 383 * Macro defines for TX Descriptor Control Word
donatien 0:013f5d54248c 384 **********************************************************************/
donatien 0:013f5d54248c 385 #define EMAC_TCTRL_SIZE 0x000007FF /**< Size of data buffer in bytes */
donatien 0:013f5d54248c 386 #define EMAC_TCTRL_OVERRIDE 0x04000000 /**< Override Default MAC Registers */
donatien 0:013f5d54248c 387 #define EMAC_TCTRL_HUGE 0x08000000 /**< Enable Huge Frame */
donatien 0:013f5d54248c 388 #define EMAC_TCTRL_PAD 0x10000000 /**< Pad short Frames to 64 bytes */
donatien 0:013f5d54248c 389 #define EMAC_TCTRL_CRC 0x20000000 /**< Append a hardware CRC to Frame */
donatien 0:013f5d54248c 390 #define EMAC_TCTRL_LAST 0x40000000 /**< Last Descriptor for TX Frame */
donatien 0:013f5d54248c 391 #define EMAC_TCTRL_INT 0x80000000 /**< Generate TxDone Interrupt */
donatien 0:013f5d54248c 392
donatien 0:013f5d54248c 393 /*********************************************************************//**
donatien 0:013f5d54248c 394 * Macro defines for TX Status Information Word
donatien 0:013f5d54248c 395 **********************************************************************/
donatien 0:013f5d54248c 396 #define EMAC_TINFO_COL_CNT 0x01E00000 /**< Collision Count */
donatien 0:013f5d54248c 397 #define EMAC_TINFO_DEFER 0x02000000 /**< Packet Deferred (not an error) */
donatien 0:013f5d54248c 398 #define EMAC_TINFO_EXCESS_DEF 0x04000000 /**< Excessive Deferral */
donatien 0:013f5d54248c 399 #define EMAC_TINFO_EXCESS_COL 0x08000000 /**< Excessive Collision */
donatien 0:013f5d54248c 400 #define EMAC_TINFO_LATE_COL 0x10000000 /**< Late Collision Occured */
donatien 0:013f5d54248c 401 #define EMAC_TINFO_UNDERRUN 0x20000000 /**< Transmit Underrun */
donatien 0:013f5d54248c 402 #define EMAC_TINFO_NO_DESCR 0x40000000 /**< No new Descriptor available */
donatien 0:013f5d54248c 403 #define EMAC_TINFO_ERR 0x80000000 /**< Error Occured (OR of all errors) */
donatien 0:013f5d54248c 404
donatien 0:013f5d54248c 405 #ifdef MCB_LPC_1768
donatien 0:013f5d54248c 406 /* DP83848C PHY definition ------------------------------------------------------------ */
donatien 0:013f5d54248c 407
donatien 0:013f5d54248c 408 /** PHY device reset time out definition */
donatien 0:013f5d54248c 409 #define EMAC_PHY_RESP_TOUT 0x100000UL
donatien 0:013f5d54248c 410
donatien 0:013f5d54248c 411 /* ENET Device Revision ID */
donatien 0:013f5d54248c 412 #define EMAC_OLD_EMAC_MODULE_ID 0x39022000 /**< Rev. ID for first rev '-' */
donatien 0:013f5d54248c 413
donatien 0:013f5d54248c 414 /*********************************************************************//**
donatien 0:013f5d54248c 415 * Macro defines for DP83848C PHY Registers
donatien 0:013f5d54248c 416 **********************************************************************/
donatien 0:013f5d54248c 417 #define EMAC_PHY_REG_BMCR 0x00 /**< Basic Mode Control Register */
donatien 0:013f5d54248c 418 #define EMAC_PHY_REG_BMSR 0x01 /**< Basic Mode Status Register */
donatien 0:013f5d54248c 419 #define EMAC_PHY_REG_IDR1 0x02 /**< PHY Identifier 1 */
donatien 0:013f5d54248c 420 #define EMAC_PHY_REG_IDR2 0x03 /**< PHY Identifier 2 */
donatien 0:013f5d54248c 421 #define EMAC_PHY_REG_ANAR 0x04 /**< Auto-Negotiation Advertisement */
donatien 0:013f5d54248c 422 #define EMAC_PHY_REG_ANLPAR 0x05 /**< Auto-Neg. Link Partner Abitily */
donatien 0:013f5d54248c 423 #define EMAC_PHY_REG_ANER 0x06 /**< Auto-Neg. Expansion Register */
donatien 0:013f5d54248c 424 #define EMAC_PHY_REG_ANNPTR 0x07 /**< Auto-Neg. Next Page TX */
donatien 0:013f5d54248c 425 #define EMAC_PHY_REG_LPNPA 0x08
donatien 0:013f5d54248c 426
donatien 0:013f5d54248c 427 /*********************************************************************//**
donatien 0:013f5d54248c 428 * Macro defines for PHY Extended Registers
donatien 0:013f5d54248c 429 **********************************************************************/
donatien 0:013f5d54248c 430 #define EMAC_PHY_REG_STS 0x10 /**< Status Register */
donatien 0:013f5d54248c 431 #define EMAC_PHY_REG_MICR 0x11 /**< MII Interrupt Control Register */
donatien 0:013f5d54248c 432 #define EMAC_PHY_REG_MISR 0x12 /**< MII Interrupt Status Register */
donatien 0:013f5d54248c 433 #define EMAC_PHY_REG_FCSCR 0x14 /**< False Carrier Sense Counter */
donatien 0:013f5d54248c 434 #define EMAC_PHY_REG_RECR 0x15 /**< Receive Error Counter */
donatien 0:013f5d54248c 435 #define EMAC_PHY_REG_PCSR 0x16 /**< PCS Sublayer Config. and Status */
donatien 0:013f5d54248c 436 #define EMAC_PHY_REG_RBR 0x17 /**< RMII and Bypass Register */
donatien 0:013f5d54248c 437 #define EMAC_PHY_REG_LEDCR 0x18 /**< LED Direct Control Register */
donatien 0:013f5d54248c 438 #define EMAC_PHY_REG_PHYCR 0x19 /**< PHY Control Register */
donatien 0:013f5d54248c 439 #define EMAC_PHY_REG_10BTSCR 0x1A /**< 10Base-T Status/Control Register */
donatien 0:013f5d54248c 440 #define EMAC_PHY_REG_CDCTRL1 0x1B /**< CD Test Control and BIST Extens. */
donatien 0:013f5d54248c 441 #define EMAC_PHY_REG_EDCR 0x1D /**< Energy Detect Control Register */
donatien 0:013f5d54248c 442
donatien 0:013f5d54248c 443 /*********************************************************************//**
donatien 0:013f5d54248c 444 * Macro defines for PHY Basic Mode Control Register
donatien 0:013f5d54248c 445 **********************************************************************/
donatien 0:013f5d54248c 446 #define EMAC_PHY_BMCR_RESET (1<<15) /**< Reset bit */
donatien 0:013f5d54248c 447 #define EMAC_PHY_BMCR_LOOPBACK (1<<14) /**< Loop back */
donatien 0:013f5d54248c 448 #define EMAC_PHY_BMCR_SPEED_SEL (1<<13) /**< Speed selection */
donatien 0:013f5d54248c 449 #define EMAC_PHY_BMCR_AN (1<<12) /**< Auto Negotiation */
donatien 0:013f5d54248c 450 #define EMAC_PHY_BMCR_POWERDOWN (1<<11) /**< Power down mode */
donatien 0:013f5d54248c 451 #define EMAC_PHY_BMCR_ISOLATE (1<<10) /**< Isolate */
donatien 0:013f5d54248c 452 #define EMAC_PHY_BMCR_RE_AN (1<<9) /**< Restart auto negotiation */
donatien 0:013f5d54248c 453 #define EMAC_PHY_BMCR_DUPLEX (1<<8) /**< Duplex mode */
donatien 0:013f5d54248c 454
donatien 0:013f5d54248c 455 /*********************************************************************//**
donatien 0:013f5d54248c 456 * Macro defines for PHY Basic Mode Status Status Register
donatien 0:013f5d54248c 457 **********************************************************************/
donatien 0:013f5d54248c 458 #define EMAC_PHY_BMSR_100BE_T4 (1<<15) /**< 100 base T4 */
donatien 0:013f5d54248c 459 #define EMAC_PHY_BMSR_100TX_FULL (1<<14) /**< 100 base full duplex */
donatien 0:013f5d54248c 460 #define EMAC_PHY_BMSR_100TX_HALF (1<<13) /**< 100 base half duplex */
donatien 0:013f5d54248c 461 #define EMAC_PHY_BMSR_10BE_FULL (1<<12) /**< 10 base T full duplex */
donatien 0:013f5d54248c 462 #define EMAC_PHY_BMSR_10BE_HALF (1<<11) /**< 10 base T half duplex */
donatien 0:013f5d54248c 463 #define EMAC_PHY_BMSR_NOPREAM (1<<6) /**< MF Preamable Supress */
donatien 0:013f5d54248c 464 #define EMAC_PHY_BMSR_AUTO_DONE (1<<5) /**< Auto negotiation complete */
donatien 0:013f5d54248c 465 #define EMAC_PHY_BMSR_REMOTE_FAULT (1<<4) /**< Remote fault */
donatien 0:013f5d54248c 466 #define EMAC_PHY_BMSR_NO_AUTO (1<<3) /**< Auto Negotiation ability */
donatien 0:013f5d54248c 467 #define EMAC_PHY_BMSR_LINK_ESTABLISHED (1<<2) /**< Link status */
donatien 0:013f5d54248c 468
donatien 0:013f5d54248c 469 /*********************************************************************//**
donatien 0:013f5d54248c 470 * Macro defines for PHY Status Register
donatien 0:013f5d54248c 471 **********************************************************************/
donatien 0:013f5d54248c 472 #define EMAC_PHY_SR_REMOTE_FAULT (1<<6) /**< Remote Fault */
donatien 0:013f5d54248c 473 #define EMAC_PHY_SR_JABBER (1<<5) /**< Jabber detect */
donatien 0:013f5d54248c 474 #define EMAC_PHY_SR_AUTO_DONE (1<<4) /**< Auto Negotiation complete */
donatien 0:013f5d54248c 475 #define EMAC_PHY_SR_LOOPBACK (1<<3) /**< Loop back status */
donatien 0:013f5d54248c 476 #define EMAC_PHY_SR_DUP (1<<2) /**< Duplex status */
donatien 0:013f5d54248c 477 #define EMAC_PHY_SR_SPEED (1<<1) /**< Speed status */
donatien 0:013f5d54248c 478 #define EMAC_PHY_SR_LINK (1<<0) /**< Link Status */
donatien 0:013f5d54248c 479
donatien 0:013f5d54248c 480 #define EMAC_PHY_FULLD_100M 0x2100 /**< Full Duplex 100Mbit */
donatien 0:013f5d54248c 481 #define EMAC_PHY_HALFD_100M 0x2000 /**< Half Duplex 100Mbit */
donatien 0:013f5d54248c 482 #define EMAC_PHY_FULLD_10M 0x0100 /**< Full Duplex 10Mbit */
donatien 0:013f5d54248c 483 #define EMAC_PHY_HALFD_10M 0x0000 /**< Half Duplex 10MBit */
donatien 0:013f5d54248c 484 #define EMAC_PHY_AUTO_NEG 0x3000 /**< Select Auto Negotiation */
donatien 0:013f5d54248c 485
donatien 0:013f5d54248c 486 #define EMAC_DEF_ADR 0x0100 /**< Default PHY device address */
donatien 0:013f5d54248c 487 #define EMAC_DP83848C_ID 0x20005C90 /**< PHY Identifier */
donatien 0:013f5d54248c 488
donatien 0:013f5d54248c 489 #define EMAC_PHY_SR_100_SPEED ((1<<14)|(1<<13))
donatien 0:013f5d54248c 490 #define EMAC_PHY_SR_FULL_DUP ((1<<14)|(1<<12))
donatien 0:013f5d54248c 491 #define EMAC_PHY_BMSR_LINK_STATUS (1<<2) /**< Link status */
donatien 0:013f5d54248c 492
donatien 0:013f5d54248c 493 #elif defined(IAR_LPC_1768)
donatien 0:013f5d54248c 494 /* KSZ8721BL PHY definition ------------------------------------------------------------ */
donatien 0:013f5d54248c 495 /** PHY device reset time out definition */
donatien 0:013f5d54248c 496 #define EMAC_PHY_RESP_TOUT 0x100000UL
donatien 0:013f5d54248c 497
donatien 0:013f5d54248c 498 /* ENET Device Revision ID */
donatien 0:013f5d54248c 499 #define EMAC_OLD_EMAC_MODULE_ID 0x39022000 /**< Rev. ID for first rev '-' */
donatien 0:013f5d54248c 500
donatien 0:013f5d54248c 501 /*********************************************************************//**
donatien 0:013f5d54248c 502 * Macro defines for KSZ8721BL PHY Registers
donatien 0:013f5d54248c 503 **********************************************************************/
donatien 0:013f5d54248c 504 #define EMAC_PHY_REG_BMCR 0x00 /**< Basic Mode Control Register */
donatien 0:013f5d54248c 505 #define EMAC_PHY_REG_BMSR 0x01 /**< Basic Mode Status Register */
donatien 0:013f5d54248c 506 #define EMAC_PHY_REG_IDR1 0x02 /**< PHY Identifier 1 */
donatien 0:013f5d54248c 507 #define EMAC_PHY_REG_IDR2 0x03 /**< PHY Identifier 2 */
donatien 0:013f5d54248c 508 #define EMAC_PHY_REG_ANAR 0x04 /**< Auto-Negotiation Advertisement */
donatien 0:013f5d54248c 509 #define EMAC_PHY_REG_ANLPAR 0x05 /**< Auto-Neg. Link Partner Abitily */
donatien 0:013f5d54248c 510 #define EMAC_PHY_REG_ANER 0x06 /**< Auto-Neg. Expansion Register */
donatien 0:013f5d54248c 511 #define EMAC_PHY_REG_ANNPTR 0x07 /**< Auto-Neg. Next Page TX */
donatien 0:013f5d54248c 512 #define EMAC_PHY_REG_LPNPA 0x08 /**< Link Partner Next Page Ability */
donatien 0:013f5d54248c 513 #define EMAC_PHY_REG_REC 0x15 /**< RXError Counter Register */
donatien 0:013f5d54248c 514 #define EMAC_PHY_REG_ISC 0x1b /**< Interrupt Control/Status Register */
donatien 0:013f5d54248c 515 #define EMAC_PHY_REG_100BASE 0x1f /**< 100BASE-TX PHY Control Register */
donatien 0:013f5d54248c 516
donatien 0:013f5d54248c 517 /*********************************************************************//**
donatien 0:013f5d54248c 518 * Macro defines for PHY Basic Mode Control Register
donatien 0:013f5d54248c 519 **********************************************************************/
donatien 0:013f5d54248c 520 #define EMAC_PHY_BMCR_RESET (1<<15) /**< Reset bit */
donatien 0:013f5d54248c 521 #define EMAC_PHY_BMCR_LOOPBACK (1<<14) /**< Loop back */
donatien 0:013f5d54248c 522 #define EMAC_PHY_BMCR_SPEED_SEL (1<<13) /**< Speed selection */
donatien 0:013f5d54248c 523 #define EMAC_PHY_BMCR_AN (1<<12) /**< Auto Negotiation */
donatien 0:013f5d54248c 524 #define EMAC_PHY_BMCR_POWERDOWN (1<<11) /**< Power down mode */
donatien 0:013f5d54248c 525 #define EMAC_PHY_BMCR_ISOLATE (1<<10) /**< Isolate */
donatien 0:013f5d54248c 526 #define EMAC_PHY_BMCR_RE_AN (1<<9) /**< Restart auto negotiation */
donatien 0:013f5d54248c 527 #define EMAC_PHY_BMCR_DUPLEX (1<<8) /**< Duplex mode */
donatien 0:013f5d54248c 528 #define EMAC_PHY_BMCR_COLLISION (1<<7) /**< Collision test */
donatien 0:013f5d54248c 529 #define EMAC_PHY_BMCR_TXDIS (1<<0) /**< Disable transmit */
donatien 0:013f5d54248c 530
donatien 0:013f5d54248c 531 /*********************************************************************//**
donatien 0:013f5d54248c 532 * Macro defines for PHY Basic Mode Status Register
donatien 0:013f5d54248c 533 **********************************************************************/
donatien 0:013f5d54248c 534 #define EMAC_PHY_BMSR_100BE_T4 (1<<15) /**< 100 base T4 */
donatien 0:013f5d54248c 535 #define EMAC_PHY_BMSR_100TX_FULL (1<<14) /**< 100 base full duplex */
donatien 0:013f5d54248c 536 #define EMAC_PHY_BMSR_100TX_HALF (1<<13) /**< 100 base half duplex */
donatien 0:013f5d54248c 537 #define EMAC_PHY_BMSR_10BE_FULL (1<<12) /**< 10 base T full duplex */
donatien 0:013f5d54248c 538 #define EMAC_PHY_BMSR_10BE_HALF (1<<11) /**< 10 base T half duplex */
donatien 0:013f5d54248c 539 #define EMAC_PHY_BMSR_NOPREAM (1<<6) /**< MF Preamable Supress */
donatien 0:013f5d54248c 540 #define EMAC_PHY_BMSR_AUTO_DONE (1<<5) /**< Auto negotiation complete */
donatien 0:013f5d54248c 541 #define EMAC_PHY_BMSR_REMOTE_FAULT (1<<4) /**< Remote fault */
donatien 0:013f5d54248c 542 #define EMAC_PHY_BMSR_NO_AUTO (1<<3) /**< Auto Negotiation ability */
donatien 0:013f5d54248c 543 #define EMAC_PHY_BMSR_LINK_STATUS (1<<2) /**< Link status */
donatien 0:013f5d54248c 544 #define EMAC_PHY_BMSR_JABBER_DETECT (1<<1) /**< Jabber detect */
donatien 0:013f5d54248c 545 #define EMAC_PHY_BMSR_EXTEND (1<<0) /**< Extended support */
donatien 0:013f5d54248c 546
donatien 0:013f5d54248c 547 /*********************************************************************//**
donatien 0:013f5d54248c 548 * Macro defines for PHY Identifier
donatien 0:013f5d54248c 549 **********************************************************************/
donatien 0:013f5d54248c 550 /* PHY Identifier 1 bitmap definitions */
donatien 0:013f5d54248c 551 #define EMAC_PHY_IDR1(n) (n & 0xFFFF) /**< PHY ID1 Number */
donatien 0:013f5d54248c 552
donatien 0:013f5d54248c 553 /* PHY Identifier 2 bitmap definitions */
donatien 0:013f5d54248c 554 #define EMAC_PHY_IDR2(n) (n & 0xFFFF) /**< PHY ID2 Number */
donatien 0:013f5d54248c 555
donatien 0:013f5d54248c 556 /*********************************************************************//**
donatien 0:013f5d54248c 557 * Macro defines for Auto-Negotiation Advertisement
donatien 0:013f5d54248c 558 **********************************************************************/
donatien 0:013f5d54248c 559 #define EMAC_PHY_AN_NEXTPAGE (1<<15) /**< Next page capable */
donatien 0:013f5d54248c 560 #define EMAC_PHY_AN_REMOTE_FAULT (1<<13) /**< Remote Fault support */
donatien 0:013f5d54248c 561 #define EMAC_PHY_AN_PAUSE (1<<10) /**< Pause support */
donatien 0:013f5d54248c 562 #define EMAC_PHY_AN_100BASE_T4 (1<<9) /**< T4 capable */
donatien 0:013f5d54248c 563 #define EMAC_PHY_AN_100BASE_TX_FD (1<<8) /**< TX with Full-duplex capable */
donatien 0:013f5d54248c 564 #define EMAC_PHY_AN_100BASE_TX (1<<7) /**< TX capable */
donatien 0:013f5d54248c 565 #define EMAC_PHY_AN_10BASE_T_FD (1<<6) /**< 10Mbps with full-duplex capable */
donatien 0:013f5d54248c 566 #define EMAC_PHY_AN_10BASE_T (1<<5) /**< 10Mbps capable */
donatien 0:013f5d54248c 567 #define EMAC_PHY_AN_FIELD(n) (n & 0x1F) /**< Selector Field */
donatien 0:013f5d54248c 568
donatien 0:013f5d54248c 569 #define EMAC_PHY_FULLD_100M 0x2100 /**< Full Duplex 100Mbit */
donatien 0:013f5d54248c 570 #define EMAC_PHY_HALFD_100M 0x2000 /**< Half Duplex 100Mbit */
donatien 0:013f5d54248c 571 #define EMAC_PHY_FULLD_10M 0x0100 /**< Full Duplex 10Mbit */
donatien 0:013f5d54248c 572 #define EMAC_PHY_HALFD_10M 0x0000 /**< Half Duplex 10MBit */
donatien 0:013f5d54248c 573 #define EMAC_PHY_AUTO_NEG 0x3000 /**< Select Auto Negotiation */
donatien 0:013f5d54248c 574
donatien 0:013f5d54248c 575 #define EMAC_PHY_SR_100_SPEED ((1<<14)|(1<<13))
donatien 0:013f5d54248c 576 #define EMAC_PHY_SR_FULL_DUP ((1<<14)|(1<<12))
donatien 0:013f5d54248c 577
donatien 0:013f5d54248c 578 #define EMAC_DEF_ADR (0x01<<8) /**< Default PHY device address */
donatien 0:013f5d54248c 579 #define EMAC_KSZ8721BL_ID ((0x22 << 16) | 0x1619 ) /**< PHY Identifier */
donatien 0:013f5d54248c 580 #endif
donatien 0:013f5d54248c 581
donatien 0:013f5d54248c 582 /**
donatien 0:013f5d54248c 583 * @}
donatien 0:013f5d54248c 584 */
donatien 0:013f5d54248c 585
donatien 0:013f5d54248c 586 /** Ethernet block power/clock control bit*/
donatien 0:013f5d54248c 587 #define CLKPWR_PCONP_PCENET ((uint32_t)(1<<30))
donatien 0:013f5d54248c 588
donatien 0:013f5d54248c 589 #ifdef __cplusplus
donatien 0:013f5d54248c 590 }
donatien 0:013f5d54248c 591 #endif
donatien 0:013f5d54248c 592
donatien 0:013f5d54248c 593 #endif /* LPC17XX_EMAC_H_ */
donatien 0:013f5d54248c 594
donatien 0:013f5d54248c 595 /**
donatien 0:013f5d54248c 596 * @}
donatien 0:013f5d54248c 597 */
donatien 0:013f5d54248c 598
donatien 0:013f5d54248c 599 /* --------------------------------- End Of File ------------------------------ */