Webserver+3d print

Dependents:   Nucleo

Committer:
Sergunb
Date:
Sat Feb 04 18:15:49 2017 +0000
Revision:
0:8918a71cdbe9
nothing else

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergunb 0:8918a71cdbe9 1 /**
Sergunb 0:8918a71cdbe9 2 * @file ar8031.h
Sergunb 0:8918a71cdbe9 3 * @brief AR8031 Gigabit Ethernet PHY transceiver
Sergunb 0:8918a71cdbe9 4 *
Sergunb 0:8918a71cdbe9 5 * @section License
Sergunb 0:8918a71cdbe9 6 *
Sergunb 0:8918a71cdbe9 7 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
Sergunb 0:8918a71cdbe9 8 *
Sergunb 0:8918a71cdbe9 9 * This file is part of CycloneTCP Open.
Sergunb 0:8918a71cdbe9 10 *
Sergunb 0:8918a71cdbe9 11 * This program is free software; you can redistribute it and/or
Sergunb 0:8918a71cdbe9 12 * modify it under the terms of the GNU General Public License
Sergunb 0:8918a71cdbe9 13 * as published by the Free Software Foundation; either version 2
Sergunb 0:8918a71cdbe9 14 * of the License, or (at your option) any later version.
Sergunb 0:8918a71cdbe9 15 *
Sergunb 0:8918a71cdbe9 16 * This program is distributed in the hope that it will be useful,
Sergunb 0:8918a71cdbe9 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Sergunb 0:8918a71cdbe9 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Sergunb 0:8918a71cdbe9 19 * GNU General Public License for more details.
Sergunb 0:8918a71cdbe9 20 *
Sergunb 0:8918a71cdbe9 21 * You should have received a copy of the GNU General Public License
Sergunb 0:8918a71cdbe9 22 * along with this program; if not, write to the Free Software Foundation,
Sergunb 0:8918a71cdbe9 23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Sergunb 0:8918a71cdbe9 24 *
Sergunb 0:8918a71cdbe9 25 * @author Oryx Embedded SARL (www.oryx-embedded.com)
Sergunb 0:8918a71cdbe9 26 * @version 1.7.6
Sergunb 0:8918a71cdbe9 27 **/
Sergunb 0:8918a71cdbe9 28
Sergunb 0:8918a71cdbe9 29 #ifndef _AR8031_H
Sergunb 0:8918a71cdbe9 30 #define _AR8031_H
Sergunb 0:8918a71cdbe9 31
Sergunb 0:8918a71cdbe9 32 //Dependencies
Sergunb 0:8918a71cdbe9 33 #include "core/nic.h"
Sergunb 0:8918a71cdbe9 34
Sergunb 0:8918a71cdbe9 35 //PHY address
Sergunb 0:8918a71cdbe9 36 #ifndef AR8031_PHY_ADDR
Sergunb 0:8918a71cdbe9 37 #define AR8031_PHY_ADDR 0
Sergunb 0:8918a71cdbe9 38 #elif (AR8031_PHY_ADDR < 0 || AR8031_PHY_ADDR > 31)
Sergunb 0:8918a71cdbe9 39 #error AR8031_PHY_ADDR parameter is not valid
Sergunb 0:8918a71cdbe9 40 #endif
Sergunb 0:8918a71cdbe9 41
Sergunb 0:8918a71cdbe9 42 //AR8031 registers
Sergunb 0:8918a71cdbe9 43 #define AR8031_PHY_REG_BMCR 0x00
Sergunb 0:8918a71cdbe9 44 #define AR8031_PHY_REG_BMSR 0x01
Sergunb 0:8918a71cdbe9 45 #define AR8031_PHY_REG_PHYIDR1 0x02
Sergunb 0:8918a71cdbe9 46 #define AR8031_PHY_REG_PHYIDR2 0x03
Sergunb 0:8918a71cdbe9 47 #define AR8031_PHY_REG_ANAR 0x04
Sergunb 0:8918a71cdbe9 48 #define AR8031_PHY_REG_ANLPAR 0x05
Sergunb 0:8918a71cdbe9 49 #define AR8031_PHY_REG_ANER 0x06
Sergunb 0:8918a71cdbe9 50 #define AR8031_PHY_REG_ANNPTR 0x07
Sergunb 0:8918a71cdbe9 51 #define AR8031_PHY_REG_LPNPAR 0x08
Sergunb 0:8918a71cdbe9 52 #define AR8031_PHY_REG_1000BT_CTRL 0x09
Sergunb 0:8918a71cdbe9 53 #define AR8031_PHY_REG_1000BT_STATUS 0x0A
Sergunb 0:8918a71cdbe9 54 #define AR8031_PHY_REG_MMD_CTRL 0x0D
Sergunb 0:8918a71cdbe9 55 #define AR8031_PHY_REG_MMD_DATA 0x0E
Sergunb 0:8918a71cdbe9 56 #define AR8031_PHY_REG_EXT_STATUS 0x0F
Sergunb 0:8918a71cdbe9 57 #define AR8031_PHY_REG_FUNCTION_CTRL 0x10
Sergunb 0:8918a71cdbe9 58 #define AR8031_PHY_REG_PHY_STATUS 0x11
Sergunb 0:8918a71cdbe9 59 #define AR8031_PHY_REG_INT_EN 0x12
Sergunb 0:8918a71cdbe9 60 #define AR8031_PHY_REG_INT_STATUS 0x13
Sergunb 0:8918a71cdbe9 61 #define AR8031_PHY_REG_SMART_SPEED 0x14
Sergunb 0:8918a71cdbe9 62 #define AR8031_PHY_REG_CDT_CTRL 0x16
Sergunb 0:8918a71cdbe9 63 #define AR8031_PHY_REG_LED_CTRL 0x18
Sergunb 0:8918a71cdbe9 64 #define AR8031_PHY_REG_MAN_LED_OVERRIDE 0x19
Sergunb 0:8918a71cdbe9 65 #define AR8031_PHY_REG_CDT_STATUS 0x1C
Sergunb 0:8918a71cdbe9 66 #define AR8031_PHY_REG_DBG_PORT 0x1D
Sergunb 0:8918a71cdbe9 67 #define AR8031_PHY_REG_DBG_PORT2 0x1E
Sergunb 0:8918a71cdbe9 68 #define AR8031_PHY_REG_CHIP_CONFIG 0x1F
Sergunb 0:8918a71cdbe9 69
Sergunb 0:8918a71cdbe9 70 //BMCR register
Sergunb 0:8918a71cdbe9 71 #define BMCR_RESET (1 << 15)
Sergunb 0:8918a71cdbe9 72 #define BMCR_LOOPBACK (1 << 14)
Sergunb 0:8918a71cdbe9 73 #define BMCR_SPEED_SEL_LSB (1 << 13)
Sergunb 0:8918a71cdbe9 74 #define BMCR_AN_EN (1 << 12)
Sergunb 0:8918a71cdbe9 75 #define BMCR_POWER_DOWN (1 << 11)
Sergunb 0:8918a71cdbe9 76 #define BMCR_ISOLATE (1 << 10)
Sergunb 0:8918a71cdbe9 77 #define BMCR_RESTART_AN (1 << 9)
Sergunb 0:8918a71cdbe9 78 #define BMCR_DUPLEX_MODE (1 << 8)
Sergunb 0:8918a71cdbe9 79 #define BMCR_COL_TEST (1 << 7)
Sergunb 0:8918a71cdbe9 80 #define BMCR_SPEED_SEL_MSB (1 << 6)
Sergunb 0:8918a71cdbe9 81
Sergunb 0:8918a71cdbe9 82 //BMSR register
Sergunb 0:8918a71cdbe9 83 #define BMSR_100BT4 (1 << 15)
Sergunb 0:8918a71cdbe9 84 #define BMSR_100BTX_FD (1 << 14)
Sergunb 0:8918a71cdbe9 85 #define BMSR_100BTX_HD (1 << 13)
Sergunb 0:8918a71cdbe9 86 #define BMSR_10BT_FD (1 << 12)
Sergunb 0:8918a71cdbe9 87 #define BMSR_10BT_HD (1 << 11)
Sergunb 0:8918a71cdbe9 88 #define BMSR_100BT2_FD (1 << 10)
Sergunb 0:8918a71cdbe9 89 #define BMSR_100BT2_HD (1 << 9)
Sergunb 0:8918a71cdbe9 90 #define BMSR_EXTENDED_STATUS (1 << 8)
Sergunb 0:8918a71cdbe9 91 #define BMSR_NO_PREAMBLE (1 << 6)
Sergunb 0:8918a71cdbe9 92 #define BMSR_AN_COMPLETE (1 << 5)
Sergunb 0:8918a71cdbe9 93 #define BMSR_REMOTE_FAULT (1 << 4)
Sergunb 0:8918a71cdbe9 94 #define BMSR_AN_ABLE (1 << 3)
Sergunb 0:8918a71cdbe9 95 #define BMSR_LINK_STATUS (1 << 2)
Sergunb 0:8918a71cdbe9 96 #define BMSR_JABBER_DETECT (1 << 1)
Sergunb 0:8918a71cdbe9 97 #define BMSR_EXTENDED_CAP (1 << 0)
Sergunb 0:8918a71cdbe9 98
Sergunb 0:8918a71cdbe9 99 //ANAR register
Sergunb 0:8918a71cdbe9 100 #define ANAR_NEXT_PAGE (1 << 15)
Sergunb 0:8918a71cdbe9 101 #define ANAR_ACK (1 << 14)
Sergunb 0:8918a71cdbe9 102 #define ANAR_REMOTE_FAULT (1 << 13)
Sergunb 0:8918a71cdbe9 103 #define ANAR_XNP_ABLE (1 << 12)
Sergunb 0:8918a71cdbe9 104 #define ANAR_ASYMMETRIC_PAUSE (1 << 11)
Sergunb 0:8918a71cdbe9 105 #define ANAR_PAUSE (1 << 10)
Sergunb 0:8918a71cdbe9 106 #define ANAR_100BT4 (1 << 9)
Sergunb 0:8918a71cdbe9 107 #define ANAR_100BTX_FD (1 << 8)
Sergunb 0:8918a71cdbe9 108 #define ANAR_100BTX_HD (1 << 7)
Sergunb 0:8918a71cdbe9 109 #define ANAR_10BT_FD (1 << 6)
Sergunb 0:8918a71cdbe9 110 #define ANAR_10BT_HD (1 << 5)
Sergunb 0:8918a71cdbe9 111 #define ANAR_SELECTOR4 (1 << 4)
Sergunb 0:8918a71cdbe9 112 #define ANAR_SELECTOR3 (1 << 3)
Sergunb 0:8918a71cdbe9 113 #define ANAR_SELECTOR2 (1 << 2)
Sergunb 0:8918a71cdbe9 114 #define ANAR_SELECTOR1 (1 << 1)
Sergunb 0:8918a71cdbe9 115 #define ANAR_SELECTOR0 (1 << 0)
Sergunb 0:8918a71cdbe9 116
Sergunb 0:8918a71cdbe9 117 //ANLPAR register
Sergunb 0:8918a71cdbe9 118 #define ANLPAR_NEXT_PAGE (1 << 15)
Sergunb 0:8918a71cdbe9 119 #define ANLPAR_ACK (1 << 14)
Sergunb 0:8918a71cdbe9 120 #define ANLPAR_REMOTE_FAULT (1 << 13)
Sergunb 0:8918a71cdbe9 121 #define ANLPAR_ASYMMETRIC_PAUSE (1 << 11)
Sergunb 0:8918a71cdbe9 122 #define ANLPAR_PAUSE (1 << 10)
Sergunb 0:8918a71cdbe9 123 #define ANLPAR_100BT4 (1 << 9)
Sergunb 0:8918a71cdbe9 124 #define ANLPAR_100BTX_FD (1 << 8)
Sergunb 0:8918a71cdbe9 125 #define ANLPAR_100BTX_HD (1 << 7)
Sergunb 0:8918a71cdbe9 126 #define ANLPAR_10BT_FD (1 << 6)
Sergunb 0:8918a71cdbe9 127 #define ANLPAR_10BT_HD (1 << 5)
Sergunb 0:8918a71cdbe9 128 #define ANLPAR_SELECTOR4 (1 << 4)
Sergunb 0:8918a71cdbe9 129 #define ANLPAR_SELECTOR3 (1 << 3)
Sergunb 0:8918a71cdbe9 130 #define ANLPAR_SELECTOR2 (1 << 2)
Sergunb 0:8918a71cdbe9 131 #define ANLPAR_SELECTOR1 (1 << 1)
Sergunb 0:8918a71cdbe9 132 #define ANLPAR_SELECTOR0 (1 << 0)
Sergunb 0:8918a71cdbe9 133
Sergunb 0:8918a71cdbe9 134 //ANER register
Sergunb 0:8918a71cdbe9 135 #define ANER_PAR_DET_FAULT (1 << 4)
Sergunb 0:8918a71cdbe9 136 #define ANER_LP_NEXT_PAGE_ABLE (1 << 3)
Sergunb 0:8918a71cdbe9 137 #define ANER_NEXT_PAGE_ABLE (1 << 2)
Sergunb 0:8918a71cdbe9 138 #define ANER_PAGE_RECEIVED (1 << 1)
Sergunb 0:8918a71cdbe9 139 #define ANER_LP_AN_ABLE (1 << 0)
Sergunb 0:8918a71cdbe9 140
Sergunb 0:8918a71cdbe9 141 //ANNPTR register
Sergunb 0:8918a71cdbe9 142 #define ANNPTR_NEXT_PAGE (1 << 15)
Sergunb 0:8918a71cdbe9 143 #define ANNPTR_MSG_PAGE (1 << 13)
Sergunb 0:8918a71cdbe9 144 #define ANNPTR_ACK2 (1 << 12)
Sergunb 0:8918a71cdbe9 145 #define ANNPTR_TOGGLE (1 << 11)
Sergunb 0:8918a71cdbe9 146 #define ANNPTR_MESSAGE10 (1 << 10)
Sergunb 0:8918a71cdbe9 147 #define ANNPTR_MESSAGE9 (1 << 9)
Sergunb 0:8918a71cdbe9 148 #define ANNPTR_MESSAGE8 (1 << 8)
Sergunb 0:8918a71cdbe9 149 #define ANNPTR_MESSAGE7 (1 << 7)
Sergunb 0:8918a71cdbe9 150 #define ANNPTR_MESSAGE6 (1 << 6)
Sergunb 0:8918a71cdbe9 151 #define ANNPTR_MESSAGE5 (1 << 5)
Sergunb 0:8918a71cdbe9 152 #define ANNPTR_MESSAGE4 (1 << 4)
Sergunb 0:8918a71cdbe9 153 #define ANNPTR_MESSAGE3 (1 << 3)
Sergunb 0:8918a71cdbe9 154 #define ANNPTR_MESSAGE2 (1 << 2)
Sergunb 0:8918a71cdbe9 155 #define ANNPTR_MESSAGE1 (1 << 1)
Sergunb 0:8918a71cdbe9 156 #define ANNPTR_MESSAGE0 (1 << 0)
Sergunb 0:8918a71cdbe9 157
Sergunb 0:8918a71cdbe9 158 //LPNPAR register
Sergunb 0:8918a71cdbe9 159 #define LPNPAR_NEXT_PAGE (1 << 15)
Sergunb 0:8918a71cdbe9 160 #define LPNPAR_MSG_PAGE (1 << 13)
Sergunb 0:8918a71cdbe9 161 #define LPNPAR_ACK2 (1 << 12)
Sergunb 0:8918a71cdbe9 162 #define LPNPAR_TOGGLE (1 << 11)
Sergunb 0:8918a71cdbe9 163 #define LPNPAR_MESSAGE10 (1 << 10)
Sergunb 0:8918a71cdbe9 164 #define LPNPAR_MESSAGE9 (1 << 9)
Sergunb 0:8918a71cdbe9 165 #define LPNPAR_MESSAGE8 (1 << 8)
Sergunb 0:8918a71cdbe9 166 #define LPNPAR_MESSAGE7 (1 << 7)
Sergunb 0:8918a71cdbe9 167 #define LPNPAR_MESSAGE6 (1 << 6)
Sergunb 0:8918a71cdbe9 168 #define LPNPAR_MESSAGE5 (1 << 5)
Sergunb 0:8918a71cdbe9 169 #define LPNPAR_MESSAGE4 (1 << 4)
Sergunb 0:8918a71cdbe9 170 #define LPNPAR_MESSAGE3 (1 << 3)
Sergunb 0:8918a71cdbe9 171 #define LPNPAR_MESSAGE2 (1 << 2)
Sergunb 0:8918a71cdbe9 172 #define LPNPAR_MESSAGE1 (1 << 1)
Sergunb 0:8918a71cdbe9 173 #define LPNPAR_MESSAGE0 (1 << 0)
Sergunb 0:8918a71cdbe9 174
Sergunb 0:8918a71cdbe9 175 //1000BT_CTRL register
Sergunb 0:8918a71cdbe9 176 #define _1000BT_CTRL_TEST_MODE2 (1 << 15)
Sergunb 0:8918a71cdbe9 177 #define _1000BT_CTRL_TEST_MODE1 (1 << 14)
Sergunb 0:8918a71cdbe9 178 #define _1000BT_CTRL_TEST_MODE0 (1 << 13)
Sergunb 0:8918a71cdbe9 179 #define _1000BT_CTRL_MS_MAN_CONF_EN (1 << 12)
Sergunb 0:8918a71cdbe9 180 #define _1000BT_CTRL_MS_MAN_CONF_VAL (1 << 11)
Sergunb 0:8918a71cdbe9 181 #define _1000BT_CTRL_PORT_TYPE (1 << 10)
Sergunb 0:8918a71cdbe9 182 #define _1000BT_CTRL_1000BT_FD (1 << 9)
Sergunb 0:8918a71cdbe9 183 #define _1000BT_CTRL_1000BT_HD (1 << 8)
Sergunb 0:8918a71cdbe9 184
Sergunb 0:8918a71cdbe9 185 //1000BT_STATUS register
Sergunb 0:8918a71cdbe9 186 #define _1000BT_STATUS_MS_CONF_FAULT (1 << 15)
Sergunb 0:8918a71cdbe9 187 #define _1000BT_STATUS_MS_CONF_RES (1 << 14)
Sergunb 0:8918a71cdbe9 188 #define _1000BT_STATUS_LOC_REC_STATUS (1 << 13)
Sergunb 0:8918a71cdbe9 189 #define _1000BT_STATUS_REM_REC_STATUS (1 << 12)
Sergunb 0:8918a71cdbe9 190 #define _1000BT_STATUS_LP_1000BT_FD (1 << 11)
Sergunb 0:8918a71cdbe9 191 #define _1000BT_STATUS_LP_1000BT_HD (1 << 10)
Sergunb 0:8918a71cdbe9 192 #define _1000BT_STATUS_IDLE_ERR_CTR7 (1 << 7)
Sergunb 0:8918a71cdbe9 193 #define _1000BT_STATUS_IDLE_ERR_CTR6 (1 << 6)
Sergunb 0:8918a71cdbe9 194 #define _1000BT_STATUS_IDLE_ERR_CTR5 (1 << 5)
Sergunb 0:8918a71cdbe9 195 #define _1000BT_STATUS_IDLE_ERR_CTR4 (1 << 4)
Sergunb 0:8918a71cdbe9 196 #define _1000BT_STATUS_IDLE_ERR_CTR3 (1 << 3)
Sergunb 0:8918a71cdbe9 197 #define _1000BT_STATUS_IDLE_ERR_CTR2 (1 << 2)
Sergunb 0:8918a71cdbe9 198 #define _1000BT_STATUS_IDLE_ERR_CTR1 (1 << 1)
Sergunb 0:8918a71cdbe9 199 #define _1000BT_STATUS_IDLE_ERR_CTR0 (1 << 0)
Sergunb 0:8918a71cdbe9 200
Sergunb 0:8918a71cdbe9 201 //MMD_CTRL register
Sergunb 0:8918a71cdbe9 202 #define MMD_CTRL_FUNCTION1 (1 << 15)
Sergunb 0:8918a71cdbe9 203 #define MMD_CTRL_FUNCTION0 (1 << 14)
Sergunb 0:8918a71cdbe9 204 #define MMD_CTRL_DEVAD4 (1 << 4)
Sergunb 0:8918a71cdbe9 205 #define MMD_CTRL_DEVAD3 (1 << 3)
Sergunb 0:8918a71cdbe9 206 #define MMD_CTRL_DEVAD2 (1 << 2)
Sergunb 0:8918a71cdbe9 207 #define MMD_CTRL_DEVAD1 (1 << 1)
Sergunb 0:8918a71cdbe9 208 #define MMD_CTRL_DEVAD0 (1 << 0)
Sergunb 0:8918a71cdbe9 209
Sergunb 0:8918a71cdbe9 210 //EXT_STATUS register
Sergunb 0:8918a71cdbe9 211 #define EXT_STATUS_1000BX_FD (1 << 15)
Sergunb 0:8918a71cdbe9 212 #define EXT_STATUS_1000BX_HD (1 << 14)
Sergunb 0:8918a71cdbe9 213 #define EXT_STATUS_1000BT_FD (1 << 13)
Sergunb 0:8918a71cdbe9 214 #define EXT_STATUS_1000BT_HD (1 << 12)
Sergunb 0:8918a71cdbe9 215
Sergunb 0:8918a71cdbe9 216 //FUNCTION register
Sergunb 0:8918a71cdbe9 217 #define FUNCTION_ASSERT_CRS_ON_TX (1 << 11)
Sergunb 0:8918a71cdbe9 218 #define FUNCTION_FORCE_LINK (1 << 10)
Sergunb 0:8918a71cdbe9 219 #define FUNCTION_MDI_CROSSOVER_MODE1 (1 << 6)
Sergunb 0:8918a71cdbe9 220 #define FUNCTION_MDI_CROSSOVER_MODE0 (1 << 5)
Sergunb 0:8918a71cdbe9 221 #define FUNCTION_SQE_TEST (1 << 2)
Sergunb 0:8918a71cdbe9 222 #define FUNCTION_POLARITY_REVERSAL (1 << 1)
Sergunb 0:8918a71cdbe9 223 #define FUNCTION_DISABLE_JABBER (1 << 0)
Sergunb 0:8918a71cdbe9 224
Sergunb 0:8918a71cdbe9 225 //PHY_STATUS register
Sergunb 0:8918a71cdbe9 226 #define PHY_STATUS_SPEED1 (1 << 15)
Sergunb 0:8918a71cdbe9 227 #define PHY_STATUS_SPEED0 (1 << 14)
Sergunb 0:8918a71cdbe9 228 #define PHY_STATUS_DUPLEX (1 << 13)
Sergunb 0:8918a71cdbe9 229 #define PHY_STATUS_PAGE_RECEIVED (1 << 12)
Sergunb 0:8918a71cdbe9 230 #define PHY_STATUS_SPEED_DUPLEX_RESOLVED (1 << 11)
Sergunb 0:8918a71cdbe9 231 #define PHY_STATUS_LINK (1 << 10)
Sergunb 0:8918a71cdbe9 232 #define PHY_STATUS_MDI_CROSSOVER_STATUS (1 << 6)
Sergunb 0:8918a71cdbe9 233 #define PHY_STATUS_WIRESPEED_DOWNGRADE (1 << 5)
Sergunb 0:8918a71cdbe9 234 #define PHY_STATUS_TX_PAUSE_ENABLED (1 << 3)
Sergunb 0:8918a71cdbe9 235 #define PHY_STATUS_RX_PAUSE_ENABLED (1 << 2)
Sergunb 0:8918a71cdbe9 236 #define PHY_STATUS_POLARITY (1 << 1)
Sergunb 0:8918a71cdbe9 237 #define PHY_STATUS_JABBER (1 << 0)
Sergunb 0:8918a71cdbe9 238
Sergunb 0:8918a71cdbe9 239 //Speed
Sergunb 0:8918a71cdbe9 240 #define PHY_STATUS_SPEED_MASK (3 << 14)
Sergunb 0:8918a71cdbe9 241 #define PHY_STATUS_SPEED_10 (0 << 14)
Sergunb 0:8918a71cdbe9 242 #define PHY_STATUS_SPEED_100 (1 << 14)
Sergunb 0:8918a71cdbe9 243 #define PHY_STATUS_SPEED_1000 (2 << 14)
Sergunb 0:8918a71cdbe9 244
Sergunb 0:8918a71cdbe9 245 //INT_EN register
Sergunb 0:8918a71cdbe9 246 #define INT_EN_AN_ERROR (1 << 15)
Sergunb 0:8918a71cdbe9 247 #define INT_EN_SPEED_CHANGED (1 << 14)
Sergunb 0:8918a71cdbe9 248 #define INT_EN_PAGE_RECEIVED (1 << 12)
Sergunb 0:8918a71cdbe9 249 #define INT_EN_LINK_FAIL (1 << 11)
Sergunb 0:8918a71cdbe9 250 #define INT_EN_LINK_SUCCESS (1 << 10)
Sergunb 0:8918a71cdbe9 251 #define INT_EN_FAST_LINK_DOWN1 (1 << 9)
Sergunb 0:8918a71cdbe9 252 #define INT_EN_LINK_FAIL_BX (1 << 8)
Sergunb 0:8918a71cdbe9 253 #define INT_EN_LINK_SUCCESS_BX (1 << 7)
Sergunb 0:8918a71cdbe9 254 #define INT_EN_FAST_LINK_DOWN0 (1 << 6)
Sergunb 0:8918a71cdbe9 255 #define INT_EN_WIRESPEED_DOWNGRADE (1 << 5)
Sergunb 0:8918a71cdbe9 256 #define INT_EN_10MS_PTP (1 << 4)
Sergunb 0:8918a71cdbe9 257 #define INT_EN_RX_PTP (1 << 3)
Sergunb 0:8918a71cdbe9 258 #define INT_EN_TX_PTP (1 << 2)
Sergunb 0:8918a71cdbe9 259 #define INT_EN_POLARITY_CHANGED (1 << 1)
Sergunb 0:8918a71cdbe9 260 #define INT_EN_WOL_PTP (1 << 0)
Sergunb 0:8918a71cdbe9 261
Sergunb 0:8918a71cdbe9 262 //INT_STATUS register
Sergunb 0:8918a71cdbe9 263 #define INT_STATUS_AN_ERROR (1 << 15)
Sergunb 0:8918a71cdbe9 264 #define INT_STATUS_SPEED_CHANGED (1 << 14)
Sergunb 0:8918a71cdbe9 265 #define INT_STATUS_PAGE_RECEIVED (1 << 12)
Sergunb 0:8918a71cdbe9 266 #define INT_STATUS_LINK_FAIL (1 << 11)
Sergunb 0:8918a71cdbe9 267 #define INT_STATUS_LINK_SUCCESS (1 << 10)
Sergunb 0:8918a71cdbe9 268 #define INT_STATUS_FAST_LINK_DOWN1 (1 << 9)
Sergunb 0:8918a71cdbe9 269 #define INT_STATUS_LINK_FAIL_BX (1 << 8)
Sergunb 0:8918a71cdbe9 270 #define INT_STATUS_LINK_SUCCESS_BX (1 << 7)
Sergunb 0:8918a71cdbe9 271 #define INT_STATUS_FAST_LINK_DOWN0 (1 << 6)
Sergunb 0:8918a71cdbe9 272 #define INT_STATUS_WIRESPEED_DOWNGRADE (1 << 5)
Sergunb 0:8918a71cdbe9 273 #define INT_STATUS_10MS_PTP (1 << 4)
Sergunb 0:8918a71cdbe9 274 #define INT_STATUS_RX_PTP (1 << 3)
Sergunb 0:8918a71cdbe9 275 #define INT_STATUS_TX_PTP (1 << 2)
Sergunb 0:8918a71cdbe9 276 #define INT_STATUS_POLARITY_CHANGED (1 << 1)
Sergunb 0:8918a71cdbe9 277 #define INT_STATUS_WOL_PTP (1 << 0)
Sergunb 0:8918a71cdbe9 278
Sergunb 0:8918a71cdbe9 279 //SMART_SPEED register
Sergunb 0:8918a71cdbe9 280 #define SMART_SPEED_EN (1 << 5)
Sergunb 0:8918a71cdbe9 281 #define SMART_SPEED_RETRY_LIMIT2 (1 << 4)
Sergunb 0:8918a71cdbe9 282 #define SMART_SPEED_RETRY_LIMIT1 (1 << 3)
Sergunb 0:8918a71cdbe9 283 #define SMART_SPEED_RETRY_LIMIT0 (1 << 2)
Sergunb 0:8918a71cdbe9 284 #define SMART_SPEED_TIMER (1 << 1)
Sergunb 0:8918a71cdbe9 285
Sergunb 0:8918a71cdbe9 286 //CDT_CTRL register
Sergunb 0:8918a71cdbe9 287 #define CDT_CTRL_MDI_PAIR_SELECT1 (1 << 9)
Sergunb 0:8918a71cdbe9 288 #define CDT_CTRL_MDI_PAIR_SELECT0 (1 << 8)
Sergunb 0:8918a71cdbe9 289 #define CDT_CTRL_ENABLE_TEST (1 << 0)
Sergunb 0:8918a71cdbe9 290
Sergunb 0:8918a71cdbe9 291 //LED_CTRL register
Sergunb 0:8918a71cdbe9 292 #define LED_CTRL_DISABLE_LED (1 << 15)
Sergunb 0:8918a71cdbe9 293 #define LED_CTRL_LED_ON_TIME2 (1 << 14)
Sergunb 0:8918a71cdbe9 294 #define LED_CTRL_LED_ON_TIME1 (1 << 13)
Sergunb 0:8918a71cdbe9 295 #define LED_CTRL_LED_ON_TIME0 (1 << 12)
Sergunb 0:8918a71cdbe9 296 #define LED_CTRL_LED_OFF_TIME2 (1 << 10)
Sergunb 0:8918a71cdbe9 297 #define LED_CTRL_LED_OFF_TIME1 (1 << 9)
Sergunb 0:8918a71cdbe9 298 #define LED_CTRL_LED_OFF_TIME0 (1 << 8)
Sergunb 0:8918a71cdbe9 299 #define LED_CTRL_LED_LINK_CTRL1 (1 << 4)
Sergunb 0:8918a71cdbe9 300 #define LED_CTRL_LED_LINK_CTRL0 (1 << 3)
Sergunb 0:8918a71cdbe9 301 #define LED_CTRL_LED_ACT_CTRL (1 << 1)
Sergunb 0:8918a71cdbe9 302
Sergunb 0:8918a71cdbe9 303 //MAN_LED_OVERRIDE register
Sergunb 0:8918a71cdbe9 304 #define MAN_LED_OVERRIDE_LED_ACT_CTRL (1 << 12)
Sergunb 0:8918a71cdbe9 305 #define MAN_LED_OVERRIDE_LED_LINK_CTRL1 (1 << 7)
Sergunb 0:8918a71cdbe9 306 #define MAN_LED_OVERRIDE_LED_LINK_CTRL0 (1 << 6)
Sergunb 0:8918a71cdbe9 307 #define MAN_LED_OVERRIDE_LED_RX_CTRL1 (1 << 3)
Sergunb 0:8918a71cdbe9 308 #define MAN_LED_OVERRIDE_LED_RX_CTRL0 (1 << 2)
Sergunb 0:8918a71cdbe9 309 #define MAN_LED_OVERRIDE_LED_TX_CTRL1 (1 << 1)
Sergunb 0:8918a71cdbe9 310 #define MAN_LED_OVERRIDE_LED_TX_CTRL0 (1 << 0)
Sergunb 0:8918a71cdbe9 311
Sergunb 0:8918a71cdbe9 312 //CDT_STATUS register
Sergunb 0:8918a71cdbe9 313 #define CDT_STATUS_STATUS1 (1 << 9)
Sergunb 0:8918a71cdbe9 314 #define CDT_STATUS_STATUS0 (1 << 8)
Sergunb 0:8918a71cdbe9 315 #define CDT_STATUS_DELTA_TIME7 (1 << 7)
Sergunb 0:8918a71cdbe9 316 #define CDT_STATUS_DELTA_TIME6 (1 << 6)
Sergunb 0:8918a71cdbe9 317 #define CDT_STATUS_DELTA_TIME5 (1 << 5)
Sergunb 0:8918a71cdbe9 318 #define CDT_STATUS_DELTA_TIME4 (1 << 4)
Sergunb 0:8918a71cdbe9 319 #define CDT_STATUS_DELTA_TIME3 (1 << 3)
Sergunb 0:8918a71cdbe9 320 #define CDT_STATUS_DELTA_TIME2 (1 << 2)
Sergunb 0:8918a71cdbe9 321 #define CDT_STATUS_DELTA_TIME1 (1 << 1)
Sergunb 0:8918a71cdbe9 322 #define CDT_STATUS_DELTA_TIME0 (1 << 0)
Sergunb 0:8918a71cdbe9 323
Sergunb 0:8918a71cdbe9 324 //CHIP_CONF register
Sergunb 0:8918a71cdbe9 325 #define CHIP_CONFIG_BT_BX_REG_SEL (1 << 15)
Sergunb 0:8918a71cdbe9 326 #define CHIP_CONFIG_SMII_IMP_50_75_AUTO (1 << 14)
Sergunb 0:8918a71cdbe9 327 #define CHIP_CONFIG_SGMII_RXIMP_50_75 (1 << 13)
Sergunb 0:8918a71cdbe9 328 #define CHIP_CONFIG_SGMII_TXIMP_50_75 (1 << 12)
Sergunb 0:8918a71cdbe9 329 #define CHIP_CONFIG_PRIORITY_SEL (1 << 10)
Sergunb 0:8918a71cdbe9 330 #define CHIP_CONFIG_FIBER_MODE_AUTO (1 << 8)
Sergunb 0:8918a71cdbe9 331 #define CHIP_CONFIG_MODE_CFG_QUAL3 (1 << 7)
Sergunb 0:8918a71cdbe9 332 #define CHIP_CONFIG_MODE_CFG_QUAL2 (1 << 6)
Sergunb 0:8918a71cdbe9 333 #define CHIP_CONFIG_MODE_CFG_QUAL1 (1 << 5)
Sergunb 0:8918a71cdbe9 334 #define CHIP_CONFIG_MODE_CFG_QUAL0 (1 << 4)
Sergunb 0:8918a71cdbe9 335 #define CHIP_CONFIG_MODE_CFG3 (1 << 3)
Sergunb 0:8918a71cdbe9 336 #define CHIP_CONFIG_MODE_CFG2 (1 << 2)
Sergunb 0:8918a71cdbe9 337 #define CHIP_CONFIG_MODE_CFG1 (1 << 1)
Sergunb 0:8918a71cdbe9 338 #define CHIP_CONFIG_MODE_CFG0 (1 << 0)
Sergunb 0:8918a71cdbe9 339
Sergunb 0:8918a71cdbe9 340 //AR8031 Ethernet PHY driver
Sergunb 0:8918a71cdbe9 341 extern const PhyDriver ar8031PhyDriver;
Sergunb 0:8918a71cdbe9 342
Sergunb 0:8918a71cdbe9 343 //AR8031 related functions
Sergunb 0:8918a71cdbe9 344 error_t ar8031Init(NetInterface *interface);
Sergunb 0:8918a71cdbe9 345
Sergunb 0:8918a71cdbe9 346 void ar8031Tick(NetInterface *interface);
Sergunb 0:8918a71cdbe9 347
Sergunb 0:8918a71cdbe9 348 void ar8031EnableIrq(NetInterface *interface);
Sergunb 0:8918a71cdbe9 349 void ar8031DisableIrq(NetInterface *interface);
Sergunb 0:8918a71cdbe9 350
Sergunb 0:8918a71cdbe9 351 void ar8031EventHandler(NetInterface *interface);
Sergunb 0:8918a71cdbe9 352
Sergunb 0:8918a71cdbe9 353 void ar8031WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data);
Sergunb 0:8918a71cdbe9 354 uint16_t ar8031ReadPhyReg(NetInterface *interface, uint8_t address);
Sergunb 0:8918a71cdbe9 355
Sergunb 0:8918a71cdbe9 356 void ar8031DumpPhyReg(NetInterface *interface);
Sergunb 0:8918a71cdbe9 357
Sergunb 0:8918a71cdbe9 358 #endif
Sergunb 0:8918a71cdbe9 359