revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / networks / emac / mal.h
blobfeb6d623c094379bc6c6989a9ee64ba74a567274
1 #ifndef MAL_H_
2 #define MAL_H_
4 #include <inttypes.h>
6 struct EMACBase;
8 typedef struct {
9 uint16_t md_ctrl;
10 uint16_t md_length;
11 char *md_buffer;
12 } mal_descriptor_t;
14 typedef struct {
15 mal_descriptor_t descr[4];
16 } mal_packet_t;
18 void EMAC_MAL_Init(struct EMACBase *EMACBase);
20 #define MAL_CTRL_TX_R 0x8000 /* Ready for transmission */
21 #define MAL_CTRL_TX_W 0x4000 /* Wrap */
22 #define MAL_CTRL_TX_CM 0x2000 /* Continous mode */
23 #define MAL_CTRL_TX_L 0x1000 /* Last */
24 #define MAL_CTRL_TX_I 0x0400 /* Interrupt */
26 #define EMAC_CTRL_TX_GFCS 0x0200
27 #define EMAC_CTRL_TX_GP 0x0100
30 #define MAL_CTRL_RX_E 0x8000 /* Empty */
31 #define MAL_CTRL_RX_W 0x4000 /* Wrap */
32 #define MAL_CTRL_RX_CM 0x2000 /* Continous mode */
33 #define MAL_CTRL_RX_L 0x1000 /* Last */
34 #define MAL_CTRL_RX_F 0x0800 /* First */
35 #define MAL_CTRL_RX_I 0x0400 /* Interrupt */
37 /* Configuration Reg */
38 #define MAL_CR_MMSR 0x80000000
39 #define MAL_CR_PLBP_1 0x00400000 /* lowsest is 00 */
40 #define MAL_CR_PLBP_2 0x00800000
41 #define MAL_CR_PLBP_3 0x00C00000 /* highest */
42 #define MAL_CR_GA 0x00200000
43 #define MAL_CR_OA 0x00100000
44 #define MAL_CR_PLBLE 0x00080000
45 #define MAL_CR_PLBLT_1 0x00040000
46 #define MAL_CR_PLBLT_2 0x00020000
47 #define MAL_CR_PLBLT_3 0x00010000
48 #define MAL_CR_PLBLT_4 0x00008000
49 #define MAL_CR_PLBLT_DEFAULT 0x00078000 /* ????? */
50 #define MAL_CR_PLBB 0x00004000
51 #define MAL_CR_OPBBL 0x00000080
52 #define MAL_CR_EOPIE 0x00000004
53 #define MAL_CR_LEA 0x00000002
54 #define MAL_CR_MSD 0x00000001
56 /* MAL DCR's */
57 #define MAL0_CFG 0x0180
58 #define MAL0_ESR 0x0181
59 #define MAL0_IER 0x0182
60 #define MAL0_TXCASR 0x0184
61 #define MAL0_TXCARR 0x0185
62 #define MAL0_TXEOBISR 0x0186
63 #define MAL0_TXDEIR 0x0187
64 #define MAL0_RXCASR 0x0190
65 #define MAL0_RXCARR 0x0191
66 #define MAL0_RXEOBISR 0x0192
67 #define MAL0_RXDEIR 0x0193
68 #define MAL0_TXCTP0R 0x01A0
69 #define MAL0_TXCTP1R 0x01A1
70 #define MAL0_TXCTP2R 0x01A2
71 #define MAL0_TXCTP3R 0x01A3
72 #define MAL0_RXCTP0R 0x01C0
73 #define MAL0_RXCTP1R 0x01C1
74 #define MAL0_RCBS0 0x01E0
75 #define MAL0_RCBS1 0x01E1
77 /* Configuration Reg */
78 #define MAL_CR_MMSR 0x80000000
79 #define MAL_CR_PLBP_1 0x00400000 /* lowsest is 00 */
80 #define MAL_CR_PLBP_2 0x00800000
81 #define MAL_CR_PLBP_3 0x00C00000 /* highest */
82 #define MAL_CR_GA 0x00200000
83 #define MAL_CR_OA 0x00100000
84 #define MAL_CR_PLBLE 0x00080000
85 #define MAL_CR_PLBLT_1 0x00040000
86 #define MAL_CR_PLBLT_2 0x00020000
87 #define MAL_CR_PLBLT_3 0x00010000
88 #define MAL_CR_PLBLT_4 0x00008000
89 #define MAL_CR_PLBLT_DEFAULT 0x00078000 /* ????? */
90 #define MAL_CR_PLBB 0x00004000
91 #define MAL_CR_OPBBL 0x00000080
92 #define MAL_CR_EOPIE 0x00000004
93 #define MAL_CR_LEA 0x00000002
94 #define MAL_CR_MSD 0x00000001
96 /* Error Status Reg */
97 #define MAL_ESR_EVB 0x80000000
98 #define MAL_ESR_CID 0x40000000
99 #define MAL_ESR_DE 0x00100000
100 #define MAL_ESR_ONE 0x00080000
101 #define MAL_ESR_OTE 0x00040000
102 #define MAL_ESR_OSE 0x00020000
103 #define MAL_ESR_PEIN 0x00010000
104 /* same bit position as the IER */
105 /* VV VV */
106 #define MAL_ESR_DEI 0x00000010
107 #define MAL_ESR_ONEI 0x00000008
108 #define MAL_ESR_OTEI 0x00000004
109 #define MAL_ESR_OSEI 0x00000002
110 #define MAL_ESR_PBEI 0x00000001
111 /* ^^ ^^ */
112 /* Mal IER */
113 #define MAL_IER_DE 0x00000010
114 #define MAL_IER_NE 0x00000008
115 #define MAL_IER_TE 0x00000004
116 #define MAL_IER_OPBE 0x00000002
117 #define MAL_IER_PLBE 0x00000001
119 #define MAL_TXRX_CASR (0x80000000)
121 #define MAL_TXRX_CASR_V(__x) (__x)
123 #endif /*MAL_H_*/