1 | /**
|
2 | ******************************************************************************
|
3 | * @file stm32f4x7_eth_bsp.h
|
4 | * @author MCD Application Team
|
5 | * @version V1.0.0
|
6 | * @date 31-October-2011
|
7 | * @brief Header for stm32f4x7_eth_bsp.c file.
|
8 | ******************************************************************************
|
9 | * @attention
|
10 | *
|
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
17 | *
|
18 | * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
19 | ******************************************************************************
|
20 | */
|
21 |
|
22 | /* Define to prevent recursive inclusion -------------------------------------*/
|
23 | #ifndef __STM32F4x7_ETH_BSP_H
|
24 | #define __STM32F4x7_ETH_BSP_H
|
25 |
|
26 | #ifdef __cplusplus
|
27 | extern "C" {
|
28 | #endif
|
29 |
|
30 | /* Includes ------------------------------------------------------------------*/
|
31 | #include "lwip/netif.h"
|
32 |
|
33 | /* Exported types ------------------------------------------------------------*/
|
34 | /* Exported constants --------------------------------------------------------*/
|
35 | #define LAN8710A_PHY_ADDRESS 0x00 /* Relative to STM324xG-EVAL Board */
|
36 |
|
37 | /* Specific defines for EXTI line, used to manage Ethernet link status */
|
38 | #define ETH_LINK_EXTI_LINE EXTI_Line3
|
39 | #define ETH_LINK_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA
|
40 | #define ETH_LINK_EXTI_PIN_SOURCE EXTI_PinSource3
|
41 | /* PA3 */
|
42 | #define ETH_LINK_PIN GPIO_Pin_3
|
43 | #define ETH_LINK_GPIO_PORT GPIOA
|
44 | #define ETH_LINK_GPIO_CLK RCC_AHB1Periph_GPIOA
|
45 |
|
46 | /* The LAN8710A PHY status register */
|
47 | #define PHY_SR ((uint16_t)0x0001) /* PHY status register Offset */
|
48 | #define PHY_SPEED_100 ((uint16_t)0x6000) /* PHY Speed mask : Bits 13 and 14 indicate 10 Mbit*/
|
49 | #define PHY_FULL_DUPLEX ((uint16_t)0x5000) /* PHY Duplex mask: Bits 14 or 12 indicate Full d. */
|
50 |
|
51 | /* The LAN8710A PHY: MII Interrupt Control Register */
|
52 | #define PHY_MIFR ((uint16_t)0x1d) /* MII Interrupt Source Flag Register */
|
53 | #define PHY_MIFR_LINK_FLAG ((uint16_t)0x0010) /* Interrupt flag on change of link status */
|
54 | #define PHY_MIFR_AUTON_FLAG ((uint16_t)0x0040) /* Interrupt flag when Auto-Negotiate complete */
|
55 | #define PHY_MIFR_ENERGY_FLAG ((uint16_t)0x0080) /* Interrupt lfag on change of Energy status */
|
56 |
|
57 | /* The LAN8710A PHY: Mode Control & Status Register */
|
58 | #define PHY_MCSR ((uint16_t)0x11) /* Mode Control & Status register Register */
|
59 | #define PHY_MCSR_ALTINT ((uint16_t)0x20) /* Alternate Interrupt Mode : Bit 6 */
|
60 |
|
61 | /* The LAN8710A PHY: MII Interrupt Status and Misc. Control Register */
|
62 | #define PHY_MIMR ((uint16_t)0x1e) /* MII Interrupt Status and Misc. Control Register */
|
63 | #define PHY_MIMR_LINK_INT_EN ((uint16_t)0x0010) /* Enable Interrupt on change of link status */
|
64 | #define PHY_MIMR_AUTON_INT_EN ((uint16_t)0x0040) /* Enable Interrupt when Auto-negotiate complete */
|
65 | #define PHY_MIMR_ENERGY_INT_EN ((uint16_t)0x0080) /* Enable Interrupt on change of Energy status */
|
66 |
|
67 | /* Ethernet Flags for EthStatus variable */
|
68 | #define ETH_INIT_FLAG 0x01 /* Ethernet Init Flag */
|
69 | #define ETH_LINK_FLAG 0x10 /* Ethernet Link Flag */
|
70 | /* Exported macro ------------------------------------------------------------*/
|
71 | /* Exported functions ------------------------------------------------------- */
|
72 | unsigned short PHYID_HI, PHYID_LO; // check if we find a PHY LAN8710A
|
73 |
|
74 | void ETH_BSP_Config(void);
|
75 | uint32_t Eth_Link_PHYITConfig(uint16_t PHYAddress);
|
76 | void Eth_Link_EXTIConfig(void);
|
77 | void Eth_Link_ITHandler(uint16_t PHYAddress);
|
78 | void Eth_Link_IT_task( void * pvParameters );
|
79 | void ETH_link_callback(struct netif *netif);
|
80 |
|
81 | #ifdef __cplusplus
|
82 | }
|
83 | #endif
|
84 |
|
85 | #endif /* __STM32F4x7_ETH_BSP_H */
|
86 |
|
87 |
|
88 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|