eth0cs.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*!
  2. * Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. All advertising materials mentioning features or use of this
  14. * software must display the following acknowledgement:
  15. *
  16. * This product includes software developed by Call Direct Cellular Solutions Pty. Ltd.
  17. * and its contributors.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT
  23. * CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.calldirect.com.au/
  33. *-
  34. *
  35. * Portions Copyright (C) 2001 by egnite Software GmbH. All rights reserved.
  36. *
  37. * Redistribution and use in source and binary forms, with or without
  38. * modification, are permitted provided that the following conditions
  39. * are met:
  40. *
  41. * 1. Redistributions of source code must retain the above copyright
  42. * notice, this list of conditions and the following disclaimer.
  43. * 2. Redistributions in binary form must reproduce the above copyright
  44. * notice, this list of conditions and the following disclaimer in the
  45. * documentation and/or other materials provided with the distribution.
  46. * 3. All advertising materials mentioning features or use of this
  47. * software must display the following acknowledgement:
  48. *
  49. * This product includes software developed by egnite Software GmbH
  50. * and its contributors.
  51. *
  52. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  53. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  54. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  55. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  56. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  57. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  58. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  59. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  60. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  61. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  62. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  63. * SUCH DAMAGE.
  64. *
  65. * For additional information see http://www.ethernut.de/
  66. *
  67. */
  68. /*!
  69. * \file arch/avr/dev/eth0cs.c
  70. * \brief AVR network device for CS8900.
  71. *
  72. * \verbatim
  73. * $Id: eth0cs.c 5472 2013-12-06 00:16:28Z olereinhardt $
  74. * \endverbatim
  75. */
  76. #include <netinet/if_ether.h>
  77. #include <net/ether.h>
  78. #include <net/if_var.h>
  79. #include <dev/nicrtl.h>
  80. NICINFO dcb_eth0cs;
  81. extern int CSNicOutput(NUTDEVICE * dev, NETBUF * nb);
  82. extern int CSNicInit(NUTDEVICE * dev);
  83. /*
  84. * \brief Network interface information structure.
  85. *
  86. * Used to call.
  87. */
  88. IFNET ifn_eth0cs = {
  89. IFT_ETHER, /*!< \brief Interface type. */
  90. 0, /*!< \brief Interface flags, if_flags. */
  91. {0, 0, 0, 0, 0, 0}, /*!< \brief Hardware net address. */
  92. 0, /*!< \brief IP address. */
  93. 0, /*!< \brief Remote IP address for point to point. */
  94. 0, /*!< \brief IP network mask. */
  95. 567, /*!< \brief Maximum size of a transmission unit. */
  96. 0, /*!< \brief Packet identifier. */
  97. 0, /*!< \brief Linked list of arp entries. */
  98. 0, /*!< \brief Linked list of multicast address entries, if_mcast. */
  99. NutEtherInput, /*!< \brief Routine to pass received data to, if_recv(). */
  100. CSNicOutput, /*!< \brief Driver output routine, if_send(). */
  101. NutEtherOutput, /*!< \brief Media output routine, if_output(). */
  102. NULL /*!< \brief Interface specific control function, if_ioctl(). */
  103. #ifdef NUT_PERFMON
  104. , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  105. #endif
  106. };
  107. /*
  108. * \brief Device information structure.
  109. *
  110. * Applications must pass this structure to NutRegisterDevice()
  111. * to bind this Ethernet device driver to the Nut/OS kernel.
  112. * Having done that, the application may call NutNetIfConfig()
  113. * with the name \em eth0 of this driver to initialize the network
  114. * interface.
  115. *
  116. */
  117. NUTDEVICE devEth0cs = {
  118. 0, /*!< Pointer to next device. */
  119. {'e', 't', 'h', '0', 'c', 's', 0, 0, 0}
  120. , /*!< Unique device name. */
  121. IFTYP_NET, /*!< Type of device. */
  122. 0, /*!< Base address. */
  123. 0, /*!< First interrupt number. */
  124. &ifn_eth0cs, /*!< Interface control block. */
  125. &dcb_eth0cs, /*!< Driver control block. */
  126. CSNicInit, /*!< Driver initialization routine. */
  127. 0, /*!< Driver specific control function. */
  128. 0, /*!< Read from device. */
  129. 0, /*!< Write to device. */
  130. 0, /*!< Write from program space data to device. */
  131. 0, /*!< Open a device or file. */
  132. 0, /*!< Close a device or file. */
  133. 0, /*!< Request file size. */
  134. 0, /*!< Select function, optional, not yet implemented */
  135. };