dm9000a.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * File : dm9000a.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-07-01 Bernard the first version
  13. */
  14. #ifndef __DM9000_H__
  15. #define __DM9000_H__
  16. #define DM9000_IO_BASE 0x6C000000
  17. #define DM9000_DATA_BASE 0x6C000008
  18. #define DM9000_IO (*((volatile rt_uint16_t *) 0x6C000000)) // CMD = 0
  19. #define DM9000_DATA (*((volatile rt_uint16_t *) 0x6C000008)) // CMD = 1
  20. #define DM9000_inb(r) (*(volatile rt_uint8_t *)r)
  21. #define DM9000_outb(r, d) (*(volatile rt_uint8_t *)r = d)
  22. #define DM9000_inw(r) (*(volatile rt_uint16_t *)r)
  23. #define DM9000_outw(r, d) (*(volatile rt_uint16_t *)r = d)
  24. #define RST_1() GPIO_SetBits(GPIOE,GPIO_Pin_5)
  25. #define RST_0() GPIO_ResetBits(GPIOE,GPIO_Pin_5)
  26. #define DM9000_ID 0x90000A46 /* DM9000 ID */
  27. #define DM9000_PKT_MAX 1536 /* Received packet max size */
  28. #define DM9000_PKT_RDY 0x01 /* Packet ready to receive */
  29. #define DM9000_NCR 0x00
  30. #define DM9000_NSR 0x01
  31. #define DM9000_TCR 0x02
  32. #define DM9000_TSR1 0x03
  33. #define DM9000_TSR2 0x04
  34. #define DM9000_RCR 0x05
  35. #define DM9000_RSR 0x06
  36. #define DM9000_ROCR 0x07
  37. #define DM9000_BPTR 0x08
  38. #define DM9000_FCTR 0x09
  39. #define DM9000_FCR 0x0A
  40. #define DM9000_EPCR 0x0B
  41. #define DM9000_EPAR 0x0C
  42. #define DM9000_EPDRL 0x0D
  43. #define DM9000_EPDRH 0x0E
  44. #define DM9000_WCR 0x0F
  45. #define DM9000_PAR 0x10
  46. #define DM9000_MAR 0x16
  47. #define DM9000_GPCR 0x1e
  48. #define DM9000_GPR 0x1f
  49. #define DM9000_TRPAL 0x22
  50. #define DM9000_TRPAH 0x23
  51. #define DM9000_RWPAL 0x24
  52. #define DM9000_RWPAH 0x25
  53. #define DM9000_VIDL 0x28
  54. #define DM9000_VIDH 0x29
  55. #define DM9000_PIDL 0x2A
  56. #define DM9000_PIDH 0x2B
  57. #define DM9000_CHIPR 0x2C
  58. #define DM9000_TCR2 0x2D
  59. #define DM9000_OTCR 0x2E
  60. #define DM9000_SMCR 0x2F
  61. #define DM9000_ETCR 0x30 /* early transmit control/status register */
  62. #define DM9000_CSCR 0x31 /* check sum control register */
  63. #define DM9000_RCSSR 0x32 /* receive check sum status register */
  64. #define DM9000_MRCMDX 0xF0
  65. #define DM9000_MRCMD 0xF2
  66. #define DM9000_MRRL 0xF4
  67. #define DM9000_MRRH 0xF5
  68. #define DM9000_MWCMDX 0xF6
  69. #define DM9000_MWCMD 0xF8
  70. #define DM9000_MWRL 0xFA
  71. #define DM9000_MWRH 0xFB
  72. #define DM9000_TXPLL 0xFC
  73. #define DM9000_TXPLH 0xFD
  74. #define DM9000_ISR 0xFE
  75. #define DM9000_IMR 0xFF
  76. #define CHIPR_DM9000A 0x19
  77. #define CHIPR_DM9000B 0x1B
  78. #define NCR_EXT_PHY (1<<7)
  79. #define NCR_WAKEEN (1<<6)
  80. #define NCR_FCOL (1<<4)
  81. #define NCR_FDX (1<<3)
  82. #define NCR_LBK (3<<1)
  83. #define NCR_RST (1<<0)
  84. #define NSR_SPEED (1<<7)
  85. #define NSR_LINKST (1<<6)
  86. #define NSR_WAKEST (1<<5)
  87. #define NSR_TX2END (1<<3)
  88. #define NSR_TX1END (1<<2)
  89. #define NSR_RXOV (1<<1)
  90. #define TCR_TJDIS (1<<6)
  91. #define TCR_EXCECM (1<<5)
  92. #define TCR_PAD_DIS2 (1<<4)
  93. #define TCR_CRC_DIS2 (1<<3)
  94. #define TCR_PAD_DIS1 (1<<2)
  95. #define TCR_CRC_DIS1 (1<<1)
  96. #define TCR_TXREQ (1<<0)
  97. #define TSR_TJTO (1<<7)
  98. #define TSR_LC (1<<6)
  99. #define TSR_NC (1<<5)
  100. #define TSR_LCOL (1<<4)
  101. #define TSR_COL (1<<3)
  102. #define TSR_EC (1<<2)
  103. #define RCR_WTDIS (1<<6)
  104. #define RCR_DIS_LONG (1<<5)
  105. #define RCR_DIS_CRC (1<<4)
  106. #define RCR_ALL (1<<3)
  107. #define RCR_RUNT (1<<2)
  108. #define RCR_PRMSC (1<<1)
  109. #define RCR_RXEN (1<<0)
  110. #define RSR_RF (1<<7)
  111. #define RSR_MF (1<<6)
  112. #define RSR_LCS (1<<5)
  113. #define RSR_RWTO (1<<4)
  114. #define RSR_PLE (1<<3)
  115. #define RSR_AE (1<<2)
  116. #define RSR_CE (1<<1)
  117. #define RSR_FOE (1<<0)
  118. #define FCTR_HWOT(ot) (( ot & 0xf ) << 4 )
  119. #define FCTR_LWOT(ot) ( ot & 0xf )
  120. #define IMR_PAR (1<<7)
  121. #define IMR_ROOM (1<<3)
  122. #define IMR_ROM (1<<2)
  123. #define IMR_PTM (1<<1)
  124. #define IMR_PRM (1<<0)
  125. #define ISR_ROOS (1<<3)
  126. #define ISR_ROS (1<<2)
  127. #define ISR_PTS (1<<1)
  128. #define ISR_PRS (1<<0)
  129. #define ISR_CLR_STATUS (ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS)
  130. #define EPCR_REEP (1<<5)
  131. #define EPCR_WEP (1<<4)
  132. #define EPCR_EPOS (1<<3)
  133. #define EPCR_ERPRR (1<<2)
  134. #define EPCR_ERPRW (1<<1)
  135. #define EPCR_ERRE (1<<0)
  136. #define GPCR_GEP_CNTL (1<<0)
  137. #endif