sbhnddma.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. /*
  2. * Generic Broadcom Home Networking Division (HND) DMA engine HW interface
  3. * This supports the following chips: BCM42xx, 44xx, 47xx .
  4. *
  5. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  6. *
  7. * Copyright (C) 1999-2020, Broadcom Corporation
  8. *
  9. * Unless you and Broadcom execute a separate written software license
  10. * agreement governing use of this software, this software is licensed to you
  11. * under the terms of the GNU General Public License version 2 (the "GPL"),
  12. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  13. * following added to such license:
  14. *
  15. * As a special exception, the copyright holders of this software give you
  16. * permission to link this software with independent modules, and to copy and
  17. * distribute the resulting executable under terms of your choice, provided that
  18. * you also meet, for each linked independent module, the terms and conditions of
  19. * the license of that module. An independent module is a module which is not
  20. * derived from this software. The special exception does not apply to any
  21. * modifications of the software.
  22. *
  23. * Notwithstanding the above, under no circumstances may you combine this
  24. * software in any way with any other Broadcom software provided under a license
  25. * other than the GPL, without Broadcom's express prior written consent.
  26. *
  27. *
  28. * <<Broadcom-WL-IPTag/Open:>>
  29. *
  30. * $Id: sbhnddma.h 694506 2017-04-13 05:10:05Z $
  31. */
  32. #ifndef _sbhnddma_h_
  33. #define _sbhnddma_h_
  34. /* DMA structure:
  35. * support two DMA engines: 32 bits address or 64 bit addressing
  36. * basic DMA register set is per channel(transmit or receive)
  37. * a pair of channels is defined for convenience
  38. */
  39. /* 32 bits addressing */
  40. /** dma registers per channel(xmt or rcv) */
  41. typedef volatile struct {
  42. uint32 control; /**< enable, et al */
  43. uint32 addr; /**< descriptor ring base address (4K aligned) */
  44. uint32 ptr; /**< last descriptor posted to chip */
  45. uint32 status; /**< current active descriptor, et al */
  46. } dma32regs_t;
  47. typedef volatile struct {
  48. dma32regs_t xmt; /**< dma tx channel */
  49. dma32regs_t rcv; /**< dma rx channel */
  50. } dma32regp_t;
  51. typedef volatile struct { /* diag access */
  52. uint32 fifoaddr; /**< diag address */
  53. uint32 fifodatalow; /**< low 32bits of data */
  54. uint32 fifodatahigh; /**< high 32bits of data */
  55. uint32 pad; /**< reserved */
  56. } dma32diag_t;
  57. /**
  58. * DMA Descriptor
  59. * Descriptors are only read by the hardware, never written back.
  60. */
  61. typedef volatile struct {
  62. uint32 ctrl; /**< misc control bits & bufcount */
  63. uint32 addr; /**< data buffer address */
  64. } dma32dd_t;
  65. /** Each descriptor ring must be 4096byte aligned, and fit within a single 4096byte page. */
  66. #define D32RINGALIGN_BITS 12
  67. #define D32MAXRINGSZ (1 << D32RINGALIGN_BITS)
  68. #define D32RINGALIGN (1 << D32RINGALIGN_BITS)
  69. #define D32MAXDD (D32MAXRINGSZ / sizeof (dma32dd_t))
  70. /* transmit channel control */
  71. #define XC_XE ((uint32)1 << 0) /**< transmit enable */
  72. #define XC_SE ((uint32)1 << 1) /**< transmit suspend request */
  73. #define XC_LE ((uint32)1 << 2) /**< loopback enable */
  74. #define XC_FL ((uint32)1 << 4) /**< flush request */
  75. #define XC_MR_MASK 0x000001C0 /**< Multiple outstanding reads */
  76. #define XC_MR_SHIFT 6
  77. #define XC_PD ((uint32)1 << 11) /**< parity check disable */
  78. #define XC_AE ((uint32)3 << 16) /**< address extension bits */
  79. #define XC_AE_SHIFT 16
  80. #define XC_BL_MASK 0x001C0000 /**< BurstLen bits */
  81. #define XC_BL_SHIFT 18
  82. #define XC_PC_MASK 0x00E00000 /**< Prefetch control */
  83. #define XC_PC_SHIFT 21
  84. #define XC_PT_MASK 0x03000000 /**< Prefetch threshold */
  85. #define XC_PT_SHIFT 24
  86. /** Multiple outstanding reads */
  87. #define DMA_MR_1 0
  88. #define DMA_MR_2 1
  89. #define DMA_MR_4 2
  90. #define DMA_MR_8 3
  91. #define DMA_MR_12 4
  92. #define DMA_MR_16 5
  93. #define DMA_MR_20 6
  94. #define DMA_MR_32 7
  95. /** DMA Burst Length in bytes */
  96. #define DMA_BL_16 0
  97. #define DMA_BL_32 1
  98. #define DMA_BL_64 2
  99. #define DMA_BL_128 3
  100. #define DMA_BL_256 4
  101. #define DMA_BL_512 5
  102. #define DMA_BL_1024 6
  103. /** Prefetch control */
  104. #define DMA_PC_0 0
  105. #define DMA_PC_4 1
  106. #define DMA_PC_8 2
  107. #define DMA_PC_16 3
  108. #define DMA_PC_32 4
  109. /* others: reserved */
  110. /** Prefetch threshold */
  111. #define DMA_PT_1 0
  112. #define DMA_PT_2 1
  113. #define DMA_PT_4 2
  114. #define DMA_PT_8 3
  115. /** Channel Switch */
  116. #define DMA_CS_OFF 0
  117. #define DMA_CS_ON 1
  118. /* transmit descriptor table pointer */
  119. #define XP_LD_MASK 0xfff /**< last valid descriptor */
  120. /* transmit channel status */
  121. #define XS_CD_MASK 0x0fff /**< current descriptor pointer */
  122. #define XS_XS_MASK 0xf000 /**< transmit state */
  123. #define XS_XS_SHIFT 12
  124. #define XS_XS_DISABLED 0x0000 /**< disabled */
  125. #define XS_XS_ACTIVE 0x1000 /**< active */
  126. #define XS_XS_IDLE 0x2000 /**< idle wait */
  127. #define XS_XS_STOPPED 0x3000 /**< stopped */
  128. #define XS_XS_SUSP 0x4000 /**< suspend pending */
  129. #define XS_XE_MASK 0xf0000 /**< transmit errors */
  130. #define XS_XE_SHIFT 16
  131. #define XS_XE_NOERR 0x00000 /**< no error */
  132. #define XS_XE_DPE 0x10000 /**< descriptor protocol error */
  133. #define XS_XE_DFU 0x20000 /**< data fifo underrun */
  134. #define XS_XE_BEBR 0x30000 /**< bus error on buffer read */
  135. #define XS_XE_BEDA 0x40000 /**< bus error on descriptor access */
  136. #define XS_AD_MASK 0xfff00000 /**< active descriptor */
  137. #define XS_AD_SHIFT 20
  138. /* receive channel control */
  139. #define RC_RE ((uint32)1 << 0) /**< receive enable */
  140. #define RC_RO_MASK 0xfe /**< receive frame offset */
  141. #define RC_RO_SHIFT 1
  142. #define RC_FM ((uint32)1 << 8) /**< direct fifo receive (pio) mode */
  143. #define RC_SH ((uint32)1 << 9) /**< separate rx header descriptor enable */
  144. #define RC_OC ((uint32)1 << 10) /**< overflow continue */
  145. #define RC_PD ((uint32)1 << 11) /**< parity check disable */
  146. #define RC_AE ((uint32)3 << 16) /**< address extension bits */
  147. #define RC_AE_SHIFT 16
  148. #define RC_BL_MASK 0x001C0000 /**< BurstLen bits */
  149. #define RC_BL_SHIFT 18
  150. #define RC_PC_MASK 0x00E00000 /**< Prefetch control */
  151. #define RC_PC_SHIFT 21
  152. #define RC_PT_MASK 0x03000000 /**< Prefetch threshold */
  153. #define RC_PT_SHIFT 24
  154. #define RC_WAITCMP_MASK 0x00001000
  155. #define RC_WAITCMP_SHIFT 12
  156. /* receive descriptor table pointer */
  157. #define RP_LD_MASK 0xfff /**< last valid descriptor */
  158. /* receive channel status */
  159. #define RS_CD_MASK 0x0fff /**< current descriptor pointer */
  160. #define RS_RS_MASK 0xf000 /**< receive state */
  161. #define RS_RS_SHIFT 12
  162. #define RS_RS_DISABLED 0x0000 /**< disabled */
  163. #define RS_RS_ACTIVE 0x1000 /**< active */
  164. #define RS_RS_IDLE 0x2000 /**< idle wait */
  165. #define RS_RS_STOPPED 0x3000 /**< reserved */
  166. #define RS_RE_MASK 0xf0000 /**< receive errors */
  167. #define RS_RE_SHIFT 16
  168. #define RS_RE_NOERR 0x00000 /**< no error */
  169. #define RS_RE_DPE 0x10000 /**< descriptor protocol error */
  170. #define RS_RE_DFO 0x20000 /**< data fifo overflow */
  171. #define RS_RE_BEBW 0x30000 /**< bus error on buffer write */
  172. #define RS_RE_BEDA 0x40000 /**< bus error on descriptor access */
  173. #define RS_AD_MASK 0xfff00000 /**< active descriptor */
  174. #define RS_AD_SHIFT 20
  175. /* fifoaddr */
  176. #define FA_OFF_MASK 0xffff /**< offset */
  177. #define FA_SEL_MASK 0xf0000 /**< select */
  178. #define FA_SEL_SHIFT 16
  179. #define FA_SEL_XDD 0x00000 /**< transmit dma data */
  180. #define FA_SEL_XDP 0x10000 /**< transmit dma pointers */
  181. #define FA_SEL_RDD 0x40000 /**< receive dma data */
  182. #define FA_SEL_RDP 0x50000 /**< receive dma pointers */
  183. #define FA_SEL_XFD 0x80000 /**< transmit fifo data */
  184. #define FA_SEL_XFP 0x90000 /**< transmit fifo pointers */
  185. #define FA_SEL_RFD 0xc0000 /**< receive fifo data */
  186. #define FA_SEL_RFP 0xd0000 /**< receive fifo pointers */
  187. #define FA_SEL_RSD 0xe0000 /**< receive frame status data */
  188. #define FA_SEL_RSP 0xf0000 /**< receive frame status pointers */
  189. /* descriptor control flags */
  190. #define CTRL_BC_MASK 0x00001fff /**< buffer byte count, real data len must <= 4KB */
  191. #define CTRL_AE ((uint32)3 << 16) /**< address extension bits */
  192. #define CTRL_AE_SHIFT 16
  193. #define CTRL_PARITY ((uint32)3 << 18) /**< parity bit */
  194. #define CTRL_EOT ((uint32)1 << 28) /**< end of descriptor table */
  195. #define CTRL_IOC ((uint32)1 << 29) /**< interrupt on completion */
  196. #define CTRL_EOF ((uint32)1 << 30) /**< end of frame */
  197. #define CTRL_SOF ((uint32)1 << 31) /**< start of frame */
  198. /** control flags in the range [27:20] are core-specific and not defined here */
  199. #define CTRL_CORE_MASK 0x0ff00000
  200. /* 64 bits addressing */
  201. /** dma registers per channel(xmt or rcv) */
  202. typedef volatile struct {
  203. uint32 control; /**< enable, et al */
  204. uint32 ptr; /**< last descriptor posted to chip */
  205. uint32 addrlow; /**< descriptor ring base address low 32-bits (8K aligned) */
  206. uint32 addrhigh; /**< descriptor ring base address bits 63:32 (8K aligned) */
  207. uint32 status0; /**< current descriptor, xmt state */
  208. uint32 status1; /**< active descriptor, xmt error */
  209. } dma64regs_t;
  210. typedef volatile struct {
  211. dma64regs_t tx; /**< dma64 tx channel */
  212. dma64regs_t rx; /**< dma64 rx channel */
  213. } dma64regp_t;
  214. typedef volatile struct { /**< diag access */
  215. uint32 fifoaddr; /**< diag address */
  216. uint32 fifodatalow; /**< low 32bits of data */
  217. uint32 fifodatahigh; /**< high 32bits of data */
  218. uint32 pad; /**< reserved */
  219. } dma64diag_t;
  220. /**
  221. * DMA Descriptor
  222. * Descriptors are only read by the hardware, never written back.
  223. */
  224. typedef volatile struct {
  225. uint32 ctrl1; /**< misc control bits */
  226. uint32 ctrl2; /**< buffer count and address extension */
  227. uint32 addrlow; /**< memory address of the date buffer, bits 31:0 */
  228. uint32 addrhigh; /**< memory address of the date buffer, bits 63:32 */
  229. } dma64dd_t;
  230. /**
  231. * Each descriptor ring must be 8kB aligned, and fit within a contiguous 8kB physical addresss.
  232. */
  233. #define D64RINGALIGN_BITS 13
  234. #define D64MAXRINGSZ (1 << D64RINGALIGN_BITS)
  235. #define D64RINGBOUNDARY (1 << D64RINGALIGN_BITS)
  236. #define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t))
  237. /** for cores with large descriptor ring support, descriptor ring size can be up to 4096 */
  238. #define D64MAXDD_LARGE ((1 << 16) / sizeof (dma64dd_t))
  239. /**
  240. * for cores with large descriptor ring support (4k descriptors), descriptor ring cannot cross
  241. * 64K boundary
  242. */
  243. #define D64RINGBOUNDARY_LARGE (1 << 16)
  244. /*
  245. * Default DMA Burstlen values for USBRev >= 12 and SDIORev >= 11.
  246. * When this field contains the value N, the burst length is 2**(N + 4) bytes.
  247. */
  248. #define D64_DEF_USBBURSTLEN 2
  249. #define D64_DEF_SDIOBURSTLEN 1
  250. #ifndef D64_USBBURSTLEN
  251. #define D64_USBBURSTLEN DMA_BL_64
  252. #endif // endif
  253. #ifndef D64_SDIOBURSTLEN
  254. #define D64_SDIOBURSTLEN DMA_BL_32
  255. #endif // endif
  256. /* transmit channel control */
  257. #define D64_XC_XE 0x00000001 /**< transmit enable */
  258. #define D64_XC_SE 0x00000002 /**< transmit suspend request */
  259. #define D64_XC_LE 0x00000004 /**< loopback enable */
  260. #define D64_XC_FL 0x00000010 /**< flush request */
  261. #define D64_XC_MR_MASK 0x000001C0 /**< Multiple outstanding reads */
  262. #define D64_XC_MR_SHIFT 6
  263. #define D64_XC_CS_SHIFT 9 /**< channel switch enable */
  264. #define D64_XC_CS_MASK 0x00000200 /**< channel switch enable */
  265. #define D64_XC_PD 0x00000800 /**< parity check disable */
  266. #define D64_XC_AE 0x00030000 /**< address extension bits */
  267. #define D64_XC_AE_SHIFT 16
  268. #define D64_XC_BL_MASK 0x001C0000 /**< BurstLen bits */
  269. #define D64_XC_BL_SHIFT 18
  270. #define D64_XC_PC_MASK 0x00E00000 /**< Prefetch control */
  271. #define D64_XC_PC_SHIFT 21
  272. #define D64_XC_PT_MASK 0x03000000 /**< Prefetch threshold */
  273. #define D64_XC_PT_SHIFT 24
  274. #define D64_XC_CO_MASK 0x04000000 /**< coherent transactions for descriptors */
  275. #define D64_XC_CO_SHIFT 26
  276. /* transmit descriptor table pointer */
  277. #define D64_XP_LD_MASK 0x00001fff /**< last valid descriptor */
  278. /* transmit channel status */
  279. #define D64_XS0_CD_MASK (di->d64_xs0_cd_mask) /**< current descriptor pointer */
  280. #define D64_XS0_XS_MASK 0xf0000000 /**< transmit state */
  281. #define D64_XS0_XS_SHIFT 28
  282. #define D64_XS0_XS_DISABLED 0x00000000 /**< disabled */
  283. #define D64_XS0_XS_ACTIVE 0x10000000 /**< active */
  284. #define D64_XS0_XS_IDLE 0x20000000 /**< idle wait */
  285. #define D64_XS0_XS_STOPPED 0x30000000 /**< stopped */
  286. #define D64_XS0_XS_SUSP 0x40000000 /**< suspend pending */
  287. #define D64_XS1_AD_MASK (di->d64_xs1_ad_mask) /**< active descriptor */
  288. #define D64_XS1_XE_MASK 0xf0000000 /**< transmit errors */
  289. #define D64_XS1_XE_SHIFT 28
  290. #define D64_XS1_XE_NOERR 0x00000000 /**< no error */
  291. #define D64_XS1_XE_DPE 0x10000000 /**< descriptor protocol error */
  292. #define D64_XS1_XE_DFU 0x20000000 /**< data fifo underrun */
  293. #define D64_XS1_XE_DTE 0x30000000 /**< data transfer error */
  294. #define D64_XS1_XE_DESRE 0x40000000 /**< descriptor read error */
  295. #define D64_XS1_XE_COREE 0x50000000 /**< core error */
  296. /* receive channel control */
  297. #define D64_RC_RE 0x00000001 /**< receive enable */
  298. #define D64_RC_RO_MASK 0x000000fe /**< receive frame offset */
  299. #define D64_RC_RO_SHIFT 1
  300. #define D64_RC_FM 0x00000100 /**< direct fifo receive (pio) mode */
  301. #define D64_RC_SH 0x00000200 /**< separate rx header descriptor enable */
  302. #define D64_RC_SHIFT 9 /**< separate rx header descriptor enable */
  303. #define D64_RC_OC 0x00000400 /**< overflow continue */
  304. #define D64_RC_PD 0x00000800 /**< parity check disable */
  305. #define D64_RC_WAITCMP_MASK 0x00001000
  306. #define D64_RC_WAITCMP_SHIFT 12
  307. #define D64_RC_SA 0x00002000 /**< select active */
  308. #define D64_RC_GE 0x00004000 /**< Glom enable */
  309. #define D64_RC_AE 0x00030000 /**< address extension bits */
  310. #define D64_RC_AE_SHIFT 16
  311. #define D64_RC_BL_MASK 0x001C0000 /**< BurstLen bits */
  312. #define D64_RC_BL_SHIFT 18
  313. #define D64_RC_PC_MASK 0x00E00000 /**< Prefetch control */
  314. #define D64_RC_PC_SHIFT 21
  315. #define D64_RC_PT_MASK 0x03000000 /**< Prefetch threshold */
  316. #define D64_RC_PT_SHIFT 24
  317. #define D64_RC_CO_MASK 0x04000000 /**< coherent transactions for descriptors */
  318. #define D64_RC_CO_SHIFT 26
  319. #define D64_RC_ROEXT_MASK 0x08000000 /**< receive frame offset extension bit */
  320. #define D64_RC_ROEXT_SHIFT 27
  321. /* flags for dma controller */
  322. #define DMA_CTRL_PEN (1 << 0) /**< partity enable */
  323. #define DMA_CTRL_ROC (1 << 1) /**< rx overflow continue */
  324. #define DMA_CTRL_RXMULTI (1 << 2) /**< allow rx scatter to multiple descriptors */
  325. #define DMA_CTRL_UNFRAMED (1 << 3) /**< Unframed Rx/Tx data */
  326. #define DMA_CTRL_USB_BOUNDRY4KB_WAR (1 << 4)
  327. #define DMA_CTRL_DMA_AVOIDANCE_WAR (1 << 5) /**< DMA avoidance WAR for 4331 */
  328. #define DMA_CTRL_RXSINGLE (1 << 6) /**< always single buffer */
  329. #define DMA_CTRL_SDIO_RXGLOM (1 << 7) /**< DMA Rx glome is enabled */
  330. #define DMA_CTRL_DESC_ONLY_FLAG (1 << 8) /**< For DMA which posts only descriptors,
  331. * no packets
  332. */
  333. #define DMA_CTRL_DESC_CD_WAR (1 << 9) /**< WAR for descriptor only DMA's CD not being
  334. * updated correctly by HW in CT mode.
  335. */
  336. #define DMA_CTRL_CS (1 << 10) /* channel switch enable */
  337. #define DMA_CTRL_ROEXT (1 << 11) /* receive frame offset extension support */
  338. #define DMA_CTRL_RX_ALIGN_8BYTE (1 << 12) /* RXDMA address 8-byte aligned for 43684A0 */
  339. /* receive descriptor table pointer */
  340. #define D64_RP_LD_MASK 0x00001fff /**< last valid descriptor */
  341. /* receive channel status */
  342. #define D64_RS0_CD_MASK (di->d64_rs0_cd_mask) /**< current descriptor pointer */
  343. #define D64_RS0_RS_MASK 0xf0000000 /**< receive state */
  344. #define D64_RS0_RS_SHIFT 28
  345. #define D64_RS0_RS_DISABLED 0x00000000 /**< disabled */
  346. #define D64_RS0_RS_ACTIVE 0x10000000 /**< active */
  347. #define D64_RS0_RS_IDLE 0x20000000 /**< idle wait */
  348. #define D64_RS0_RS_STOPPED 0x30000000 /**< stopped */
  349. #define D64_RS0_RS_SUSP 0x40000000 /**< suspend pending */
  350. #define D64_RS1_AD_MASK (di->d64_rs1_ad_mask) /* active descriptor pointer */
  351. #define D64_RS1_RE_MASK 0xf0000000 /* receive errors */
  352. #define D64_RS1_RE_SHIFT 28
  353. #define D64_RS1_RE_NOERR 0x00000000 /**< no error */
  354. #define D64_RS1_RE_DPO 0x10000000 /**< descriptor protocol error */
  355. #define D64_RS1_RE_DFU 0x20000000 /**< data fifo overflow */
  356. #define D64_RS1_RE_DTE 0x30000000 /**< data transfer error */
  357. #define D64_RS1_RE_DESRE 0x40000000 /**< descriptor read error */
  358. #define D64_RS1_RE_COREE 0x50000000 /**< core error */
  359. /* fifoaddr */
  360. #define D64_FA_OFF_MASK 0xffff /**< offset */
  361. #define D64_FA_SEL_MASK 0xf0000 /**< select */
  362. #define D64_FA_SEL_SHIFT 16
  363. #define D64_FA_SEL_XDD 0x00000 /**< transmit dma data */
  364. #define D64_FA_SEL_XDP 0x10000 /**< transmit dma pointers */
  365. #define D64_FA_SEL_RDD 0x40000 /**< receive dma data */
  366. #define D64_FA_SEL_RDP 0x50000 /**< receive dma pointers */
  367. #define D64_FA_SEL_XFD 0x80000 /**< transmit fifo data */
  368. #define D64_FA_SEL_XFP 0x90000 /**< transmit fifo pointers */
  369. #define D64_FA_SEL_RFD 0xc0000 /**< receive fifo data */
  370. #define D64_FA_SEL_RFP 0xd0000 /**< receive fifo pointers */
  371. #define D64_FA_SEL_RSD 0xe0000 /**< receive frame status data */
  372. #define D64_FA_SEL_RSP 0xf0000 /**< receive frame status pointers */
  373. /* descriptor control flags 1 */
  374. #define D64_CTRL_COREFLAGS 0x0ff00000 /**< core specific flags */
  375. #define D64_CTRL1_COHERENT ((uint32)1 << 17) /* cache coherent per transaction */
  376. #define D64_CTRL1_NOTPCIE ((uint32)1 << 18) /**< buirst size control */
  377. #define D64_CTRL1_EOT ((uint32)1 << 28) /**< end of descriptor table */
  378. #define D64_CTRL1_IOC ((uint32)1 << 29) /**< interrupt on completion */
  379. #define D64_CTRL1_EOF ((uint32)1 << 30) /**< end of frame */
  380. #define D64_CTRL1_SOF ((uint32)1 << 31) /**< start of frame */
  381. /* descriptor control flags 2 */
  382. #define D64_CTRL2_MAX_LEN 0x0000fff7 /* Max transfer length (buffer byte count) <= 65527 */
  383. #define D64_CTRL2_BC_MASK 0x0000ffff /**< mask for buffer byte count */
  384. #define D64_CTRL2_AE 0x00030000 /**< address extension bits */
  385. #define D64_CTRL2_AE_SHIFT 16
  386. #define D64_CTRL2_PARITY 0x00040000 /* parity bit */
  387. /** control flags in the range [27:20] are core-specific and not defined here */
  388. #define D64_CTRL_CORE_MASK 0x0ff00000
  389. #define D64_RX_FRM_STS_LEN 0x0000ffff /**< frame length mask */
  390. #define D64_RX_FRM_STS_OVFL 0x00800000 /**< RxOverFlow */
  391. #define D64_RX_FRM_STS_DSCRCNT 0x0f000000 /**< no. of descriptors used - 1, d11corerev >= 22 */
  392. #define D64_RX_FRM_STS_DSCRCNT_SHIFT 24 /* Shift for no .of dma descriptor field */
  393. #define D64_RX_FRM_STS_DATATYPE 0xf0000000 /**< core-dependent data type */
  394. #define BCM_D64_CTRL2_BOUND_DMA_LENGTH(len) \
  395. (((len) > D64_CTRL2_MAX_LEN) ? D64_CTRL2_MAX_LEN : (len))
  396. /** receive frame status */
  397. typedef volatile struct {
  398. uint16 len;
  399. uint16 flags;
  400. } dma_rxh_t;
  401. #endif /* _sbhnddma_h_ */