stm32f4x7_eth_conf.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. /* Define to prevent recursive inclusion -------------------------------------*/
  28. #ifndef __STM32F4x7_ETH_CONF_H
  29. #define __STM32F4x7_ETH_CONF_H
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f4xx.h"
  36. /* Exported types ------------------------------------------------------------*/
  37. /* Exported constants --------------------------------------------------------*/
  38. /* Uncomment the line below when using time stamping and/or IPv4 checksum offload */
  39. #define USE_ENHANCED_DMA_DESCRIPTORS
  40. /* Uncomment the line below if you want to use user defined Delay function
  41. (for precise timing), otherwise default _eth_delay_ function defined within
  42. the Ethernet driver is used (less precise timing) */
  43. #define USE_Delay
  44. #ifdef USE_Delay
  45. // #include "main.h" /* Header file where the Delay function prototype is exported */
  46. #define _eth_delay_ ETH_Delay10ms /* User can provide more timing precise _eth_delay_ function \
  47. in this example Systick is configured with an interrupt every 10 ms*/
  48. extern void ETH_Delay10ms(uint32_t nCount);
  49. #else
  50. #define _eth_delay_ ETH_Delay /* Default _eth_delay_ function with less precise timing */
  51. #endif
  52. /*This define allow to customize configuration of the Ethernet driver buffers */
  53. #define CUSTOM_DRIVER_BUFFERS_CONFIG
  54. #ifdef CUSTOM_DRIVER_BUFFERS_CONFIG
  55. /* Redefinition of the Ethernet driver buffers size and count */
  56. #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
  57. #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
  58. #define ETH_RXBUFNB 4 /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
  59. #define ETH_TXBUFNB 4 /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
  60. #endif
  61. /* PHY configuration section **************************************************/
  62. #ifdef USE_Delay
  63. /* PHY Reset delay */
  64. #define PHY_RESET_DELAY ((uint32_t)0x000000FF)
  65. /* PHY Configuration delay */
  66. #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
  67. /* Delay when writing to Ethernet registers*/
  68. #define ETH_REG_WRITE_DELAY ((uint32_t)0x00000001)
  69. #else
  70. /* PHY Reset delay */
  71. #define PHY_RESET_DELAY ((uint32_t)0x000FFFFF)
  72. /* PHY Configuration delay */
  73. #define PHY_CONFIG_DELAY ((uint32_t)0x00FFFFFF)
  74. /* Delay when writing to Ethernet registers*/
  75. #define ETH_REG_WRITE_DELAY ((uint32_t)0x0000FFFF)
  76. #endif
  77. /******************* PHY Extended Registers section : ************************/
  78. /* These values are relatives to DP83848 PHY and change from PHY to another,
  79. so the user have to update this value depending on the used external PHY */
  80. /* The DP83848 PHY status register */
  81. #define PHY_SR ((uint16_t)0x10) /* PHY status register Offset */
  82. #define PHY_SPEED_STATUS ((uint16_t)0x0002) /* PHY Speed mask */
  83. #define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /* PHY Duplex mask */
  84. /* The DP83848 PHY: MII Interrupt Control Register */
  85. #define PHY_MICR ((uint16_t)0x11) /* MII Interrupt Control Register */
  86. #define PHY_MICR_INT_EN ((uint16_t)0x0002) /* PHY Enable interrupts */
  87. #define PHY_MICR_INT_OE ((uint16_t)0x0001) /* PHY Enable output interrupt events */
  88. /* The DP83848 PHY: MII Interrupt Status and Misc. Control Register */
  89. #define PHY_MISR ((uint16_t)0x12) /* MII Interrupt Status and Misc. Control Register */
  90. #define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /* Enable Interrupt on change of link status */
  91. #define PHY_LINK_STATUS ((uint16_t)0x2000) /* PHY link status interrupt mask */
  92. /* Note : Common PHY registers are defined in stm32f4x7_eth.h file */
  93. /* Exported macro ------------------------------------------------------------*/
  94. /* Exported functions ------------------------------------------------------- */
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif /* __STM32F4x7_ETH_CONF_H */
  99. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/