net_phy.h

来自「Micrium_PHY_DM9161AE.zip ucos系统下物理层PHY_」· C头文件 代码 · 共 234 行 · 第 1/2 页

H
234
字号
#define ADVERTISE_LPACK                   0x4000                /* Ack link partners response  */
#define ADVERTISE_NPAGE                   0x8000                /* Next page bit               */

#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
			ADVERTISE_CSMA)
#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
                       ADVERTISE_100HALF | ADVERTISE_100FULL)

                                                                /* Link partner ability reg    */
#define LPA_SLCT                          0x001F                /* Same as advertise selector  */
#define LPA_10HALF                        0x0020                /* Can do 10mbps half-duplex   */
#define LPA_10FULL                        0x0040                /* Can do 10mbps full-duplex   */
#define LPA_100HALF                       0x0080                /* Can do 100mbps half-duplex  */
#define LPA_100FULL                       0x0100                /* Can do 100mbps full-duplex  */
#define LPA_100BASE4                      0x0200                /* Can do 100mbps 4k packets   */
#define LPA_RESV                          0x1C00                /* Unused...                   */
#define LPA_RFAULT                        0x2000                /* Link partner faulted        */
#define LPA_LPACK                         0x4000                /* Link partner acked us       */
#define LPA_NPAGE                         0x8000                /* Next page bit               */

#define LPA_DUPLEX		(LPA_10FULL | LPA_100FULL)
#define LPA_100			(LPA_100FULL | LPA_100HALF | LPA_100BASE4)

                                                                /* Expansion reg for auto-neg  */
#define EXPANSION_NWAY                    0x0001                /* Can do N-way auto-nego      */
#define EXPANSION_LCWP                    0x0002                /* Got new RX page code word   */
#define EXPANSION_ENABLENPAGE             0x0004                /* This enables npage words    */
#define EXPANSION_NPCAPABLE               0x0008                /* Link partner supports npage */
#define EXPANSION_MFAULTS                 0x0010                /* Multiple faults detected    */
#define EXPANSION_RESV                    0xFFE0                /* Unused...                   */

                                                                /* N-way test register         */
#define NWAYTEST_RESV1                    0x00FF                /* Unused...                   */
#define NWAYTEST_LOOPBACK                 0x0100                /* Enable loopback for N-way   */
#define NWAYTEST_RESV2                    0xFE00                /* Unused...                   */

#define SPD_10				                  10
#define SPD_100		                         100
                                                                 /* Duplex, half or full        */
#define DUPLEX_HALF				            0x00
#define DUPLEX_FULL				            0x01


#define MII_DM9161_ID                 0x0181b8a0                /* PHY ID                      */

#define AT91C_PHY_ADDR	                      31                /* PHY Address                 */

#define SPECIFIED_INTR_REG                    21                /* PHY Specified Interrupt Reg */


/*
*********************************************************************************************************
*                                   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


/*
*********************************************************************************************************
*                                         FUNCTION PROTOTYPES
*********************************************************************************************************
*/

                                                                /* ------------------- STATUS FNCTS ------------------- */
CPU_BOOLEAN  NetNIC_PhyAutoNegState  (NET_ERR *perr);           /* Get PHY auto-negotiation state                       */
CPU_BOOLEAN  NetNIC_PhyLinkState     (NET_ERR *perr);           /* Get PHY link state                                   */

CPU_INT32S   NetPHY_GetLinkSpeed     (NET_ERR *perr);           /* Get PHY link speed                                   */
CPU_INT32S   NetPHY_GetLinkDuplex    (NET_ERR *perr);           /* Get PHY duplex mode                                  */

void         NetNIC_PhyInit          (NET_ERR *perr);           /* PHY initialization function                          */
void         NetNIC_PhyAutoNeg       (NET_ERR *perr);           /* Do link auto-negotiation                             */


/*
*********************************************************************************************************
*                                         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.     */

void         DM9161AE_DlyAutoNegAck  (void);                    /* Implement 1.5 s dly.                                 */
                                                                /*   MUST use OS dly to preempt.                        */

/*
*********************************************************************************************************
*                                        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



#endif
	 	 			 		    	 				 	    	 	 	 		    	     	 	 	 		 	  	  	  	     	 	      	   		 	 	 	   		   			 	     			  			 		   	 			       	  	 		  	 	  	 		 		   		  	  			 	  	 		 	 	 			 	 		 		 	 		 	   		 	 	 	   		     			  			 		  	 		 	  			 	 	 	 	  		  	   		   	   	 				 		 			 			  			 		   		 		 				 		 	    		   	  		 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?