main.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*!
  2. \file main.h
  3. \brief the header file of main
  4. \version 2017-02-10, V1.0.0, firmware for GD32F30x
  5. \version 2018-10-10, V1.1.0, firmware for GD32F30x
  6. \version 2018-12-25, V2.0.0, firmware for GD32F30x
  7. \version 2020-09-30, V2.1.0, firmware for GD32F30x
  8. */
  9. /*
  10. Copyright (c) 2020, GigaDevice Semiconductor Inc.
  11. Redistribution and use in source and binary forms, with or without modification,
  12. are permitted provided that the following conditions are met:
  13. 1. Redistributions of source code must retain the above copyright notice, this
  14. list of conditions and the following disclaimer.
  15. 2. Redistributions in binary form must reproduce the above copyright notice,
  16. this list of conditions and the following disclaimer in the documentation
  17. and/or other materials provided with the distribution.
  18. 3. Neither the name of the copyright holder nor the names of its contributors
  19. may be used to endorse or promote products derived from this software without
  20. specific prior written permission.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  22. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  23. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  25. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  27. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  30. OF SUCH DAMAGE.
  31. */
  32. #ifndef __MAIN_H
  33. #define __MAIN_H
  34. #include "gd32f30x.h"
  35. #include "stdint.h"
  36. #include "gd32f30x_enet_eval.h"
  37. //#define USE_DHCP /* enable DHCP, if disabled static address is used */
  38. //#define USE_ENET_INTERRUPT
  39. //#define TIMEOUT_CHECK_USE_LWIP
  40. /* MAC address: BORAD_MAC_ADDR0:BORAD_MAC_ADDR1:BORAD_MAC_ADDR2:BORAD_MAC_ADDR3:BORAD_MAC_ADDR4:BORAD_MAC_ADDR5 */
  41. #define BORAD_MAC_ADDR0 2
  42. #define BORAD_MAC_ADDR1 0xA
  43. #define BORAD_MAC_ADDR2 0xF
  44. #define BORAD_MAC_ADDR3 0xE
  45. #define BORAD_MAC_ADDR4 0xD
  46. #define BORAD_MAC_ADDR5 6
  47. /* static IP address: BORAD_IP_ADDR0.BORAD_IP_ADDR1.BORAD_IP_ADDR2.BORAD_IP_ADDR3 */
  48. #define BORAD_IP_ADDR0 10
  49. #define BORAD_IP_ADDR1 50
  50. #define BORAD_IP_ADDR2 3
  51. #define BORAD_IP_ADDR3 210
  52. /* net mask */
  53. #define BORAD_NETMASK_ADDR0 255
  54. #define BORAD_NETMASK_ADDR1 255
  55. #define BORAD_NETMASK_ADDR2 255
  56. #define BORAD_NETMASK_ADDR3 0
  57. /* gateway address */
  58. #define BORAD_GW_ADDR0 10
  59. #define BORAD_GW_ADDR1 50
  60. #define BORAD_GW_ADDR2 3
  61. #define BORAD_GW_ADDR3 1
  62. /* MII and RMII mode selection */
  63. #define RMII_MODE // user have to provide the 50 MHz clock by soldering a 50 MHz oscillator
  64. //#define MII_MODE
  65. /* clock the PHY from external 25MHz crystal (only for MII mode) */
  66. #ifdef MII_MODE
  67. #define PHY_CLOCK_MCO
  68. #endif
  69. /* function declarations */
  70. /* updates the system local time */
  71. void time_update(void);
  72. /* insert a delay time */
  73. void delay_10ms(uint32_t ncount);
  74. #endif /* MAIN_H */