ep93xx_eth.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2009 Matthias Kaehlcke <matthias@kaehlcke.net>
  3. *
  4. * Copyright (C) 2004, 2005
  5. * Cory T. Tusar, Videon Central, Inc., <ctusar@videon-central.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. *
  25. */
  26. #ifndef _EP93XX_ETH_H
  27. #define _EP93XX_ETH_H
  28. #include <net.h>
  29. /**
  30. * #define this to dump device status and queue info during initialization and
  31. * following errors.
  32. */
  33. #undef EP93XX_MAC_DEBUG
  34. /**
  35. * Number of descriptor and status entries in our RX queues.
  36. * It must be power of 2 !
  37. */
  38. #define NUMRXDESC PKTBUFSRX
  39. /**
  40. * Number of descriptor and status entries in our TX queues.
  41. */
  42. #define NUMTXDESC 1
  43. /**
  44. * 944 = (1024 - 64) - 16, Fifo size - Minframesize - 16 (Chip FACT)
  45. */
  46. #define TXSTARTMAX 944
  47. /**
  48. * Receive descriptor queue entry
  49. */
  50. struct rx_descriptor {
  51. uint32_t word1;
  52. uint32_t word2;
  53. };
  54. /**
  55. * Receive status queue entry
  56. */
  57. struct rx_status {
  58. uint32_t word1;
  59. uint32_t word2;
  60. };
  61. #define RX_STATUS_RWE(rx_status) ((rx_status->word1 >> 30) & 0x01)
  62. #define RX_STATUS_RFP(rx_status) ((rx_status->word1 >> 31) & 0x01)
  63. #define RX_STATUS_FRAME_LEN(rx_status) (rx_status->word2 & 0xFFFF)
  64. /**
  65. * Transmit descriptor queue entry
  66. */
  67. struct tx_descriptor {
  68. uint32_t word1;
  69. uint32_t word2;
  70. };
  71. #define TX_DESC_EOF (1 << 31)
  72. /**
  73. * Transmit status queue entry
  74. */
  75. struct tx_status {
  76. uint32_t word1;
  77. };
  78. #define TX_STATUS_TXWE(tx_status) (((tx_status)->word1 >> 30) & 0x01)
  79. #define TX_STATUS_TXFP(tx_status) (((tx_status)->word1 >> 31) & 0x01)
  80. /**
  81. * Transmit descriptor queue
  82. */
  83. struct tx_descriptor_queue {
  84. struct tx_descriptor *base;
  85. struct tx_descriptor *current;
  86. struct tx_descriptor *end;
  87. };
  88. /**
  89. * Transmit status queue
  90. */
  91. struct tx_status_queue {
  92. struct tx_status *base;
  93. volatile struct tx_status *current;
  94. struct tx_status *end;
  95. };
  96. /**
  97. * Receive descriptor queue
  98. */
  99. struct rx_descriptor_queue {
  100. struct rx_descriptor *base;
  101. struct rx_descriptor *current;
  102. struct rx_descriptor *end;
  103. };
  104. /**
  105. * Receive status queue
  106. */
  107. struct rx_status_queue {
  108. struct rx_status *base;
  109. volatile struct rx_status *current;
  110. struct rx_status *end;
  111. };
  112. /**
  113. * EP93xx MAC private data structure
  114. */
  115. struct ep93xx_priv {
  116. struct rx_descriptor_queue rx_dq;
  117. struct rx_status_queue rx_sq;
  118. void *rx_buffer[NUMRXDESC];
  119. struct tx_descriptor_queue tx_dq;
  120. struct tx_status_queue tx_sq;
  121. struct mac_regs *regs;
  122. };
  123. #endif