📄 net_phy.h
字号:
/* ------- MII_ANLPAR Register Bits ------- */
#define ANLPAR_SLCT 0x001F /* Same as advertise selector */
#define ANLPAR_10HALF DEF_BIT_05 /* Can do 10mbps half-duplex */
#define ANLPAR_10FULL DEF_BIT_06 /* Can do 10mbps full-duplex */
#define ANLPAR_100HALF DEF_BIT_07 /* Can do 100mbps half-duplex */
#define ANLPAR_100FULL DEF_BIT_08 /* Can do 100mbps full-duplex */
#define ANLPAR_100BASE4 DEF_BIT_09 /* Can do 100mbps 4k packets */
#define ANLPAR_RESV 0x1C00 /* Unused... */
#define ANLPAR_RFAULT DEF_BIT_13 /* Link partner faulted */
#define ANLPAR_LPACK DEF_BIT_14 /* Link partner acked us */
#define ANLPAR_NPAGE DEF_BIT_15 /* Next page bit */
#define ANLPAR_DUPLEX (ANLPAR_10FULL | ANLPAR_100FULL)
#define ANLPAR_100 (ANLPAR_100FULL | ANLPAR_100HALF | ANLPAR_100BASE4)
/* -------- MII_ANER Register Bits -------- */
#define ANER_NWAY DEF_BIT_00 /* Can do N-way auto-nego */
#define ANER_LCWP DEF_BIT_01 /* Got new RX page code word */
#define ANER_ENABLENPAGE DEF_BIT_02 /* This enables npage words */
#define ANER_NPCAPABLE DEF_BIT_03 /* Link partner supports npage */
#define ANER_MFAULTS DEF_BIT_04 /* Multiple faults detected */
#define ANER_RESV 0xFFE0 /* Unused... */
/* ----- KSZ8721_PHYCTRL Register Bits ---- */
#define PHYCTRL_SCRABLING_DIS DEF_BIT_00
#define PHYCTRL_SQE_TEST_EN DEF_BIT_01
#define PHYCTRL_MODE 0x001C
#define PHYCTRL_MODE_AUTONEG (0 << 2)
#define PHYCTRL_MODE_10BASET_HD (1 << 2)
#define PHYCTRL_MODE_100BASETX_HD (2 << 2)
#define PHYCTRL_MODE_10BASET_FD (5 << 2)
#define PHYCTRL_MODE_100BASETX_FD (6 << 2)
#define PHYCTRL_MODE_PHY_ISOLATE (7 << 2)
#define PHYCTRL_PHY_ISOLATE DEF_BIT_05
#define PHYCTRL_ENABLE_PAUSE DEF_BIT_06
#define PHYCTRL_ANEGCOMPLETE DEF_BIT_07
#define PHYCTRL_JABBER_EN DEF_BIT_08
#define PHYCTRL_INT_LEVEL DEF_BIT_09
#define PHYCTRL_POWERSAVING DEF_BIT_10
#define PHYCTRL_FORCE_LINK DEF_BIT_11
#define PHYCTRL_ENERGY_DETECT DEF_BIT_12
#define PHYCTRL_PAIRSWAP_DISABLE DEF_BIT_13
/*
*********************************************************************************************************
* PHY ERROR CODES 12,000 -> 13,000
*********************************************************************************************************
*/
#define NET_PHY_ERR_NONE 12000
#define NET_PHY_ERR_REGRD_TIMEOUT 12010
#define NET_PHY_ERR_REGWR_TIMEOUT 12020
#define NET_PHY_ERR_AUTONEG_TIMEOUT 12030
#define NET_PHY_ERR_RESET_TIMEOUT 12040
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void NetNIC_PhyInit (NET_ERR *perr);
void NetNIC_PhyAutoNeg (void); /* Do link auto-negotiation */
/* -----------------PHY STATUS FNCTS ------------------ */
CPU_BOOLEAN NetNIC_PhyAutoNegState (void); /* Get PHY auto-negotiation state */
CPU_BOOLEAN NetNIC_PhyLinkState (void); /* Get PHY link state */
CPU_INT32U NetNIC_PhyLinkSpeed (void); /* Get PHY link speed */
CPU_INT32U NetNIC_PhyLinkDuplex (void); /* Get PHY duplex mode */
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
* DEFINED IN PRODUCT'S net_bsp.c
*********************************************************************************************************
*/
void NetNIC_LinkUp (void); /* Message from NIC that the ethernet link is up. */
/* Called in interruption context most of the time. */
void NetNIC_LinkDown (void); /* Message from NIC that the ethernet link is down. */
/* Called in interruption context most of the time. */
/*
*********************************************************************************************************
* CONFIGURATION ERRORS
*********************************************************************************************************
*/
#ifndef NET_NIC_CFG_INT_CTRL_EN
#error "NET_NIC_CFG_INT_CTRL_EN not #define'd in 'net_cfg.h'"
#error " [MUST be DEF_DISABLED] "
#error " [ || DEF_ENABLED ] "
#elif ((NET_NIC_CFG_INT_CTRL_EN != DEF_DISABLED) && \
(NET_NIC_CFG_INT_CTRL_EN != DEF_ENABLED ))
#error "NET_NIC_CFG_INT_CTRL_EN illegally #define'd in 'net_cfg.h'"
#error " [MUST be DEF_DISABLED] "
#error " [ || DEF_ENABLED ] "
#endif
#ifndef EMAC_CFG_PHY_ADDR
#error "EMAC_CFG_PHY_ADDR not #define'd in 'net_bsp.h'"
#endif
#ifndef EMAC_CFG_RMII
#error "EMAC_CFG_RMII not #define'd in 'net_bsp.h'"
#error " [MUST be DEF_YES ]"
#error " [ || DEF_NO ]"
#elif ((EMAC_CFG_RMII != DEF_YES) && \
(EMAC_CFG_RMII != DEF_NO ))
#error "EMAC_CFG_RMII illegally #define'd in 'net_bsp.h'"
#error " [MUST be DEF_YES]"
#error " [ || DEF_NO ]"
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -