|
162 | 162 |
|
163 | 163 | /* ################## Ethernet peripheral configuration ##################### */ |
164 | 164 |
|
165 | | -/* Section 1 : Ethernet peripheral configuration */ |
166 | | - |
167 | | -/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ |
168 | | -#define MAC_ADDR0 2U |
169 | | -#define MAC_ADDR1 0U |
170 | | -#define MAC_ADDR2 0U |
171 | | -#define MAC_ADDR3 0U |
172 | | -#define MAC_ADDR4 0U |
173 | | -#define MAC_ADDR5 0U |
174 | | - |
175 | | -/* Definition of the Ethernet driver buffers size and count */ |
176 | | -#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ |
177 | | -#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ |
| 165 | +/* Definition of the Ethernet driver buffers size and count */ |
| 166 | +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ |
| 167 | +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ |
178 | 168 |
|
179 | 169 | #ifdef MBED_CONF_STM32_EMAC_ETH_RXBUFNB |
180 | | -#define ETH_RXBUFNB MBED_CONF_STM32_EMAC_ETH_RXBUFNB /* Rx buffers of size ETH_RX_BUF_SIZE */ |
181 | | -#endif |
182 | | - |
183 | | -#ifdef MBED_CONF_STM32_EMAC_ETH_TXBUFNB |
184 | | -#define ETH_TXBUFNB MBED_CONF_STM32_EMAC_ETH_TXBUFNB /* Tx buffers of size ETH_TX_BUF_SIZE */ |
| 170 | +/* default value in features/netsocket/emac-drivers/TARGET_STM/mbed_lib.json */ |
| 171 | +#define ETH_RXBUFNB MBED_CONF_STM32_EMAC_ETH_RXBUFNB /* Rx buffers of size ETH_RX_BUF_SIZE */ |
| 172 | +#define ETH_TXBUFNB MBED_CONF_STM32_EMAC_ETH_TXBUFNB /* Tx buffers of size ETH_TX_BUF_SIZE */ |
| 173 | +#else |
| 174 | +/* ex: bare metal profile */ |
| 175 | +#define ETH_RXBUFNB 0 /* Rx buffers of size ETH_RX_BUF_SIZE */ |
| 176 | +#define ETH_TXBUFNB 0 /* Tx buffers of size ETH_TX_BUF_SIZE */ |
185 | 177 | #endif |
186 | 178 |
|
187 | 179 | /* Section 2: PHY configuration section */ |
188 | 180 |
|
189 | | -/* DP83848 PHY Address*/ |
190 | | -#define DP83848_PHY_ADDRESS 0x01U |
191 | | -/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ |
192 | | -#define PHY_RESET_DELAY 0x000000FFU |
193 | | -/* PHY Configuration delay */ |
| 181 | +/* PHY delay */ |
| 182 | +#ifdef MBED_CONF_STM32_EMAC_ETH_PHY_RESET_DELAY |
| 183 | +#define PHY_RESET_DELAY MBED_CONF_STM32_EMAC_ETH_PHY_RESET_DELAY |
| 184 | +#else |
| 185 | +#define PHY_RESET_DELAY 0 |
| 186 | +#endif |
194 | 187 | #define PHY_CONFIG_DELAY 0x00000FFFU |
195 | | - |
196 | 188 | #define PHY_READ_TO 0x0000FFFFU |
197 | 189 | #define PHY_WRITE_TO 0x0000FFFFU |
198 | 190 |
|
199 | 191 | /* Section 3: Common PHY Registers */ |
200 | 192 |
|
201 | | -#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */ |
202 | | -#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */ |
| 193 | +#define PHY_BCR ((uint16_t)0x00U) /*!< Transceiver Basic Control Register */ |
| 194 | +#define PHY_BSR ((uint16_t)0x01U) /*!< Transceiver Basic Status Register */ |
203 | 195 |
|
204 | | -#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ |
205 | | -#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ |
206 | | -#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ |
207 | | -#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ |
208 | | -#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ |
209 | | -#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ |
210 | | -#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ |
211 | | -#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ |
212 | | -#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ |
213 | | -#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ |
214 | | - |
215 | | -#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ |
216 | | -#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ |
217 | | -#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ |
| 196 | +#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */ |
| 197 | +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */ |
| 198 | +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */ |
| 199 | +#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */ |
218 | 200 |
|
219 | 201 | /* Section 4: Extended PHY Registers */ |
220 | | - |
221 | | -#define PHY_SR ((uint16_t)0x0010) /*!< PHY status register Offset */ |
222 | | -#define PHY_MICR ((uint16_t)0x0011) /*!< MII Interrupt Control Register */ |
223 | | -#define PHY_MISR ((uint16_t)0x0012) /*!< MII Interrupt Status and Misc. Control Register */ |
224 | | - |
225 | | -#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */ |
226 | | -#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */ |
227 | | -#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */ |
228 | | - |
229 | | -#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */ |
230 | | -#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */ |
231 | | - |
232 | | -#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */ |
233 | | -#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */ |
| 202 | +#ifdef MBED_CONF_STM32_EMAC_ETH_PHY_STATUS_REGISTER |
| 203 | +#define PHY_SR MBED_CONF_STM32_EMAC_ETH_PHY_STATUS_REGISTER /*!< PHY status register Offset */ |
| 204 | +#define PHY_SPEED_STATUS MBED_CONF_STM32_EMAC_ETH_PHY_SPEED_STATUS /*!< PHY Speed mask */ |
| 205 | +#define PHY_DUPLEX_STATUS MBED_CONF_STM32_EMAC_ETH_PHY_DUPLEX_STATUS /*!< PHY Duplex mask */ |
| 206 | +#else |
| 207 | +#define PHY_SR 0 |
| 208 | +#define PHY_SPEED_STATUS 0 |
| 209 | +#define PHY_DUPLEX_STATUS 0 |
| 210 | +#endif |
234 | 211 |
|
235 | 212 | /* ################## SPI peripheral configuration ########################## */ |
236 | 213 |
|
|
0 commit comments