1 | /* |
---|
2 | * Copyright (c) 2010-2013 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef BESTCOMM_OPS_H |
---|
10 | #define BESTCOMM_OPS_H |
---|
11 | |
---|
12 | #include <bsp/utility.h> |
---|
13 | |
---|
14 | #ifdef __cplusplus |
---|
15 | extern "C" { |
---|
16 | #endif /* __cplusplus */ |
---|
17 | |
---|
18 | /** |
---|
19 | * @defgroup BestCommOps BestComm Ops |
---|
20 | * |
---|
21 | * @ingroup BestComm |
---|
22 | * |
---|
23 | * @brief BestComm ops. |
---|
24 | * |
---|
25 | * @{ |
---|
26 | */ |
---|
27 | |
---|
28 | #define VAR(i) (i) |
---|
29 | #define VAR_COUNT 24 |
---|
30 | #define INC(i) (24 + (i)) |
---|
31 | #define INC_COUNT 8 |
---|
32 | #define IDX(i) (48 + (i)) |
---|
33 | #define IDX_COUNT 8 |
---|
34 | |
---|
35 | #define COND_ONCE 0 |
---|
36 | #define COND_LT 1 |
---|
37 | #define COND_GT 2 |
---|
38 | #define COND_NE 3 |
---|
39 | #define COND_EQ 4 |
---|
40 | #define COND_LE 5 |
---|
41 | #define COND_GE 6 |
---|
42 | #define COND_FOREVER 7 |
---|
43 | |
---|
44 | #define INC_INIT(cond, val) \ |
---|
45 | (BSP_FLD32(cond, 29, 31) \ |
---|
46 | | BSP_FLD32((int16_t) (val), 0, 15)) |
---|
47 | |
---|
48 | #define TERM_FIRST 0 |
---|
49 | #define TERM_SECOND 1 |
---|
50 | #define TERM_INIT 2 |
---|
51 | #define TERM_UNUSED 3 |
---|
52 | |
---|
53 | #define DEREF 1 |
---|
54 | |
---|
55 | #define LCD_TERM(val) BSP_FLD32(val, 13, 14) |
---|
56 | |
---|
57 | #define LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \ |
---|
58 | (BSP_BIT32(31) \ |
---|
59 | | BSP_FLD32(deref0, 29, 29) \ |
---|
60 | | BSP_FLD32(iniidx0, 23, 28) \ |
---|
61 | | BSP_FLD32(deref1, 21, 21) \ |
---|
62 | | BSP_FLD32(iniidx1, 15, 20) \ |
---|
63 | | LCD_TERM(term) \ |
---|
64 | | BSP_FLD32(termop, 6, 11) \ |
---|
65 | | BSP_FLD32(inc0, 3, 5) \ |
---|
66 | | BSP_FLD32(inc1, 0, 2)) |
---|
67 | |
---|
68 | #define LCDEXT(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \ |
---|
69 | (BSP_BIT32(30) \ |
---|
70 | | LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1)) |
---|
71 | |
---|
72 | #define LCDPLUS(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \ |
---|
73 | (BSP_BIT32(22) \ |
---|
74 | | LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1)) |
---|
75 | |
---|
76 | #define LCDINIT(val) \ |
---|
77 | (BSP_BIT32(31) \ |
---|
78 | | BSP_FLD32((val) >> 13, 15, 29) \ |
---|
79 | | LCD_TERM(TERM_INIT) \ |
---|
80 | | BSP_FLD32(val, 0, 12)) |
---|
81 | |
---|
82 | #define MORE 0x4 |
---|
83 | |
---|
84 | #define TFD 0x2 |
---|
85 | |
---|
86 | #define INT 0x1 |
---|
87 | |
---|
88 | #define DRD_FLAGS(val) BSP_FLD32(val, 26, 28) |
---|
89 | |
---|
90 | #define INIT_ALWAYS 0 |
---|
91 | #define INIT_SCTMR_0 1 |
---|
92 | #define INIT_SCTMR_1 2 |
---|
93 | #define INIT_FEC_RX 3 |
---|
94 | #define INIT_FEC_TX 4 |
---|
95 | #define INIT_ATA_RX 5 |
---|
96 | #define INIT_ATA_TX 6 |
---|
97 | #define INIT_SCPCI_RX 7 |
---|
98 | #define INIT_SCPCI_TX 8 |
---|
99 | #define INIT_PSC3_RX 9 |
---|
100 | #define INIT_PSC3_TX 10 |
---|
101 | #define INIT_PSC2_RX 11 |
---|
102 | #define INIT_PSC2_TX 12 |
---|
103 | #define INIT_PSC1_RX 13 |
---|
104 | #define INIT_PSC1_TX 14 |
---|
105 | #define INIT_SCTMR_2 15 |
---|
106 | #define INIT_SCLPC 16 |
---|
107 | #define INIT_PSC5_RX 17 |
---|
108 | #define INIT_PSC5_TX 18 |
---|
109 | #define INIT_PSC4_RX 19 |
---|
110 | #define INIT_PSC4_TX 20 |
---|
111 | #define INIT_I2C2_RX 21 |
---|
112 | #define INIT_I2C2_TX 22 |
---|
113 | #define INIT_I2C1_RX 23 |
---|
114 | #define INIT_I2C1_TX 24 |
---|
115 | #define INIT_PSC6_RX 25 |
---|
116 | #define INIT_PSC6_TX 26 |
---|
117 | #define INIT_IRDA_RX 25 |
---|
118 | #define INIT_IRDA_TX 26 |
---|
119 | #define INIT_SCTMR_3 27 |
---|
120 | #define INIT_SCTMR_4 28 |
---|
121 | #define INIT_SCTMR_5 29 |
---|
122 | #define INIT_SCTMR_6 30 |
---|
123 | #define INIT_SCTMR_7 31 |
---|
124 | |
---|
125 | #define DRD_INIT(val) BSP_FLD32(val, 21, 25) |
---|
126 | |
---|
127 | #define SZ_8 1 |
---|
128 | #define SZ_16 2 |
---|
129 | #define SZ_32 0 |
---|
130 | #define SZ_DYN 3 |
---|
131 | |
---|
132 | #define DRD_RS(val) BSP_FLD32(val, 19, 20) |
---|
133 | |
---|
134 | #define DRD_WS(val) BSP_FLD32(val, 17, 18) |
---|
135 | |
---|
136 | #define DEST_VAR(val) (val) |
---|
137 | #define DEST_IDX(val) (BSP_BIT32(5) | (val)) |
---|
138 | #define DEST_DEREF_IDX(val) (BSP_BIT32(5) | BSP_BIT32(4) | (val)) |
---|
139 | |
---|
140 | #define SRC_VAR(val) (val) |
---|
141 | #define SRC_INC(val) (BSP_BIT32(5) | (val)) |
---|
142 | #define SRC_EU_RESULT (BSP_BIT32(5) | BSP_BIT32(4) | BSP_BIT32(1) | BSP_BIT32(0)) |
---|
143 | #define SRC_DEREF_EU_RESULT (BSP_BIT32(6) | BSP_BIT32(4) | BSP_BIT32(1) | BSP_BIT32(0)) |
---|
144 | #define SRC_IDX(val) (BSP_BIT32(6) | BSP_BIT32(5) | (val)) |
---|
145 | #define SRC_DEREF_IDX(val) (BSP_BIT32(6) | BSP_BIT32(5) | BSP_BIT32(4) | (val)) |
---|
146 | #define SRC_NONE (BSP_BIT32(5) | BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(2) | BSP_BIT32(1) | BSP_BIT32(0)) |
---|
147 | |
---|
148 | #define DRD1A(flags, init, dest, ws, src, rs) \ |
---|
149 | (DRD_FLAGS(flags) \ |
---|
150 | | DRD_INIT(init) \ |
---|
151 | | DRD_RS(rs) \ |
---|
152 | | DRD_WS(ws) \ |
---|
153 | | BSP_FLD32(dest, 10, 15) \ |
---|
154 | | BSP_FLD32(src, 3, 9)) |
---|
155 | |
---|
156 | #define DRD1AEURESULT(flags, init, dest, ws, rs) \ |
---|
157 | (DRD1A(flags, init, rs, ws, dest, SRC_EU_RESULT) \ |
---|
158 | | BSP_FLD32(1, 0, 3)) |
---|
159 | |
---|
160 | #define FUNC_LOAD_ACC 0 |
---|
161 | #define FUNC_UNLOAD_ACC 1 |
---|
162 | #define FUNC_AND 2 |
---|
163 | #define FUNC_OR 3 |
---|
164 | #define FUNC_XOR 4 |
---|
165 | #define FUNC_ANDN 5 |
---|
166 | #define FUNC_NOT 6 |
---|
167 | #define FUNC_ADD 7 |
---|
168 | #define FUNC_SUB 8 |
---|
169 | #define FUNC_LSH 9 |
---|
170 | #define FUNC_RSH 10 |
---|
171 | #define FUNC_CRC8 11 |
---|
172 | #define FUNC_CRC16 12 |
---|
173 | #define FUNC_CRC32 13 |
---|
174 | #define FUNC_ENDIAN32 14 |
---|
175 | #define FUNC_ENDIAN16 15 |
---|
176 | |
---|
177 | #define DRD2A(flags, func) \ |
---|
178 | (BSP_BIT32(30) | BSP_BIT32(29) \ |
---|
179 | | DRD_FLAGS(flags) \ |
---|
180 | | BSP_FLD32(func, 0, 3)) |
---|
181 | |
---|
182 | #define DRD2A5(flags, init, func, ws, rs) \ |
---|
183 | (DRD2A(flags, func) \ |
---|
184 | | DRD_RS(rs) \ |
---|
185 | | DRD_WS(ws) \ |
---|
186 | | DRD_INIT(init)) |
---|
187 | |
---|
188 | #define OP_VAR(val) (val) |
---|
189 | #define OP_EU_RESULT (BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(1) | BSP_BIT32(0)) |
---|
190 | #define OP_NONE (BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(2) | BSP_BIT32(1) | BSP_BIT32(0)) |
---|
191 | #define OP_IDX(val) (BSP_BIT32(5) | (val)) |
---|
192 | #define OP_DEREF_IDX(val) (BSP_BIT32(5) | BSP_BIT32(4) | (val)) |
---|
193 | |
---|
194 | #define DRD2B1(dest, op0, op1) \ |
---|
195 | (BSP_FLD32(dest, 22, 27) \ |
---|
196 | | BSP_FLD32(SRC_EU_RESULT, 14, 20) \ |
---|
197 | | BSP_FLD32(3, 12, 13) \ |
---|
198 | | BSP_FLD32(op0, 6, 11) \ |
---|
199 | | BSP_FLD32(op1, 0, 5)) |
---|
200 | |
---|
201 | #define DRD2B2(op0, op1) \ |
---|
202 | (BSP_BIT32(29) \ |
---|
203 | | BSP_FLD32(3, 26, 27) \ |
---|
204 | | BSP_FLD32(op0, 20, 25) \ |
---|
205 | | BSP_FLD32(op1, 14, 19) \ |
---|
206 | | BSP_FLD32(0, 12, 13) \ |
---|
207 | | BSP_FLD32(OP_NONE, 6, 11) \ |
---|
208 | | BSP_FLD32(OP_NONE, 0, 5)) |
---|
209 | |
---|
210 | #define NOP 0x1f8 |
---|
211 | |
---|
212 | /** @} */ |
---|
213 | |
---|
214 | #ifdef __cplusplus |
---|
215 | } |
---|
216 | #endif /* __cplusplus */ |
---|
217 | |
---|
218 | #endif /* BESTCOMM_OPS_H */ |
---|