iPXE
mii_bit.h
Go to the documentation of this file.
00001 #ifndef _IPXE_MII_BIT_H
00002 #define _IPXE_MII_BIT_H
00003 
00004 /** @file
00005  *
00006  * MII bit-bashing interface
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <ipxe/mii.h>
00013 #include <ipxe/bitbash.h>
00014 
00015 #define MII_BIT_START           0xffffffff      /**< Start */
00016 #define MII_BIT_START_MASK      0x80000000      /**< Start mask */
00017 
00018 #define MII_BIT_CMD_MASK        0x00000008      /**< Command mask */
00019 #define MII_BIT_CMD_READ        0x00000006      /**< Command read */
00020 #define MII_BIT_CMD_WRITE       0x00000005      /**< Command write */
00021 #define MII_BIT_CMD_RW          0x00000001      /**< Command read or write */
00022 
00023 #define MII_BIT_PHY_MASK        0x00000010      /**< PHY mask */
00024 
00025 #define MII_BIT_REG_MASK        0x00000010      /**< Register mask */
00026 
00027 #define MII_BIT_SWITCH          0x00000002      /**< Switch */
00028 #define MII_BIT_SWITCH_MASK     0x00000002      /**< Switch mask */
00029 
00030 #define MII_BIT_DATA_MASK       0x00008000      /**< Data mask */
00031 
00032 /** A bit-bashing MII interface */
00033 struct mii_bit_basher {
00034         /** MII interface */
00035         struct mii_interface mdio;
00036         /** Bit-bashing interface */
00037         struct bit_basher basher;
00038 };
00039 
00040 /** Bit indices used for MII bit-bashing interface */
00041 enum {
00042         /** MII clock */
00043         MII_BIT_MDC = 0,
00044         /** MII data */
00045         MII_BIT_MDIO,
00046         /** MII data direction */
00047         MII_BIT_DRIVE,
00048 };
00049 
00050 /** Delay between MDC transitions */
00051 #define MII_BIT_UDELAY 1
00052 
00053 extern void init_mii_bit_basher ( struct mii_bit_basher *miibit );
00054 
00055 #endif /* _IPXE_MII_BIT_H */