Bouncing Betty Halloween Prop. A prop skull mounted with an mbed microcontroller armed to scare anyone who comes close to it. This project uses an infrared sonar, speaker, and, shiftbrite LEDs.

Dependencies:   mbed wave_player

Committer:
mafischl
Date:
Thu Oct 27 07:19:10 2011 +0000
Revision:
0:92661f51fe68

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mafischl 0:92661f51fe68 1 /* mbed PowerControl Library
mafischl 0:92661f51fe68 2 * Copyright (c) 2010 Michael Wei
mafischl 0:92661f51fe68 3 */
mafischl 0:92661f51fe68 4
mafischl 0:92661f51fe68 5 #ifndef MBED_POWERCONTROL_ETH_H
mafischl 0:92661f51fe68 6 #define MBED_POWERCONTROL_ETH_H
mafischl 0:92661f51fe68 7
mafischl 0:92661f51fe68 8 #include "mbed.h"
mafischl 0:92661f51fe68 9 #include "PowerControl.h"
mafischl 0:92661f51fe68 10
mafischl 0:92661f51fe68 11 #define PHY_REG_BMCR_POWERDOWN 0xB
mafischl 0:92661f51fe68 12 #define PHY_REG_EDCR_ENABLE 0xF
mafischl 0:92661f51fe68 13
mafischl 0:92661f51fe68 14
mafischl 0:92661f51fe68 15 void EMAC_Init();
mafischl 0:92661f51fe68 16 static unsigned short read_PHY (unsigned int PhyReg);
mafischl 0:92661f51fe68 17 static void write_PHY (unsigned int PhyReg, unsigned short Value);
mafischl 0:92661f51fe68 18
mafischl 0:92661f51fe68 19 void PHY_PowerDown(void);
mafischl 0:92661f51fe68 20 void PHY_PowerUp(void);
mafischl 0:92661f51fe68 21 void PHY_EnergyDetect_Enable(void);
mafischl 0:92661f51fe68 22 void PHY_EnergyDetect_Disable(void);
mafischl 0:92661f51fe68 23
mafischl 0:92661f51fe68 24 //From NXP Sample Code .... Probably from KEIL sample code
mafischl 0:92661f51fe68 25 /* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
mafischl 0:92661f51fe68 26 #define NUM_RX_FRAG 4 /* Num.of RX Fragments 4*1536= 6.0kB */
mafischl 0:92661f51fe68 27 #define NUM_TX_FRAG 3 /* Num.of TX Fragments 3*1536= 4.6kB */
mafischl 0:92661f51fe68 28 #define ETH_FRAG_SIZE 1536 /* Packet Fragment size 1536 Bytes */
mafischl 0:92661f51fe68 29
mafischl 0:92661f51fe68 30 #define ETH_MAX_FLEN 1536 /* Max. Ethernet Frame Size */
mafischl 0:92661f51fe68 31
mafischl 0:92661f51fe68 32 /* EMAC variables located in 16K Ethernet SRAM */
mafischl 0:92661f51fe68 33 #define RX_DESC_BASE 0x20080000
mafischl 0:92661f51fe68 34 #define RX_STAT_BASE (RX_DESC_BASE + NUM_RX_FRAG*8)
mafischl 0:92661f51fe68 35 #define TX_DESC_BASE (RX_STAT_BASE + NUM_RX_FRAG*8)
mafischl 0:92661f51fe68 36 #define TX_STAT_BASE (TX_DESC_BASE + NUM_TX_FRAG*8)
mafischl 0:92661f51fe68 37 #define RX_BUF_BASE (TX_STAT_BASE + NUM_TX_FRAG*4)
mafischl 0:92661f51fe68 38 #define TX_BUF_BASE (RX_BUF_BASE + NUM_RX_FRAG*ETH_FRAG_SIZE)
mafischl 0:92661f51fe68 39
mafischl 0:92661f51fe68 40 /* RX and TX descriptor and status definitions. */
mafischl 0:92661f51fe68 41 #define RX_DESC_PACKET(i) (*(unsigned int *)(RX_DESC_BASE + 8*i))
mafischl 0:92661f51fe68 42 #define RX_DESC_CTRL(i) (*(unsigned int *)(RX_DESC_BASE+4 + 8*i))
mafischl 0:92661f51fe68 43 #define RX_STAT_INFO(i) (*(unsigned int *)(RX_STAT_BASE + 8*i))
mafischl 0:92661f51fe68 44 #define RX_STAT_HASHCRC(i) (*(unsigned int *)(RX_STAT_BASE+4 + 8*i))
mafischl 0:92661f51fe68 45 #define TX_DESC_PACKET(i) (*(unsigned int *)(TX_DESC_BASE + 8*i))
mafischl 0:92661f51fe68 46 #define TX_DESC_CTRL(i) (*(unsigned int *)(TX_DESC_BASE+4 + 8*i))
mafischl 0:92661f51fe68 47 #define TX_STAT_INFO(i) (*(unsigned int *)(TX_STAT_BASE + 4*i))
mafischl 0:92661f51fe68 48 #define RX_BUF(i) (RX_BUF_BASE + ETH_FRAG_SIZE*i)
mafischl 0:92661f51fe68 49 #define TX_BUF(i) (TX_BUF_BASE + ETH_FRAG_SIZE*i)
mafischl 0:92661f51fe68 50
mafischl 0:92661f51fe68 51 /* MAC Configuration Register 1 */
mafischl 0:92661f51fe68 52 #define MAC1_REC_EN 0x00000001 /* Receive Enable */
mafischl 0:92661f51fe68 53 #define MAC1_PASS_ALL 0x00000002 /* Pass All Receive Frames */
mafischl 0:92661f51fe68 54 #define MAC1_RX_FLOWC 0x00000004 /* RX Flow Control */
mafischl 0:92661f51fe68 55 #define MAC1_TX_FLOWC 0x00000008 /* TX Flow Control */
mafischl 0:92661f51fe68 56 #define MAC1_LOOPB 0x00000010 /* Loop Back Mode */
mafischl 0:92661f51fe68 57 #define MAC1_RES_TX 0x00000100 /* Reset TX Logic */
mafischl 0:92661f51fe68 58 #define MAC1_RES_MCS_TX 0x00000200 /* Reset MAC TX Control Sublayer */
mafischl 0:92661f51fe68 59 #define MAC1_RES_RX 0x00000400 /* Reset RX Logic */
mafischl 0:92661f51fe68 60 #define MAC1_RES_MCS_RX 0x00000800 /* Reset MAC RX Control Sublayer */
mafischl 0:92661f51fe68 61 #define MAC1_SIM_RES 0x00004000 /* Simulation Reset */
mafischl 0:92661f51fe68 62 #define MAC1_SOFT_RES 0x00008000 /* Soft Reset MAC */
mafischl 0:92661f51fe68 63
mafischl 0:92661f51fe68 64 /* MAC Configuration Register 2 */
mafischl 0:92661f51fe68 65 #define MAC2_FULL_DUP 0x00000001 /* Full Duplex Mode */
mafischl 0:92661f51fe68 66 #define MAC2_FRM_LEN_CHK 0x00000002 /* Frame Length Checking */
mafischl 0:92661f51fe68 67 #define MAC2_HUGE_FRM_EN 0x00000004 /* Huge Frame Enable */
mafischl 0:92661f51fe68 68 #define MAC2_DLY_CRC 0x00000008 /* Delayed CRC Mode */
mafischl 0:92661f51fe68 69 #define MAC2_CRC_EN 0x00000010 /* Append CRC to every Frame */
mafischl 0:92661f51fe68 70 #define MAC2_PAD_EN 0x00000020 /* Pad all Short Frames */
mafischl 0:92661f51fe68 71 #define MAC2_VLAN_PAD_EN 0x00000040 /* VLAN Pad Enable */
mafischl 0:92661f51fe68 72 #define MAC2_ADET_PAD_EN 0x00000080 /* Auto Detect Pad Enable */
mafischl 0:92661f51fe68 73 #define MAC2_PPREAM_ENF 0x00000100 /* Pure Preamble Enforcement */
mafischl 0:92661f51fe68 74 #define MAC2_LPREAM_ENF 0x00000200 /* Long Preamble Enforcement */
mafischl 0:92661f51fe68 75 #define MAC2_NO_BACKOFF 0x00001000 /* No Backoff Algorithm */
mafischl 0:92661f51fe68 76 #define MAC2_BACK_PRESSURE 0x00002000 /* Backoff Presurre / No Backoff */
mafischl 0:92661f51fe68 77 #define MAC2_EXCESS_DEF 0x00004000 /* Excess Defer */
mafischl 0:92661f51fe68 78
mafischl 0:92661f51fe68 79 /* Back-to-Back Inter-Packet-Gap Register */
mafischl 0:92661f51fe68 80 #define IPGT_FULL_DUP 0x00000015 /* Recommended value for Full Duplex */
mafischl 0:92661f51fe68 81 #define IPGT_HALF_DUP 0x00000012 /* Recommended value for Half Duplex */
mafischl 0:92661f51fe68 82
mafischl 0:92661f51fe68 83 /* Non Back-to-Back Inter-Packet-Gap Register */
mafischl 0:92661f51fe68 84 #define IPGR_DEF 0x00000012 /* Recommended value */
mafischl 0:92661f51fe68 85
mafischl 0:92661f51fe68 86 /* Collision Window/Retry Register */
mafischl 0:92661f51fe68 87 #define CLRT_DEF 0x0000370F /* Default value */
mafischl 0:92661f51fe68 88
mafischl 0:92661f51fe68 89 /* PHY Support Register */
mafischl 0:92661f51fe68 90 #define SUPP_SPEED 0x00000100 /* Reduced MII Logic Current Speed */
mafischl 0:92661f51fe68 91 #define SUPP_RES_RMII 0x00000800 /* Reset Reduced MII Logic */
mafischl 0:92661f51fe68 92
mafischl 0:92661f51fe68 93 /* Test Register */
mafischl 0:92661f51fe68 94 #define TEST_SHCUT_PQUANTA 0x00000001 /* Shortcut Pause Quanta */
mafischl 0:92661f51fe68 95 #define TEST_TST_PAUSE 0x00000002 /* Test Pause */
mafischl 0:92661f51fe68 96 #define TEST_TST_BACKP 0x00000004 /* Test Back Pressure */
mafischl 0:92661f51fe68 97
mafischl 0:92661f51fe68 98 /* MII Management Configuration Register */
mafischl 0:92661f51fe68 99 #define MCFG_SCAN_INC 0x00000001 /* Scan Increment PHY Address */
mafischl 0:92661f51fe68 100 #define MCFG_SUPP_PREAM 0x00000002 /* Suppress Preamble */
mafischl 0:92661f51fe68 101 #define MCFG_CLK_SEL 0x0000001C /* Clock Select Mask */
mafischl 0:92661f51fe68 102 #define MCFG_RES_MII 0x00008000 /* Reset MII Management Hardware */
mafischl 0:92661f51fe68 103
mafischl 0:92661f51fe68 104 /* MII Management Command Register */
mafischl 0:92661f51fe68 105 #define MCMD_READ 0x00000001 /* MII Read */
mafischl 0:92661f51fe68 106 #define MCMD_SCAN 0x00000002 /* MII Scan continuously */
mafischl 0:92661f51fe68 107
mafischl 0:92661f51fe68 108 #define MII_WR_TOUT 0x00050000 /* MII Write timeout count */
mafischl 0:92661f51fe68 109 #define MII_RD_TOUT 0x00050000 /* MII Read timeout count */
mafischl 0:92661f51fe68 110
mafischl 0:92661f51fe68 111 /* MII Management Address Register */
mafischl 0:92661f51fe68 112 #define MADR_REG_ADR 0x0000001F /* MII Register Address Mask */
mafischl 0:92661f51fe68 113 #define MADR_PHY_ADR 0x00001F00 /* PHY Address Mask */
mafischl 0:92661f51fe68 114
mafischl 0:92661f51fe68 115 /* MII Management Indicators Register */
mafischl 0:92661f51fe68 116 #define MIND_BUSY 0x00000001 /* MII is Busy */
mafischl 0:92661f51fe68 117 #define MIND_SCAN 0x00000002 /* MII Scanning in Progress */
mafischl 0:92661f51fe68 118 #define MIND_NOT_VAL 0x00000004 /* MII Read Data not valid */
mafischl 0:92661f51fe68 119 #define MIND_MII_LINK_FAIL 0x00000008 /* MII Link Failed */
mafischl 0:92661f51fe68 120
mafischl 0:92661f51fe68 121 /* Command Register */
mafischl 0:92661f51fe68 122 #define CR_RX_EN 0x00000001 /* Enable Receive */
mafischl 0:92661f51fe68 123 #define CR_TX_EN 0x00000002 /* Enable Transmit */
mafischl 0:92661f51fe68 124 #define CR_REG_RES 0x00000008 /* Reset Host Registers */
mafischl 0:92661f51fe68 125 #define CR_TX_RES 0x00000010 /* Reset Transmit Datapath */
mafischl 0:92661f51fe68 126 #define CR_RX_RES 0x00000020 /* Reset Receive Datapath */
mafischl 0:92661f51fe68 127 #define CR_PASS_RUNT_FRM 0x00000040 /* Pass Runt Frames */
mafischl 0:92661f51fe68 128 #define CR_PASS_RX_FILT 0x00000080 /* Pass RX Filter */
mafischl 0:92661f51fe68 129 #define CR_TX_FLOW_CTRL 0x00000100 /* TX Flow Control */
mafischl 0:92661f51fe68 130 #define CR_RMII 0x00000200 /* Reduced MII Interface */
mafischl 0:92661f51fe68 131 #define CR_FULL_DUP 0x00000400 /* Full Duplex */
mafischl 0:92661f51fe68 132
mafischl 0:92661f51fe68 133 /* Status Register */
mafischl 0:92661f51fe68 134 #define SR_RX_EN 0x00000001 /* Enable Receive */
mafischl 0:92661f51fe68 135 #define SR_TX_EN 0x00000002 /* Enable Transmit */
mafischl 0:92661f51fe68 136
mafischl 0:92661f51fe68 137 /* Transmit Status Vector 0 Register */
mafischl 0:92661f51fe68 138 #define TSV0_CRC_ERR 0x00000001 /* CRC error */
mafischl 0:92661f51fe68 139 #define TSV0_LEN_CHKERR 0x00000002 /* Length Check Error */
mafischl 0:92661f51fe68 140 #define TSV0_LEN_OUTRNG 0x00000004 /* Length Out of Range */
mafischl 0:92661f51fe68 141 #define TSV0_DONE 0x00000008 /* Tramsmission Completed */
mafischl 0:92661f51fe68 142 #define TSV0_MCAST 0x00000010 /* Multicast Destination */
mafischl 0:92661f51fe68 143 #define TSV0_BCAST 0x00000020 /* Broadcast Destination */
mafischl 0:92661f51fe68 144 #define TSV0_PKT_DEFER 0x00000040 /* Packet Deferred */
mafischl 0:92661f51fe68 145 #define TSV0_EXC_DEFER 0x00000080 /* Excessive Packet Deferral */
mafischl 0:92661f51fe68 146 #define TSV0_EXC_COLL 0x00000100 /* Excessive Collision */
mafischl 0:92661f51fe68 147 #define TSV0_LATE_COLL 0x00000200 /* Late Collision Occured */
mafischl 0:92661f51fe68 148 #define TSV0_GIANT 0x00000400 /* Giant Frame */
mafischl 0:92661f51fe68 149 #define TSV0_UNDERRUN 0x00000800 /* Buffer Underrun */
mafischl 0:92661f51fe68 150 #define TSV0_BYTES 0x0FFFF000 /* Total Bytes Transferred */
mafischl 0:92661f51fe68 151 #define TSV0_CTRL_FRAME 0x10000000 /* Control Frame */
mafischl 0:92661f51fe68 152 #define TSV0_PAUSE 0x20000000 /* Pause Frame */
mafischl 0:92661f51fe68 153 #define TSV0_BACK_PRESS 0x40000000 /* Backpressure Method Applied */
mafischl 0:92661f51fe68 154 #define TSV0_VLAN 0x80000000 /* VLAN Frame */
mafischl 0:92661f51fe68 155
mafischl 0:92661f51fe68 156 /* Transmit Status Vector 1 Register */
mafischl 0:92661f51fe68 157 #define TSV1_BYTE_CNT 0x0000FFFF /* Transmit Byte Count */
mafischl 0:92661f51fe68 158 #define TSV1_COLL_CNT 0x000F0000 /* Transmit Collision Count */
mafischl 0:92661f51fe68 159
mafischl 0:92661f51fe68 160 /* Receive Status Vector Register */
mafischl 0:92661f51fe68 161 #define RSV_BYTE_CNT 0x0000FFFF /* Receive Byte Count */
mafischl 0:92661f51fe68 162 #define RSV_PKT_IGNORED 0x00010000 /* Packet Previously Ignored */
mafischl 0:92661f51fe68 163 #define RSV_RXDV_SEEN 0x00020000 /* RXDV Event Previously Seen */
mafischl 0:92661f51fe68 164 #define RSV_CARR_SEEN 0x00040000 /* Carrier Event Previously Seen */
mafischl 0:92661f51fe68 165 #define RSV_REC_CODEV 0x00080000 /* Receive Code Violation */
mafischl 0:92661f51fe68 166 #define RSV_CRC_ERR 0x00100000 /* CRC Error */
mafischl 0:92661f51fe68 167 #define RSV_LEN_CHKERR 0x00200000 /* Length Check Error */
mafischl 0:92661f51fe68 168 #define RSV_LEN_OUTRNG 0x00400000 /* Length Out of Range */
mafischl 0:92661f51fe68 169 #define RSV_REC_OK 0x00800000 /* Frame Received OK */
mafischl 0:92661f51fe68 170 #define RSV_MCAST 0x01000000 /* Multicast Frame */
mafischl 0:92661f51fe68 171 #define RSV_BCAST 0x02000000 /* Broadcast Frame */
mafischl 0:92661f51fe68 172 #define RSV_DRIB_NIBB 0x04000000 /* Dribble Nibble */
mafischl 0:92661f51fe68 173 #define RSV_CTRL_FRAME 0x08000000 /* Control Frame */
mafischl 0:92661f51fe68 174 #define RSV_PAUSE 0x10000000 /* Pause Frame */
mafischl 0:92661f51fe68 175 #define RSV_UNSUPP_OPC 0x20000000 /* Unsupported Opcode */
mafischl 0:92661f51fe68 176 #define RSV_VLAN 0x40000000 /* VLAN Frame */
mafischl 0:92661f51fe68 177
mafischl 0:92661f51fe68 178 /* Flow Control Counter Register */
mafischl 0:92661f51fe68 179 #define FCC_MIRR_CNT 0x0000FFFF /* Mirror Counter */
mafischl 0:92661f51fe68 180 #define FCC_PAUSE_TIM 0xFFFF0000 /* Pause Timer */
mafischl 0:92661f51fe68 181
mafischl 0:92661f51fe68 182 /* Flow Control Status Register */
mafischl 0:92661f51fe68 183 #define FCS_MIRR_CNT 0x0000FFFF /* Mirror Counter Current */
mafischl 0:92661f51fe68 184
mafischl 0:92661f51fe68 185 /* Receive Filter Control Register */
mafischl 0:92661f51fe68 186 #define RFC_UCAST_EN 0x00000001 /* Accept Unicast Frames Enable */
mafischl 0:92661f51fe68 187 #define RFC_BCAST_EN 0x00000002 /* Accept Broadcast Frames Enable */
mafischl 0:92661f51fe68 188 #define RFC_MCAST_EN 0x00000004 /* Accept Multicast Frames Enable */
mafischl 0:92661f51fe68 189 #define RFC_UCAST_HASH_EN 0x00000008 /* Accept Unicast Hash Filter Frames */
mafischl 0:92661f51fe68 190 #define RFC_MCAST_HASH_EN 0x00000010 /* Accept Multicast Hash Filter Fram.*/
mafischl 0:92661f51fe68 191 #define RFC_PERFECT_EN 0x00000020 /* Accept Perfect Match Enable */
mafischl 0:92661f51fe68 192 #define RFC_MAGP_WOL_EN 0x00001000 /* Magic Packet Filter WoL Enable */
mafischl 0:92661f51fe68 193 #define RFC_PFILT_WOL_EN 0x00002000 /* Perfect Filter WoL Enable */
mafischl 0:92661f51fe68 194
mafischl 0:92661f51fe68 195 /* Receive Filter WoL Status/Clear Registers */
mafischl 0:92661f51fe68 196 #define WOL_UCAST 0x00000001 /* Unicast Frame caused WoL */
mafischl 0:92661f51fe68 197 #define WOL_BCAST 0x00000002 /* Broadcast Frame caused WoL */
mafischl 0:92661f51fe68 198 #define WOL_MCAST 0x00000004 /* Multicast Frame caused WoL */
mafischl 0:92661f51fe68 199 #define WOL_UCAST_HASH 0x00000008 /* Unicast Hash Filter Frame WoL */
mafischl 0:92661f51fe68 200 #define WOL_MCAST_HASH 0x00000010 /* Multicast Hash Filter Frame WoL */
mafischl 0:92661f51fe68 201 #define WOL_PERFECT 0x00000020 /* Perfect Filter WoL */
mafischl 0:92661f51fe68 202 #define WOL_RX_FILTER 0x00000080 /* RX Filter caused WoL */
mafischl 0:92661f51fe68 203 #define WOL_MAG_PACKET 0x00000100 /* Magic Packet Filter caused WoL */
mafischl 0:92661f51fe68 204
mafischl 0:92661f51fe68 205 /* Interrupt Status/Enable/Clear/Set Registers */
mafischl 0:92661f51fe68 206 #define INT_RX_OVERRUN 0x00000001 /* Overrun Error in RX Queue */
mafischl 0:92661f51fe68 207 #define INT_RX_ERR 0x00000002 /* Receive Error */
mafischl 0:92661f51fe68 208 #define INT_RX_FIN 0x00000004 /* RX Finished Process Descriptors */
mafischl 0:92661f51fe68 209 #define INT_RX_DONE 0x00000008 /* Receive Done */
mafischl 0:92661f51fe68 210 #define INT_TX_UNDERRUN 0x00000010 /* Transmit Underrun */
mafischl 0:92661f51fe68 211 #define INT_TX_ERR 0x00000020 /* Transmit Error */
mafischl 0:92661f51fe68 212 #define INT_TX_FIN 0x00000040 /* TX Finished Process Descriptors */
mafischl 0:92661f51fe68 213 #define INT_TX_DONE 0x00000080 /* Transmit Done */
mafischl 0:92661f51fe68 214 #define INT_SOFT_INT 0x00001000 /* Software Triggered Interrupt */
mafischl 0:92661f51fe68 215 #define INT_WAKEUP 0x00002000 /* Wakeup Event Interrupt */
mafischl 0:92661f51fe68 216
mafischl 0:92661f51fe68 217 /* Power Down Register */
mafischl 0:92661f51fe68 218 #define PD_POWER_DOWN 0x80000000 /* Power Down MAC */
mafischl 0:92661f51fe68 219
mafischl 0:92661f51fe68 220 /* RX Descriptor Control Word */
mafischl 0:92661f51fe68 221 #define RCTRL_SIZE 0x000007FF /* Buffer size mask */
mafischl 0:92661f51fe68 222 #define RCTRL_INT 0x80000000 /* Generate RxDone Interrupt */
mafischl 0:92661f51fe68 223
mafischl 0:92661f51fe68 224 /* RX Status Hash CRC Word */
mafischl 0:92661f51fe68 225 #define RHASH_SA 0x000001FF /* Hash CRC for Source Address */
mafischl 0:92661f51fe68 226 #define RHASH_DA 0x001FF000 /* Hash CRC for Destination Address */
mafischl 0:92661f51fe68 227
mafischl 0:92661f51fe68 228 /* RX Status Information Word */
mafischl 0:92661f51fe68 229 #define RINFO_SIZE 0x000007FF /* Data size in bytes */
mafischl 0:92661f51fe68 230 #define RINFO_CTRL_FRAME 0x00040000 /* Control Frame */
mafischl 0:92661f51fe68 231 #define RINFO_VLAN 0x00080000 /* VLAN Frame */
mafischl 0:92661f51fe68 232 #define RINFO_FAIL_FILT 0x00100000 /* RX Filter Failed */
mafischl 0:92661f51fe68 233 #define RINFO_MCAST 0x00200000 /* Multicast Frame */
mafischl 0:92661f51fe68 234 #define RINFO_BCAST 0x00400000 /* Broadcast Frame */
mafischl 0:92661f51fe68 235 #define RINFO_CRC_ERR 0x00800000 /* CRC Error in Frame */
mafischl 0:92661f51fe68 236 #define RINFO_SYM_ERR 0x01000000 /* Symbol Error from PHY */
mafischl 0:92661f51fe68 237 #define RINFO_LEN_ERR 0x02000000 /* Length Error */
mafischl 0:92661f51fe68 238 #define RINFO_RANGE_ERR 0x04000000 /* Range Error (exceeded max. size) */
mafischl 0:92661f51fe68 239 #define RINFO_ALIGN_ERR 0x08000000 /* Alignment Error */
mafischl 0:92661f51fe68 240 #define RINFO_OVERRUN 0x10000000 /* Receive overrun */
mafischl 0:92661f51fe68 241 #define RINFO_NO_DESCR 0x20000000 /* No new Descriptor available */
mafischl 0:92661f51fe68 242 #define RINFO_LAST_FLAG 0x40000000 /* Last Fragment in Frame */
mafischl 0:92661f51fe68 243 #define RINFO_ERR 0x80000000 /* Error Occured (OR of all errors) */
mafischl 0:92661f51fe68 244
mafischl 0:92661f51fe68 245 #define RINFO_ERR_MASK (RINFO_FAIL_FILT | RINFO_CRC_ERR | RINFO_SYM_ERR | \
mafischl 0:92661f51fe68 246 RINFO_LEN_ERR | RINFO_ALIGN_ERR | RINFO_OVERRUN)
mafischl 0:92661f51fe68 247
mafischl 0:92661f51fe68 248 /* TX Descriptor Control Word */
mafischl 0:92661f51fe68 249 #define TCTRL_SIZE 0x000007FF /* Size of data buffer in bytes */
mafischl 0:92661f51fe68 250 #define TCTRL_OVERRIDE 0x04000000 /* Override Default MAC Registers */
mafischl 0:92661f51fe68 251 #define TCTRL_HUGE 0x08000000 /* Enable Huge Frame */
mafischl 0:92661f51fe68 252 #define TCTRL_PAD 0x10000000 /* Pad short Frames to 64 bytes */
mafischl 0:92661f51fe68 253 #define TCTRL_CRC 0x20000000 /* Append a hardware CRC to Frame */
mafischl 0:92661f51fe68 254 #define TCTRL_LAST 0x40000000 /* Last Descriptor for TX Frame */
mafischl 0:92661f51fe68 255 #define TCTRL_INT 0x80000000 /* Generate TxDone Interrupt */
mafischl 0:92661f51fe68 256
mafischl 0:92661f51fe68 257 /* TX Status Information Word */
mafischl 0:92661f51fe68 258 #define TINFO_COL_CNT 0x01E00000 /* Collision Count */
mafischl 0:92661f51fe68 259 #define TINFO_DEFER 0x02000000 /* Packet Deferred (not an error) */
mafischl 0:92661f51fe68 260 #define TINFO_EXCESS_DEF 0x04000000 /* Excessive Deferral */
mafischl 0:92661f51fe68 261 #define TINFO_EXCESS_COL 0x08000000 /* Excessive Collision */
mafischl 0:92661f51fe68 262 #define TINFO_LATE_COL 0x10000000 /* Late Collision Occured */
mafischl 0:92661f51fe68 263 #define TINFO_UNDERRUN 0x20000000 /* Transmit Underrun */
mafischl 0:92661f51fe68 264 #define TINFO_NO_DESCR 0x40000000 /* No new Descriptor available */
mafischl 0:92661f51fe68 265 #define TINFO_ERR 0x80000000 /* Error Occured (OR of all errors) */
mafischl 0:92661f51fe68 266
mafischl 0:92661f51fe68 267 /* DP83848C PHY Registers */
mafischl 0:92661f51fe68 268 #define PHY_REG_BMCR 0x00 /* Basic Mode Control Register */
mafischl 0:92661f51fe68 269 #define PHY_REG_BMSR 0x01 /* Basic Mode Status Register */
mafischl 0:92661f51fe68 270 #define PHY_REG_IDR1 0x02 /* PHY Identifier 1 */
mafischl 0:92661f51fe68 271 #define PHY_REG_IDR2 0x03 /* PHY Identifier 2 */
mafischl 0:92661f51fe68 272 #define PHY_REG_ANAR 0x04 /* Auto-Negotiation Advertisement */
mafischl 0:92661f51fe68 273 #define PHY_REG_ANLPAR 0x05 /* Auto-Neg. Link Partner Abitily */
mafischl 0:92661f51fe68 274 #define PHY_REG_ANER 0x06 /* Auto-Neg. Expansion Register */
mafischl 0:92661f51fe68 275 #define PHY_REG_ANNPTR 0x07 /* Auto-Neg. Next Page TX */
mafischl 0:92661f51fe68 276
mafischl 0:92661f51fe68 277 /* PHY Extended Registers */
mafischl 0:92661f51fe68 278 #define PHY_REG_STS 0x10 /* Status Register */
mafischl 0:92661f51fe68 279 #define PHY_REG_MICR 0x11 /* MII Interrupt Control Register */
mafischl 0:92661f51fe68 280 #define PHY_REG_MISR 0x12 /* MII Interrupt Status Register */
mafischl 0:92661f51fe68 281 #define PHY_REG_FCSCR 0x14 /* False Carrier Sense Counter */
mafischl 0:92661f51fe68 282 #define PHY_REG_RECR 0x15 /* Receive Error Counter */
mafischl 0:92661f51fe68 283 #define PHY_REG_PCSR 0x16 /* PCS Sublayer Config. and Status */
mafischl 0:92661f51fe68 284 #define PHY_REG_RBR 0x17 /* RMII and Bypass Register */
mafischl 0:92661f51fe68 285 #define PHY_REG_LEDCR 0x18 /* LED Direct Control Register */
mafischl 0:92661f51fe68 286 #define PHY_REG_PHYCR 0x19 /* PHY Control Register */
mafischl 0:92661f51fe68 287 #define PHY_REG_10BTSCR 0x1A /* 10Base-T Status/Control Register */
mafischl 0:92661f51fe68 288 #define PHY_REG_CDCTRL1 0x1B /* CD Test Control and BIST Extens. */
mafischl 0:92661f51fe68 289 #define PHY_REG_EDCR 0x1D /* Energy Detect Control Register */
mafischl 0:92661f51fe68 290
mafischl 0:92661f51fe68 291 #define PHY_FULLD_100M 0x2100 /* Full Duplex 100Mbit */
mafischl 0:92661f51fe68 292 #define PHY_HALFD_100M 0x2000 /* Half Duplex 100Mbit */
mafischl 0:92661f51fe68 293 #define PHY_FULLD_10M 0x0100 /* Full Duplex 10Mbit */
mafischl 0:92661f51fe68 294 #define PHY_HALFD_10M 0x0000 /* Half Duplex 10MBit */
mafischl 0:92661f51fe68 295 #define PHY_AUTO_NEG 0x3000 /* Select Auto Negotiation */
mafischl 0:92661f51fe68 296
mafischl 0:92661f51fe68 297 #define DP83848C_DEF_ADR 0x0100 /* Default PHY device address */
mafischl 0:92661f51fe68 298 #define DP83848C_ID 0x20005C90 /* PHY Identifier */
mafischl 0:92661f51fe68 299 #endif