stm32f4x7_eth_conf_template.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4x7_eth_conf_template.h
  4. * @author MCD Application Team
  5. * @version V1.1.0
  6. * @date 31-July-2013
  7. * @brief Configuration file for the STM32F4x7xx Ethernet driver.
  8. * This file should be copied to the application folder and renamed to
  9. * stm32f4x7_eth_conf.h
  10. ******************************************************************************
  11. * @attention
  12. *
  13. * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
  14. *
  15. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  16. * You may not use this file except in compliance with the License.
  17. * You may obtain a copy of the License at:
  18. *
  19. * http://www.st.com/software_license_agreement_liberty_v2
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an "AS IS" BASIS,
  23. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24. * See the License for the specific language governing permissions and
  25. * limitations under the License.
  26. *
  27. ******************************************************************************
  28. */
  29. /* Define to prevent recursive inclusion -------------------------------------*/
  30. #ifndef __STM32F4x7_ETH_CONF_H
  31. #define __STM32F4x7_ETH_CONF_H
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /* Includes ------------------------------------------------------------------*/
  36. #include "stm32f4xx.h"
  37. /* Exported types ------------------------------------------------------------*/
  38. /* Exported constants --------------------------------------------------------*/
  39. /* Uncomment the line below when using time stamping and/or IPv4 checksum offload */
  40. #define USE_ENHANCED_DMA_DESCRIPTORS
  41. /* Uncomment the line below if you want to use user defined Delay function
  42. (for precise timing), otherwise default _eth_delay_ function defined within
  43. the Ethernet driver is used (less precise timing) */
  44. #define USE_Delay
  45. #ifdef USE_Delay
  46. #include "main.h" /* Header file where the Delay function prototype is exported */
  47. #define _eth_delay_ Delay /* User can provide more timing precise _eth_delay_ function
  48. ex. use Systick with time base of 10 ms (as done in the provided
  49. STM32F4x7xx demonstrations) */
  50. #else
  51. #define _eth_delay_ ETH_Delay /* Default _eth_delay_ function with less precise timing */
  52. #endif
  53. /* Uncomment the line below to allow custom configuration of the Ethernet driver buffers */
  54. //#define CUSTOM_DRIVER_BUFFERS_CONFIG
  55. #ifdef CUSTOM_DRIVER_BUFFERS_CONFIG
  56. /* Redefinition of the Ethernet driver buffers size and count */
  57. #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
  58. #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
  59. #define ETH_RXBUFNB 20 /* 20 Rx buffers of size ETH_RX_BUF_SIZE */
  60. #define ETH_TXBUFNB 5 /* 5 Tx buffers of size ETH_TX_BUF_SIZE */
  61. #endif
  62. /* PHY configuration section **************************************************/
  63. #ifdef USE_Delay
  64. /* PHY Reset delay */
  65. #define PHY_RESET_DELAY ((uint32_t)0x000000FF)
  66. /* PHY Configuration delay */
  67. #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
  68. /* Delay when writing to Ethernet registers*/
  69. #define ETH_REG_WRITE_DELAY ((uint32_t)0x00000001)
  70. #else
  71. /* PHY Reset delay */
  72. #define PHY_RESET_DELAY ((uint32_t)0x000FFFFF)
  73. /* PHY Configuration delay */
  74. #define PHY_CONFIG_DELAY ((uint32_t)0x00FFFFFF)
  75. /* Delay when writing to Ethernet registers*/
  76. #define ETH_REG_WRITE_DELAY ((uint32_t)0x0000FFFF)
  77. #endif
  78. /******************* PHY Extended Registers section : ************************/
  79. /* These values are relatives to DP83848 PHY and change from PHY to another,
  80. so the user have to update this value depending on the used external PHY */
  81. /* The DP83848 PHY status register */
  82. #define PHY_SR ((uint16_t)0x10) /* PHY status register Offset */
  83. #define PHY_SPEED_STATUS ((uint16_t)0x0002) /* PHY Speed mask */
  84. #define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /* PHY Duplex mask */
  85. /* The DP83848 PHY: MII Interrupt Control Register */
  86. #define PHY_MICR ((uint16_t)0x11) /* MII Interrupt Control Register */
  87. #define PHY_MICR_INT_EN ((uint16_t)0x0002) /* PHY Enable interrupts */
  88. #define PHY_MICR_INT_OE ((uint16_t)0x0001) /* PHY Enable output interrupt events */
  89. /* The DP83848 PHY: MII Interrupt Status and Misc. Control Register */
  90. #define PHY_MISR ((uint16_t)0x12) /* MII Interrupt Status and Misc. Control Register */
  91. #define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /* Enable Interrupt on change of link status */
  92. #define PHY_LINK_STATUS ((uint16_t)0x2000) /* PHY link status interrupt mask */
  93. /* Note : Common PHY registers are defined in stm32f4x7_eth.h file */
  94. /* Exported macro ------------------------------------------------------------*/
  95. /* Exported functions ------------------------------------------------------- */
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __STM32F4x7_ETH_CONF_H */
  100. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/