RTEMS 6.1-rc2
Loading...
Searching...
No Matches
bestcomm_ops.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (C) 2010, 2013 embedded brains GmbH & Co. KG
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef BESTCOMM_OPS_H
29#define BESTCOMM_OPS_H
30
31#include <bsp/utility.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
47#define VAR(i) (i)
48#define VAR_COUNT 24
49#define INC(i) (24 + (i))
50#define INC_COUNT 8
51#define IDX(i) (48 + (i))
52#define IDX_COUNT 8
53
54#define COND_ONCE 0
55#define COND_LT 1
56#define COND_GT 2
57#define COND_NE 3
58#define COND_EQ 4
59#define COND_LE 5
60#define COND_GE 6
61#define COND_FOREVER 7
62
63#define INC_INIT(cond, val) \
64 (BSP_FLD32(cond, 29, 31) \
65 | BSP_FLD32((int16_t) (val), 0, 15))
66
67#define TERM_FIRST 0
68#define TERM_SECOND 1
69#define TERM_INIT 2
70#define TERM_UNUSED 3
71
72#define DEREF 1
73
74#define LCD_TERM(val) BSP_FLD32(val, 13, 14)
75
76#define LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \
77 (BSP_BIT32(31) \
78 | BSP_FLD32(deref0, 29, 29) \
79 | BSP_FLD32(iniidx0, 23, 28) \
80 | BSP_FLD32(deref1, 21, 21) \
81 | BSP_FLD32(iniidx1, 15, 20) \
82 | LCD_TERM(term) \
83 | BSP_FLD32(termop, 6, 11) \
84 | BSP_FLD32(inc0, 3, 5) \
85 | BSP_FLD32(inc1, 0, 2))
86
87#define LCDEXT(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \
88 (BSP_BIT32(30) \
89 | LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1))
90
91#define LCDPLUS(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \
92 (BSP_BIT32(22) \
93 | LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1))
94
95#define LCDINIT(val) \
96 (BSP_BIT32(31) \
97 | BSP_FLD32((val) >> 13, 15, 29) \
98 | LCD_TERM(TERM_INIT) \
99 | BSP_FLD32(val, 0, 12))
100
101#define MORE 0x4
102
103#define TFD 0x2
104
105#define INT 0x1
106
107#define DRD_FLAGS(val) BSP_FLD32(val, 26, 28)
108
109#define INIT_ALWAYS 0
110#define INIT_SCTMR_0 1
111#define INIT_SCTMR_1 2
112#define INIT_FEC_RX 3
113#define INIT_FEC_TX 4
114#define INIT_ATA_RX 5
115#define INIT_ATA_TX 6
116#define INIT_SCPCI_RX 7
117#define INIT_SCPCI_TX 8
118#define INIT_PSC3_RX 9
119#define INIT_PSC3_TX 10
120#define INIT_PSC2_RX 11
121#define INIT_PSC2_TX 12
122#define INIT_PSC1_RX 13
123#define INIT_PSC1_TX 14
124#define INIT_SCTMR_2 15
125#define INIT_SCLPC 16
126#define INIT_PSC5_RX 17
127#define INIT_PSC5_TX 18
128#define INIT_PSC4_RX 19
129#define INIT_PSC4_TX 20
130#define INIT_I2C2_RX 21
131#define INIT_I2C2_TX 22
132#define INIT_I2C1_RX 23
133#define INIT_I2C1_TX 24
134#define INIT_PSC6_RX 25
135#define INIT_PSC6_TX 26
136#define INIT_IRDA_RX 25
137#define INIT_IRDA_TX 26
138#define INIT_SCTMR_3 27
139#define INIT_SCTMR_4 28
140#define INIT_SCTMR_5 29
141#define INIT_SCTMR_6 30
142#define INIT_SCTMR_7 31
143
144#define DRD_INIT(val) BSP_FLD32(val, 21, 25)
145
146#define SZ_8 1
147#define SZ_16 2
148#define SZ_32 0
149#define SZ_DYN 3
150
151#define DRD_RS(val) BSP_FLD32(val, 19, 20)
152
153#define DRD_WS(val) BSP_FLD32(val, 17, 18)
154
155#define DEST_VAR(val) (val)
156#define DEST_IDX(val) (BSP_BIT32(5) | (val))
157#define DEST_DEREF_IDX(val) (BSP_BIT32(5) | BSP_BIT32(4) | (val))
158
159#define SRC_VAR(val) (val)
160#define SRC_INC(val) (BSP_BIT32(5) | (val))
161#define SRC_EU_RESULT (BSP_BIT32(5) | BSP_BIT32(4) | BSP_BIT32(1) | BSP_BIT32(0))
162#define SRC_DEREF_EU_RESULT (BSP_BIT32(6) | BSP_BIT32(4) | BSP_BIT32(1) | BSP_BIT32(0))
163#define SRC_IDX(val) (BSP_BIT32(6) | BSP_BIT32(5) | (val))
164#define SRC_DEREF_IDX(val) (BSP_BIT32(6) | BSP_BIT32(5) | BSP_BIT32(4) | (val))
165#define SRC_NONE (BSP_BIT32(5) | BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(2) | BSP_BIT32(1) | BSP_BIT32(0))
166
167#define DRD1A(flags, init, dest, ws, src, rs) \
168 (DRD_FLAGS(flags) \
169 | DRD_INIT(init) \
170 | DRD_RS(rs) \
171 | DRD_WS(ws) \
172 | BSP_FLD32(dest, 10, 15) \
173 | BSP_FLD32(src, 3, 9))
174
175#define DRD1AEURESULT(flags, init, dest, ws, rs) \
176 (DRD1A(flags, init, rs, ws, dest, SRC_EU_RESULT) \
177 | BSP_FLD32(1, 0, 3))
178
179#define FUNC_LOAD_ACC 0
180#define FUNC_UNLOAD_ACC 1
181#define FUNC_AND 2
182#define FUNC_OR 3
183#define FUNC_XOR 4
184#define FUNC_ANDN 5
185#define FUNC_NOT 6
186#define FUNC_ADD 7
187#define FUNC_SUB 8
188#define FUNC_LSH 9
189#define FUNC_RSH 10
190#define FUNC_CRC8 11
191#define FUNC_CRC16 12
192#define FUNC_CRC32 13
193#define FUNC_ENDIAN32 14
194#define FUNC_ENDIAN16 15
195
196#define DRD2A(flags, func) \
197 (BSP_BIT32(30) | BSP_BIT32(29) \
198 | DRD_FLAGS(flags) \
199 | BSP_FLD32(func, 0, 3))
200
201#define DRD2A5(flags, init, func, ws, rs) \
202 (DRD2A(flags, func) \
203 | DRD_RS(rs) \
204 | DRD_WS(ws) \
205 | DRD_INIT(init))
206
207#define OP_VAR(val) (val)
208#define OP_EU_RESULT (BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(1) | BSP_BIT32(0))
209#define OP_NONE (BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(2) | BSP_BIT32(1) | BSP_BIT32(0))
210#define OP_IDX(val) (BSP_BIT32(5) | (val))
211#define OP_DEREF_IDX(val) (BSP_BIT32(5) | BSP_BIT32(4) | (val))
212
213#define DRD2B1(dest, op0, op1) \
214 (BSP_FLD32(dest, 22, 27) \
215 | BSP_FLD32(SRC_EU_RESULT, 14, 20) \
216 | BSP_FLD32(3, 12, 13) \
217 | BSP_FLD32(op0, 6, 11) \
218 | BSP_FLD32(op1, 0, 5))
219
220#define DRD2B2(op0, op1) \
221 (BSP_BIT32(29) \
222 | BSP_FLD32(3, 26, 27) \
223 | BSP_FLD32(op0, 20, 25) \
224 | BSP_FLD32(op1, 14, 19) \
225 | BSP_FLD32(0, 12, 13) \
226 | BSP_FLD32(OP_NONE, 6, 11) \
227 | BSP_FLD32(OP_NONE, 0, 5))
228
229#define NOP 0x1f8
230
233#ifdef __cplusplus
234}
235#endif /* __cplusplus */
236
237#endif /* BESTCOMM_OPS_H */
This header file provides utility macros for BSPs.