1 #ifndef __ETH_OCM_DESCRIPTORS_H__
2 #define __ETH_OCM_DESCRIPTORS_H__
5 #include "eth_ocm_regs.h"
7 #define ETH_OCM_DESC_SIZE 2 //descriptors span two word
8 #define ETH_OCM_DESC_CTRL_WRD 0 //Control word is first word
9 #define ETH_OCM_DESC_PTR_WRD 1 //Pointer is second word
10 #define ETH_OCM_MAX_DESCRIPTORS 128
12 #define IOWR_ETH_OCM_DESC_CTRL(base, desc, dat) \
13 IOWR(base, (ETH_OCM_DESC_START + (desc<<1)), dat)
14 #define IORD_ETH_OCM_DESC_CTRL(base, desc) \
15 IORD(base, (ETH_OCM_DESC_START + (desc<<1)))
17 #define IOWR_ETH_OCM_DESC_PTR(base, desc, dat) \
18 IOWR(base, ((ETH_OCM_DESC_START + (desc<<1)) | 1), dat)
19 #define IORD_ETH_OCM_DESC_PTR(base, desc) \
20 IORD(base, ((ETH_OCM_DESC_START + (desc<<1)) | 1))
22 //Transmit descriptor bit masks
23 #define ETH_OCM_TXDESC_LEN_MSK 0xFFFF0000
24 #define ETH_OCM_TXDESC_LEN_OFST 16
25 #define ETH_OCM_TXDESC_READY_MSK 0x00008000
26 #define ETH_OCM_TXDESC_READY_OFST 15
27 #define ETH_OCM_TXDESC_IRQ_MSK 0x00004000
28 #define ETH_OCM_TXDESC_IRQ_OFST 14
29 #define ETH_OCM_TXDESC_WRAP_MSK 0x00002000
30 #define ETH_OCM_TXDESC_WRAP_OFST 13
31 #define ETH_OCM_TXDESC_PAD_MSK 0x00001000
32 #define ETH_OCM_TXDESC_PAD_OFST 12
33 #define ETH_OCM_TXDESC_CRC_MSK 0x00000800
34 #define ETH_OCM_TXDESC_CRC_OFST 11
35 #define ETH_OCM_TXDESC_UR_MSK 0x00000100
36 #define ETH_OCM_TXDESC_UR_OFST 8
37 #define ETH_OCM_TXDESC_RTRY_MSK 0x000000F0
38 #define ETH_OCM_TXDESC_RTRY_OFST 4
39 #define ETH_OCM_TXDESC_RL_MSK 0x00000008
40 #define ETH_OCM_TXDESC_RL_OFST 3
41 #define ETH_OCM_TXDESC_LC_MSK 0x00000004
42 #define ETH_OCM_TXDESC_LC_OFST 2
43 #define ETH_OCM_TXDESC_DF_MSK 0x00000002
44 #define ETH_OCM_TXDESC_DF_OFST 1
45 #define ETH_OCM_TXDESC_CS_MSK 0x00000001
46 #define ETH_OCM_TXDESC_CS_OFST 0
47 //End transmit descriptor bit masks
49 //Receive descriptor bit masks
50 #define ETH_OCM_RXDESC_LEN_MSK 0xFFFF0000
51 #define ETH_OCM_RXDESC_LEN_OFST 16
52 #define ETH_OCM_RXDESC_EMPTY_MSK 0x00008000
53 #define ETH_OCM_RXDESC_EMPTY_OFST 15
54 #define ETH_OCM_RXDESC_IRQ_MSK 0x00004000
55 #define ETH_OCM_RXDESC_IRQ_OFST 14
56 #define ETH_OCM_RXDESC_WRAP_MSK 0x00002000
57 #define ETH_OCM_RXDESC_WRAP_OFST 13
58 #define ETH_OCM_RXDESC_CF_MSK 0x00000100
59 #define ETH_OCM_RXDESC_CF_OFST 8
60 #define ETH_OCM_RXDESC_M_MSK 0x00000080
61 #define ETH_OCM_RXDESC_M_OFST 7
62 #define ETH_OCM_RXDESC_OR_MSK 0x00000040
63 #define ETH_OCM_RXDESC_OR_OFST 6
64 #define ETH_OCM_RXDESC_IS_MSK 0x00000020
65 #define ETH_OCM_RXDESC_IS_OFST 5
66 #define ETH_OCM_RXDESC_DN_MSK 0x00000010
67 #define ETH_OCM_RXDESC_DN_OFST 4
68 #define ETH_OCM_RXDESC_TL_MSK 0x00000008
69 #define ETH_OCM_RXDESC_TL_OFST 3
70 #define ETH_OCM_RXDESC_SF_MSK 0x00000004
71 #define ETH_OCM_RXDESC_SF_OFST 2
72 #define ETH_OCM_RXDESC_CRC_MSK 0x00000002
73 #define ETH_OCM_RXDESC_CRC_OFST 1
74 #define ETH_OCM_RXDESC_LC_MSK 0x00000001
75 #define ETH_OCM_RXDESC_LC_OFST 0
76 //End receive descriptor bit masks
78 #define ETH_OCM_RXDESC_ERROR_MSK \
79 (ETH_OCM_RXDESC_OR_MSK | \
80 ETH_OCM_RXDESC_IS_MSK | \
81 ETH_OCM_RXDESC_DN_MSK | \
82 ETH_OCM_RXDESC_TL_MSK | \
83 ETH_OCM_RXDESC_SF_MSK | \
84 ETH_OCM_RXDESC_CRC_MSK | \
85 ETH_OCM_RXDESC_LC_MSK) \
92 #endif //__ETH_OCM_DESCRIPTORS_H__