DJI NAZA-M controller (multi copter side) see: https://developer.mbed.org/users/okini3939/notebook/drone/

Dependencies:   FutabaSBUS NECnfc mbed

Committer:
okini3939
Date:
Thu May 19 08:59:45 2016 +0000
Revision:
1:32cd1cf5d5b1
Parent:
0:4a37291f07ca
1st build;

Who changed what in which revision?

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