netconf.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*!
  2. \file netconf.h
  3. \brief the header file of netconf
  4. \version 2016-08-15, V1.0.0, firmware for GD32F4xx
  5. \version 2018-12-12, V2.0.0, firmware for GD32F4xx
  6. \version 2020-09-30, V2.1.0, firmware for GD32F4xx
  7. */
  8. /*
  9. Copyright (c) 2020, GigaDevice Semiconductor Inc.
  10. Redistribution and use in source and binary forms, with or without modification,
  11. are permitted provided that the following conditions are met:
  12. 1. Redistributions of source code must retain the above copyright notice, this
  13. list of conditions and the following disclaimer.
  14. 2. Redistributions in binary form must reproduce the above copyright notice,
  15. this list of conditions and the following disclaimer in the documentation
  16. and/or other materials provided with the distribution.
  17. 3. Neither the name of the copyright holder nor the names of its contributors
  18. may be used to endorse or promote products derived from this software without
  19. specific prior written permission.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  24. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  27. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  29. OF SUCH DAMAGE.
  30. */
  31. #ifndef NETCONF_H
  32. #define NETCONF_H
  33. #include "main.h"
  34. //#define USE_DHCP 1 /* enable DHCP, if disabled static address is used */
  35. #define USE_ENET_INTERRUPT
  36. //#define TIMEOUT_CHECK_USE_LWIP
  37. /* MAC address: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
  38. #define MAC_ADDR0 2
  39. #define MAC_ADDR1 0xA
  40. #define MAC_ADDR2 0xF
  41. #define MAC_ADDR3 0xE
  42. #define MAC_ADDR4 0xD
  43. #define MAC_ADDR5 6
  44. /* static IP address: IP_ADDR0.IP_ADDR1.IP_ADDR2.IP_ADDR3 */
  45. #define IP_ADDR0 192
  46. #define IP_ADDR1 168
  47. #define IP_ADDR2 1
  48. #define IP_ADDR3 150
  49. /* remote IP address: IP_S_ADDR0.IP_S_ADDR1.IP_S_ADDR2.IP_S_ADDR3 */
  50. #define IP_S_ADDR0 192
  51. #define IP_S_ADDR1 168
  52. #define IP_S_ADDR2 1
  53. #define IP_S_ADDR3 10
  54. /* net mask */
  55. #define NETMASK_ADDR0 255
  56. #define NETMASK_ADDR1 255
  57. #define NETMASK_ADDR2 255
  58. #define NETMASK_ADDR3 0
  59. /* gateway address */
  60. #define GW_ADDR0 192
  61. #define GW_ADDR1 168
  62. #define GW_ADDR2 1
  63. #define GW_ADDR3 1
  64. /* MII and RMII mode selection */
  65. #define RMII_MODE // user have to provide the 50 MHz clock by soldering a 50 MHz oscillator
  66. //#define MII_MODE
  67. /* clock the PHY from external 25MHz crystal (only for MII mode) */
  68. #ifdef MII_MODE
  69. #define PHY_CLOCK_MCO
  70. #endif
  71. #ifdef USE_DHCP
  72. /* dhcp_task */
  73. void dhcp_task(void *pvParameters);
  74. #endif /* USE_DHCP */
  75. void lwip_stack_init(void);
  76. #endif /* NETCONF_H */