3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * This file is based on code
6 * (C) Copyright Motorola, Inc., 2000
8 * odin smartdma header file
11 #ifndef __MPC5XXX_SDMA_H
12 #define __MPC5XXX_SDMA_H
17 /* Task number assignment */
18 #define FEC_RECV_TASK_NO 0
19 #define FEC_XMIT_TASK_NO 1
21 /*---------------------------------------------------------------------*/
23 /* Stuff for Ethernet Tx/Rx tasks */
25 /*---------------------------------------------------------------------*/
27 /* Layout of Ethernet controller Parameter SRAM area:
28 ----------------------------------------------------------------
29 0x00: TBD_BASE, base address of TX BD ring
30 0x04: TBD_NEXT, address of next TX BD to be processed
31 0x08: RBD_BASE, base address of RX BD ring
32 0x0C: RBD_NEXT, address of next RX BD to be processed
33 ---------------------------------------------------------------
34 ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
37 /* base address of SRAM area to store parameters used by Ethernet tasks */
38 #define FEC_PARAM_BASE (MPC5XXX_SRAM + 0x0800)
40 /* base address of SRAM area for buffer descriptors */
41 #define FEC_BD_BASE (MPC5XXX_SRAM + 0x0820)
43 /*---------------------------------------------------------------------*/
45 /* common shortcuts used by driver C code */
47 /*---------------------------------------------------------------------*/
49 /* Disable SmartDMA task */
50 #define SDMA_TASK_DISABLE(tasknum) \
52 volatile ushort *tcr = (ushort *)(MPC5XXX_SDMA + 0x0000001c + 2 * tasknum); \
53 *tcr = (*tcr) & (~0x8000); \
56 /* Enable SmartDMA task */
57 #define SDMA_TASK_ENABLE(tasknum) \
59 volatile ushort *tcr = (ushort *) (MPC5XXX_SDMA + 0x0000001c + 2 * tasknum); \
60 *tcr = (*tcr) | 0x8000; \
63 /* Enable interrupt */
64 #define SDMA_INT_ENABLE(tasknum) \
66 struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
67 sdma->IntMask &= ~(1 << tasknum); \
70 /* Disable interrupt */
71 #define SDMA_INT_DISABLE(tasknum) \
73 struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
74 sdma->IntMask |= (1 << tasknum); \
78 /* Clear interrupt pending bits */
79 #define SDMA_CLEAR_IEVENT(tasknum) \
81 struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
82 sdma->IntPend = (1 << tasknum); \
85 /* get interrupt pending bit of a task */
86 #define SDMA_GET_PENDINGBIT(tasknum) \
87 ((*(vu_long *)(MPC5XXX_SDMA + 0x14)) & (1<<(tasknum)))
89 /* get interrupt mask bit of a task */
90 #define SDMA_GET_MASKBIT(tasknum) \
91 ((*(vu_long *)(MPC5XXX_SDMA + 0x18)) & (1<<(tasknum)))
93 #endif /* __MPC5XXX_SDMA_H */