📄 net_phy.h
字号:
#define PHYCTRL2_SQE_TEST_EN DEF_BIT_01
#define PHYCTRL2_MODE 0x001C
#define PHYCTRL2_MODE_AUTONEG (0 << 2)
#define PHYCTRL2_MODE_10BASET_HD (1 << 2)
#define PHYCTRL2_MODE_100BASETX_HD (2 << 2)
#define PHYCTRL2_MODE_10BASET_FD (5 << 2)
#define PHYCTRL2_MODE_100BASETX_FD (6 << 2)
#define PHYCTRL2_MODE_PHY_ISOLATE (7 << 2)
#define PHYCTRL2_PHY_ISOLATE DEF_BIT_05
#define PHYCTRL2_ENABLE_PAUSE DEF_BIT_06
#define PHYCTRL2_ANEGCOMPLETE DEF_BIT_07
#define PHYCTRL2_JABBER_EN DEF_BIT_08
#define PHYCTRL2_INT_LEVEL DEF_BIT_09
#define PHYCTRL2_POWERSAVING DEF_BIT_10
#define PHYCTRL2_FORCE_LINK DEF_BIT_11
#define PHYCTRL2_ENERGY_DETECT DEF_BIT_12
#define PHYCTRL2_PAIRSWAP_DISABLE DEF_BIT_13
/* ------ KSZ8001_ISCSR Register Bits ----- */
#define ISCSR_INT_LINK_UP DEF_BIT_00
#define ISCSR_INT_REMOTE_FAULT DEF_BIT_01
#define ISCSR_INT_LINK_DOWN DEF_BIT_02
#define ISCSR_INT_LPA DEF_BIT_03
#define ISCSR_INT_PAR_DET_FAULT DEF_BIT_04
#define ISCSR_INT_PAGE_RX DEF_BIT_05
#define ISCSR_INT_RX_ERR DEF_BIT_06
#define ISCSR_INT_JAB DEF_BIT_07
#define ISCSR_INT_EN_LINK_UP DEF_BIT_08
#define ISCSR_INT_EN_REMOTE_FAULT DEF_BIT_09
#define ISCSR_INT_EN_LINK_DOWN DEF_BIT_10
#define ISCSR_INT_EN_LPA DEF_BIT_11
#define ISCSR_INT_EN_PAR_DET_FAULT DEF_BIT_12
#define ISCSR_INT_EN_PAGE_RX DEF_BIT_13
#define ISCSR_INT_EN_RX_ERR DEF_BIT_14
#define ISCSR_INT_EN_JAB DEF_BIT_15
/*
*********************************************************************************************************
* 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 */
#if (EMAC_CFG_PHY_INT == DEF_ON)
void NetNIC_PhyISR_Handler (void); /* Decode & handle PHY ISRs. */
#endif
/* -----------------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. */
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
* DEFINED IN PRODUCT'S net_isr.c
*********************************************************************************************************
*/
#if (NET_NIC_CFG_INT_CTRL_EN == DEF_ENABLED)
#if (EMAC_CFG_PHY_INT == DEF_ON)
void NetNIC_PhyIntInit (void); /* Init int ctrl'r. */
void NetNIC_PhyIntClr (void); /* Clr int ctrl'r src(s). */
#endif
#endif
/*
*********************************************************************************************************
* 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
#ifndef EMAC_CFG_PHY_INT
#error "EMAC_CFG_PHY_INT not #define'd in 'net_bsp.h'"
#error " [MUST be DEF_OFF ]"
#error " [ || DEF_ON ]"
#elif ((EMAC_CFG_PHY_INT != DEF_OFF) && \
(EMAC_CFG_PHY_INT != DEF_ON ))
#error "EMAC_CFG_RMII illegally #define'd in 'net_bsp.h'"
#error " [MUST be DEF_OFF]"
#error " [ || DEF_ON ]"
#endif
#ifdef EMAC_CFG_PHY_INT
#if (EMAC_CFG_PHY_INT == DEF_ON)
#if (NET_NIC_CFG_INT_CTRL_EN == DEF_DISABLED)
#error "NET_NIC_CFG_INT_CTRL_EN illegally #define'd in 'net_cfg.h'"
#error " [ || DEF_ENABLED ] "
#endif
#endif
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -