nwl_defines.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /** @name Buffer Descriptor offsets
  2. * USR fields are defined by higher level IP. For example, checksum offload
  3. * setup for EMAC type devices. The 1st 8 words are utilized by hardware. Any
  4. * words after the 8th are for software use only.
  5. * @{
  6. */
  7. #define DMA_BD_BUFL_STATUS_OFFSET 0x00 /**< Buffer length + status */
  8. #define DMA_BD_USRL_OFFSET 0x04 /**< User logic specific - LSBytes */
  9. #define DMA_BD_USRH_OFFSET 0x08 /**< User logic specific - MSBytes */
  10. #define DMA_BD_CARDA_OFFSET 0x0C /**< Card address */
  11. #define DMA_BD_BUFL_CTRL_OFFSET 0x10 /**< Buffer length + control */
  12. #define DMA_BD_BUFAL_OFFSET 0x14 /**< Buffer address LSBytes */
  13. #define DMA_BD_BUFAH_OFFSET 0x18 /**< Buffer address MSBytes */
  14. #define DMA_BD_NDESC_OFFSET 0x1C /**< Next descriptor pointer */
  15. /* Bit masks for some BD fields */
  16. #define DMA_BD_BUFL_MASK 0x000FFFFF /**< Byte count */
  17. #define DMA_BD_STATUS_MASK 0xFF000000 /**< Status Flags */
  18. #define DMA_BD_CTRL_MASK 0xFF000000 /**< Control Flags */
  19. /* Bit masks for BD control field */
  20. #define DMA_BD_INT_ERROR_MASK 0x02000000 /**< Intr on error */
  21. #define DMA_BD_INT_COMP_MASK 0x01000000 /**< Intr on BD completion */
  22. /* Bit masks for BD status field */
  23. #define DMA_BD_SOP_MASK 0x80000000 /**< Start of packet */
  24. #define DMA_BD_EOP_MASK 0x40000000 /**< End of packet */
  25. #define DMA_BD_ERROR_MASK 0x10000000 /**< BD had error */
  26. #define DMA_BD_USER_HIGH_ZERO_MASK 0x08000000 /**< User High Status zero */
  27. #define DMA_BD_USER_LOW_ZERO_MASK 0x04000000 /**< User Low Status zero */
  28. #define DMA_BD_SHORT_MASK 0x02000000 /**< BD not fully used */
  29. #define DMA_BD_COMP_MASK 0x01000000 /**< BD completed */
  30. #define DMA_BD_MINIMUM_ALIGNMENT 0x40 /**< Minimum byte alignment */
  31. /* Common DMA registers */
  32. #define REG_DMA_CTRL_STATUS 0x4000 /**< DMA Common Ctrl & Status */
  33. /* These engine registers are applicable to both S2C and C2S channels.
  34. * Register field mask and shift definitions are later in this file.
  35. */
  36. #define REG_DMA_ENG_CAP 0x00000000 /**< DMA Engine Capabilities */
  37. #define REG_DMA_ENG_CTRL_STATUS 0x00000004 /**< DMA Engine Control */
  38. #define REG_DMA_ENG_NEXT_BD 0x00000008 /**< HW Next desc pointer */
  39. #define REG_SW_NEXT_BD 0x0000000C /**< SW Next desc pointer */
  40. #define REG_DMA_ENG_LAST_BD 0x00000010 /**< HW Last completed pointer */
  41. #define REG_DMA_ENG_ACTIVE_TIME 0x00000014 /**< DMA Engine Active Time */
  42. #define REG_DMA_ENG_WAIT_TIME 0x00000018 /**< DMA Engine Wait Time */
  43. #define REG_DMA_ENG_COMP_BYTES 0x0000001C /**< DMA Engine Completed Bytes */
  44. /* Register masks. The following constants define bit locations of various
  45. * control bits in the registers. For further information on the meaning of
  46. * the various bit masks, refer to the hardware spec.
  47. *
  48. * Masks have been written assuming HW bits 0-31 correspond to SW bits 0-31
  49. */
  50. /** @name Bitmasks of REG_DMA_CTRL_STATUS register.
  51. * @{
  52. */
  53. #define DMA_INT_ENABLE 0x00000001 /**< Enable global interrupts */
  54. #define DMA_INT_DISABLE 0x00000000 /**< Disable interrupts */
  55. #define DMA_INT_ACTIVE_MASK 0x00000002 /**< Interrupt active? */
  56. #define DMA_INT_PENDING_MASK 0x00000004 /**< Engine interrupt pending */
  57. #define DMA_INT_MSI_MODE 0x00000008 /**< MSI or Legacy mode? */
  58. #define DMA_USER_INT_ENABLE 0x00000010 /**< Enable user interrupts */
  59. #define DMA_USER_INT_ACTIVE_MASK 0x00000020 /**< Int - user interrupt */
  60. #define DMA_USER_INT_ACK 0x00000020 /**< Acknowledge */
  61. #define DMA_MPS_USED 0x00000700 /**< MPS Used */
  62. #define DMA_MRRS_USED 0x00007000 /**< MRRS Used */
  63. #define DMA_S2C_ENG_INT_VAL 0x00FF0000 /**< IRQ value of 1st 8 S2Cs */
  64. #define DMA_C2S_ENG_INT_VAL 0xFF000000 /**< IRQ value of 1st 8 C2Ss */
  65. /** @name Bitmasks of REG_DMA_ENG_CAP register.
  66. * @{
  67. */
  68. /* DMA engine characteristics */
  69. #define DMA_ENG_PRESENT_MASK 0x00000001 /**< DMA engine present? */
  70. #define DMA_ENG_DIRECTION_MASK 0x00000002 /**< DMA engine direction */
  71. #define DMA_ENG_C2S 0x00000002 /**< DMA engine - C2S */
  72. #define DMA_ENG_S2C 0x00000000 /**< DMA engine - S2C */
  73. #define DMA_ENG_TYPE_MASK 0x00000030 /**< DMA engine type */
  74. #define DMA_ENG_BLOCK 0x00000000 /**< DMA engine - Block type */
  75. #define DMA_ENG_PACKET 0x00000010 /**< DMA engine - Packet type */
  76. #define DMA_ENG_NUMBER 0x0000FF00 /**< DMA engine number */
  77. #define DMA_ENG_BD_MAX_BC 0x3F000000 /**< DMA engine max buffer size */
  78. /* Shift constants for selected masks */
  79. #define DMA_ENG_NUMBER_SHIFT 8
  80. #define DMA_ENG_BD_MAX_BC_SHIFT 24
  81. /** @name Bitmasks of REG_DMA_ENG_CTRL_STATUS register.
  82. * @{
  83. */
  84. /* Interrupt activity and acknowledgement bits */
  85. #define DMA_ENG_INT_ENABLE 0x00000001 /**< Enable interrupts */
  86. #define DMA_ENG_INT_DISABLE 0x00000000 /**< Disable interrupts */
  87. #define DMA_ENG_INT_ACTIVE_MASK 0x00000002 /**< Interrupt active? */
  88. #define DMA_ENG_INT_ACK 0x00000002 /**< Interrupt ack */
  89. #define DMA_ENG_INT_BDCOMP 0x00000004 /**< Int - BD completion */
  90. #define DMA_ENG_INT_BDCOMP_ACK 0x00000004 /**< Acknowledge */
  91. #define DMA_ENG_INT_ALERR 0x00000008 /**< Int - BD align error */
  92. #define DMA_ENG_INT_ALERR_ACK 0x00000008 /**< Acknowledge */
  93. #define DMA_ENG_INT_FETERR 0x00000010 /**< Int - BD fetch error */
  94. #define DMA_ENG_INT_FETERR_ACK 0x00000010 /**< Acknowledge */
  95. #define DMA_ENG_INT_ABORTERR 0x00000020 /**< Int - DMA abort error */
  96. #define DMA_ENG_INT_ABORTERR_ACK 0x00000020 /**< Acknowledge */
  97. #define DMA_ENG_INT_CHAINEND 0x00000080 /**< Int - BD chain ended */
  98. #define DMA_ENG_INT_CHAINEND_ACK 0x00000080 /**< Acknowledge */
  99. /* DMA engine control */
  100. #define DMA_ENG_ENABLE_MASK 0x00000100 /**< DMA enabled? */
  101. #define DMA_ENG_ENABLE 0x00000100 /**< Enable DMA */
  102. #define DMA_ENG_DISABLE 0x00000000 /**< Disable DMA */
  103. #define DMA_ENG_STATE_MASK 0x00000C00 /**< Current DMA state? */
  104. #define DMA_ENG_RUNNING 0x00000400 /**< DMA running */
  105. #define DMA_ENG_IDLE 0x00000000 /**< DMA idle */
  106. #define DMA_ENG_WAITING 0x00000800 /**< DMA waiting */
  107. #define DMA_ENG_STATE_WAITED 0x00001000 /**< DMA waited earlier */
  108. #define DMA_ENG_WAITED_ACK 0x00001000 /**< Acknowledge */
  109. #define DMA_ENG_USER_RESET 0x00004000 /**< Reset only user logic */
  110. #define DMA_ENG_RESET 0x00008000 /**< Reset DMA engine + user */
  111. #define DMA_ENG_ALLINT_MASK 0x000000BE /**< To get only int events */
  112. #define DMA_ENGINE_PER_SIZE 0x100 /**< Separation between engine regs */
  113. #define DMA_OFFSET 0 /**< Starting register offset */
  114. /**< Size of DMA engine reg space */
  115. #define DMA_SIZE (MAX_DMA_ENGINES * DMA_ENGINE_PER_SIZE)
  116. #define TX_CONFIG_ADDRESS 0x9108 /* Reg for controlling TX data */
  117. #define RX_CONFIG_ADDRESS 0x9100 /* Reg for controlling RX pkt generator */
  118. #define PKT_SIZE_ADDRESS 0x9104 /* Reg for programming packet size */
  119. #define STATUS_ADDRESS 0x910C /* Reg for checking TX pkt checker status */
  120. /* Test start / stop conditions */
  121. #define PKTCHKR 0x00000001 /* Enable TX packet checker */
  122. #define PKTGENR 0x00000001 /* Enable RX packet generator */
  123. #define CHKR_MISMATCH 0x00000001 /* TX checker reported data mismatch */
  124. #define LOOPBACK 0x00000002 /* Enable TX data loopback onto RX */