#ifndef _BMACENETMII_H
#define _BMACENETMII_H
typedef union {
unsigned int data;
#ifdef __BIG_ENDIAN__
struct {
unsigned int
st:2, #define MII_ST 0x01
op:2, #define MII_OP_READ 0x02
#define MII_OP_WRITE 0x01
phyad:5, regad:5, ta:2, data:16; } bit;
#else
struct {
unsigned int
data:16, ta:2, regad:5, phyad:5, op:2, st:2; } bit;
#endif
} miiFrameUnion;
#define MII_FRAME_PREAMBLE 0xFFFFFFFF
#define MII_FRAME_SIZE 32
#define MII_FRAME_READ 0x60000000
#define MII_FRAME_WRITE 0x50020000
#define MII_MAX_PHY 32
#define MII_CONTROL 0
#define MII_STATUS 1
#define MII_ID0 2
#define MII_ID1 3
#define MII_ADVERTISEMENT 4
#define MII_LINKPARTNER 5
#define MII_EXPANSION 6
#define MII_NEXTPAGE 7
#define MII_CONTROL_RESET 0x8000
#define MII_CONTROL_LOOPBACK 0x4000
#define MII_CONTROL_SPEED_SELECTION 0x2000
#define MII_CONTROL_AUTONEGOTIATION 0x1000
#define MII_CONTROL_POWERDOWN 0x800
#define MII_CONTROL_ISOLATE 0x400
#define MII_CONTROL_RESTART_NEGOTIATION 0x200
#define MII_CONTROL_FULLDUPLEX 0x100
#define MII_CONTROL_COLLISION_TEST 0x80
#define MII_STATUS_100BASET4 0x8000
#define MII_STATUS_100BASETX_FD 0x4000
#define MII_STATUS_100BASETX 0x2000
#define MII_STATUS_10BASET_FD 0x1000
#define MII_STATUS_10BASET 0x800
#define MII_STATUS_NEGOTIATION_COMPLETE 0x20
#define MII_STATUS_REMOTE_FAULT 0x10
#define MII_STATUS_NEGOTIATION_ABILITY 0x8
#define MII_STATUS_LINK_STATUS 0x4
#define MII_STATUS_JABBER_DETECT 0x2
#define MII_STATUS_EXTENDED_CAPABILITY 0x1
#define MII_ANAR_100BASET4 0x200
#define MII_ANAR_100BASETX_FD 0x100
#define MII_ANAR_100BASETX 0x80
#define MII_ANAR_10BASET_FD 0x40
#define MII_ANAR_10BASET 0x20
#define MII_ST10040_OUI 0x1e0400
#define MII_ST10040_MODEL 0x00
#define MII_ST10040_REV 0x01
#define MII_ST10040_ID ((MII_ST10040_OUI << 10) | \
(MII_ST10040_MODEL << 4))
#define MII_ST10040_MASK 0xfffffff0
#define MII_ST10040_DELAY 1
#define MII_ST10040_CHIPST 0x14
#define MII_ST10040_CHIPST_LINK 0x2000
#define MII_ST10040_CHIPST_DUPLEX 0x1000
#define MII_ST10040_CHIPST_SPEED 0x0800
#define MII_ST10040_CHIPST_NEGOTIATION 0x0020
#define MII_DP83843_OUI 0x080017
#define MII_DP83843_MODEL 0x01
#define MII_DP83843_REV 0x00
#define MII_DP83843_ID ((MII_DP83843_OUI << 10) | \
(MII_DP83843_MODEL << 4))
#define MII_DP83843_MASK 0xfffffff0
#define MII_DP83843_DELAY 20
#define MII_DP83843_PHYSTS 0x10
#define MII_DP83843_PHYSTS_LINK 0x0001
#define MII_DP83843_PHYSTS_SPEED10 0x0002
#define MII_DP83843_PHYSTS_DUPLEX 0x0004
#define MII_DP83843_PHYSTS_NEGOTIATION 0x0020
#define MII_DEFAULT_DELAY 20
#define MII_RESET_TIMEOUT 100
#define MII_RESET_DELAY 10
#define MII_LINK_TIMEOUT 2500
#define MII_LINK_DELAY 20
#endif