Project

General

Profile

Patch autoNegotiation update1 » stm32f4x7_eth_conf.h

Suphichaya Youngsubtargul (โอปอ), 09 Sep 2021 09:44

 
1
/**
2
  ******************************************************************************
3
  * @file    stm32f4x7_eth_conf.h
4
  * @author  MCD Application Team
5
  * @version V1.1.0
6
  * @date    31-July-2013
7
  * @brief   Configuration file for the STM32F4x7 Ethernet driver.  
8
  ******************************************************************************
9
  * @attention
10
  *
11
  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
12
  *
13
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14
  * You may not use this file except in compliance with the License.
15
  * You may obtain a copy of the License at:
16
  *
17
  *        http://www.st.com/software_license_agreement_liberty_v2
18
  *
19
  * Unless required by applicable law or agreed to in writing, software 
20
  * distributed under the License is distributed on an "AS IS" BASIS, 
21
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
  * See the License for the specific language governing permissions and
23
  * limitations under the License.
24
  *
25
  ******************************************************************************
26
  */
27

    
28
/* Define to prevent recursive inclusion -------------------------------------*/
29
#ifndef __STM32F4x7_ETH_CONF_H
30
#define __STM32F4x7_ETH_CONF_H
31

    
32
#ifdef __cplusplus
33
 extern "C" {
34
#endif
35

    
36
/* Includes ------------------------------------------------------------------*/
37
#include "stm32f4xx.h"
38

    
39
/* Exported types ------------------------------------------------------------*/
40
/* Exported constants --------------------------------------------------------*/
41

    
42
/* Uncomment the line below when using time stamping and/or IPv4 checksum offload */
43
#define USE_ENHANCED_DMA_DESCRIPTORS
44

    
45
/* Uncomment the line below if you want to use user defined Delay function
46
   (for precise timing), otherwise default _eth_delay_ function defined within
47
   the Ethernet driver is used (less precise timing) */
48
#define USE_Delay
49

    
50
#ifdef USE_Delay
51
  //#include "main.h"              /* Header file where the Delay function prototype is exported */
52
  //#define _eth_delay_    Delay   /* User can provide more timing precise _eth_delay_ function 
53
  //                                 in this example Systick is configured with an interrupt every 10 ms*/
54
  extern void SysTimer_delay_ms(uint32_t ms);
55
  #define	 _eth_delay_(ms)	{SysTimer_delay_ms((uint32_t)ms);}
56
#else
57
  #define _eth_delay_    ETH_Delay /* Default _eth_delay_ function with less precise timing */
58
#endif
59

    
60

    
61
/*This define allow to customize configuration of the Ethernet driver buffers */
62
#define CUSTOM_DRIVER_BUFFERS_CONFIG
63

    
64
#ifdef  CUSTOM_DRIVER_BUFFERS_CONFIG
65
/* Redefinition of the Ethernet driver buffers size and count */
66
 #define ETH_RX_BUF_SIZE    ETH_MAX_PACKET_SIZE  /* buffer size for receive */
67
 #define ETH_TX_BUF_SIZE    ETH_MAX_PACKET_SIZE  /* buffer size for transmit */
68
 #define ETH_RXBUFNB        4                    /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
69
 #define ETH_TXBUFNB        4                    /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
70
#endif
71

    
72

    
73
/* PHY configuration section **************************************************/
74
#ifdef USE_Delay
75
/* PHY Reset delay */ 
76
#define PHY_RESET_DELAY    ((uint32_t)0x00000FFF)
77
/* PHY Configuration delay */
78
#define PHY_CONFIG_DELAY   ((uint32_t)0x00000FFF)
79
/* Delay when writing to Ethernet registers*/
80
#define ETH_REG_WRITE_DELAY ((uint32_t)0x00000001)
81
#else
82
/* PHY Reset delay */ 
83
#define PHY_RESET_DELAY    ((uint32_t)0x000FFFFF)
84
/* PHY Configuration delay */ 
85
#define PHY_CONFIG_DELAY   ((uint32_t)0x00FFFFFF)
86
/* Delay when writing to Ethernet registers*/
87
#define ETH_REG_WRITE_DELAY ((uint32_t)0x0000FFFF)
88
#endif
89

    
90
/*******************  PHY Extended Registers section : ************************/
91

    
92
/* These values are relatives to DP83848 PHY and change from PHY to another,
93
   so the user have to update this value depending on the used external PHY */   
94

    
95
/* The DP83848 PHY status register  */
96
#define PHY_SR                 ((uint16_t)0x10) /* PHY status register Offset */
97
#define PHY_SPEED_STATUS       ((uint16_t)0x0002) /* PHY Speed mask */
98
#define PHY_DUPLEX_STATUS      ((uint16_t)0x0004) /* PHY Duplex mask */
99

    
100
/* The DP83848 PHY: MII Interrupt Control Register  */
101
#define PHY_MICR               ((uint16_t)0x11) /* MII Interrupt Control Register */
102
#define PHY_MICR_INT_EN        ((uint16_t)0x0002) /* PHY Enable interrupts */
103
#define PHY_MICR_INT_OE        ((uint16_t)0x0001) /* PHY Enable output interrupt events */
104

    
105
/* The DP83848 PHY: MII Interrupt Status and Misc. Control Register */
106
#define PHY_MISR               ((uint16_t)0x12) /* MII Interrupt Status and Misc. Control Register */
107
#define PHY_MISR_LINK_INT_EN   ((uint16_t)0x0020) /* Enable Interrupt on change of link status */
108
#define PHY_LINK_STATUS        ((uint16_t)0x2000) /* PHY link status interrupt mask */
109

    
110
   /* Note : Common PHY registers are defined in stm32f4x7_eth.h file */
111

    
112
/* Exported macro ------------------------------------------------------------*/
113
/* Exported functions ------------------------------------------------------- */
114

    
115
#ifdef __cplusplus
116
}
117
#endif
118

    
119
#endif /* __STM32F4x7_ETH_CONF_H */
120

    
121

    
122
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
(1-1/2)