stm32f4x7_eth_conf.h 5.1 KB

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