1 | /* ################## Ethernet peripheral configuration ##################### */
|
2 |
|
3 | /* Section 1 : Ethernet peripheral configuration */
|
4 |
|
5 | /* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
|
6 | #define MAC_ADDR0 2
|
7 | #define MAC_ADDR1 0
|
8 | #define MAC_ADDR2 0
|
9 | #define MAC_ADDR3 0
|
10 | #define MAC_ADDR4 0
|
11 | #define MAC_ADDR5 0
|
12 |
|
13 | /* Definition of the Ethernet driver buffers size and count */
|
14 | #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
|
15 | #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
|
16 | #define ETH_RXBUFNB ((uint32_t)4) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
|
17 | #define ETH_TXBUFNB ((uint32_t)4) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
|
18 |
|
19 | /* Section 2: PHY configuration section */
|
20 |
|
21 | /* DP83848 PHY Address*/
|
22 | #define DP83848_PHY_ADDRESS 0x01
|
23 | /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
|
24 | #define PHY_RESET_DELAY ((uint32_t)0x000000FF)
|
25 | /* PHY Configuration delay */
|
26 | #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
|
27 |
|
28 | #define PHY_READ_TO ((uint32_t)0x0000FFFF)
|
29 | #define PHY_WRITE_TO ((uint32_t)0x0000FFFF)
|
30 |
|
31 | /* Section 3: Common PHY Registers */
|
32 |
|
33 | #define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */
|
34 | #define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */
|
35 |
|
36 | #define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
|
37 | #define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
|
38 | #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
|
39 | #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
|
40 | #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
|
41 | #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
|
42 | #define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
|
43 | #define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
|
44 | #define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */
|
45 | #define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */
|
46 |
|
47 | #define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
|
48 | #define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
|
49 | #define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
|
50 |
|
51 | /* Section 4: Extended PHY Registers */
|
52 |
|
53 | //#define PHY_SR ((uint16_t)0x10) /*!< PHY status register Offset */
|
54 | #define PHY_SR ((uint16_t)31) /*!< PHY status register Offset */ // Andre
|
55 | #define PHY_MICR ((uint16_t)0x11) /*!< MII Interrupt Control Register */
|
56 | #define PHY_MISR ((uint16_t)0x12) /*!< MII Interrupt Status and Misc. Control Register */
|
57 |
|
58 | #define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */
|
59 | #define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */
|
60 | #define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */
|
61 |
|
62 | #define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */
|
63 | #define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */
|
64 |
|
65 | #define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */
|
66 | #define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */
|