rtems_network_config.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. /*
  20. * Thanks Zetron, Inc and Phil Torre <ptorre@zetron.com> for donating PJLIB
  21. * port to RTEMS.
  22. */
  23. /*
  24. * Network configuration
  25. *
  26. ************************************************************
  27. * EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION *
  28. * BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
  29. ************************************************************
  30. *
  31. */
  32. #ifndef _RTEMS_NETWORKCONFIG_H_
  33. #define _RTEMS_NETWORKCONFIG_H_
  34. #define DEFAULT_IP_ADDRESS_STRING "192.168.0.2"
  35. #define DEFAULT_NETMASK_STRING "255.255.255.0"
  36. #define DEFAULT_GATEWAY_STRING "192.168.0.1"
  37. #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
  38. #warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
  39. #define RTEMS_BSP_NETWORK_DRIVER_NAME "no_network1"
  40. #endif
  41. #ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
  42. #warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
  43. #define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
  44. #endif
  45. #define NETWORK_STACK_PRIORITY 128
  46. /* #define RTEMS_USE_BOOTP */
  47. /* #define RTEMS_USE_LOOPBACK */
  48. #include <bsp.h>
  49. /*
  50. * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
  51. * Ethernet address here. If RTEMS_SET_ETHERNET_ADDRESS is not
  52. * defined the driver will choose an address.
  53. */
  54. // NOTE: The address below is a dummy address that should only ever
  55. // be used for testing on a private network. DO NOT LET A PRODUCT
  56. // CONTAINING THIS ETHERNET ADDRESS OUT INTO THE FIELD!
  57. //#define RTEMS_SET_ETHERNET_ADDRESS
  58. #if (defined (RTEMS_SET_ETHERNET_ADDRESS))
  59. static char ethernet_address[6] = { 0x00, 0x80, 0x7F, 0x22, 0x61, 0x77 };
  60. #endif
  61. #define RTEMS_USE_LOOPBACK
  62. #ifdef RTEMS_USE_LOOPBACK
  63. /*
  64. * Loopback interface
  65. */
  66. extern int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig* dummy, int unused);
  67. static struct rtems_bsdnet_ifconfig loopback_config = {
  68. "lo0", /* name */
  69. rtems_bsdnet_loopattach, /* attach function */
  70. NULL, /* link to next interface */
  71. "127.0.0.1", /* IP address */
  72. "255.0.0.0", /* IP net mask */
  73. };
  74. #endif
  75. /*
  76. * Default network interface
  77. */
  78. static struct rtems_bsdnet_ifconfig netdriver_config = {
  79. RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
  80. RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
  81. #ifdef RTEMS_USE_LOOPBACK
  82. &loopback_config, /* link to next interface */
  83. #else
  84. NULL, /* No more interfaces */
  85. #endif
  86. #if (defined (RTEMS_USE_BOOTP))
  87. NULL, /* BOOTP supplies IP address */
  88. NULL, /* BOOTP supplies IP net mask */
  89. #else
  90. "192.168.0.33", /* IP address */
  91. "255.255.255.0", /* IP net mask */
  92. #endif /* !RTEMS_USE_BOOTP */
  93. #if (defined (RTEMS_SET_ETHERNET_ADDRESS))
  94. ethernet_address, /* Ethernet hardware address */
  95. #else
  96. NULL, /* Driver supplies hardware address */
  97. #endif
  98. 0 /* Use default driver parameters */
  99. };
  100. /*
  101. * Network configuration
  102. */
  103. struct rtems_bsdnet_config rtems_bsdnet_config = {
  104. &netdriver_config,
  105. #if (defined (RTEMS_USE_BOOTP))
  106. rtems_bsdnet_do_bootp,
  107. #else
  108. NULL,
  109. #endif
  110. NETWORK_STACK_PRIORITY, /* Default network task priority */
  111. 1048576, /* Default mbuf capacity */
  112. 1048576, /* Default mbuf cluster capacity */
  113. #if (!defined (RTEMS_USE_BOOTP))
  114. "testnode", /* Host name */
  115. "example.org", /* Domain name */
  116. "192.168.6.9", /* Gateway */
  117. "192.168.7.41", /* Log host */
  118. {"198.137.231.1" }, /* Name server(s) */
  119. {"207.202.190.162" }, /* NTP server(s) */
  120. #endif /* !RTEMS_USE_BOOTP */
  121. };
  122. #endif /* _RTEMS_NETWORKCONFIG_H_ */