Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:52

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * Copyright (C) 2010, 2013 embedded brains GmbH & Co. KG
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  *
0015  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0016  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0018  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0019  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0020  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0021  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0024  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0025  * POSSIBILITY OF SUCH DAMAGE.
0026  */
0027 
0028 #ifndef BESTCOMM_OPS_H
0029 #define BESTCOMM_OPS_H
0030 
0031 #include <bsp/utility.h>
0032 
0033 #ifdef __cplusplus
0034 extern "C" {
0035 #endif /* __cplusplus */
0036 
0037 /**
0038  * @defgroup BestCommOps BestComm Ops
0039  *
0040  * @ingroup BestComm
0041  *
0042  * @brief BestComm ops.
0043  *
0044  * @{
0045  */
0046 
0047 #define VAR(i) (i)
0048 #define VAR_COUNT 24
0049 #define INC(i) (24 + (i))
0050 #define INC_COUNT 8
0051 #define IDX(i) (48 + (i))
0052 #define IDX_COUNT 8
0053 
0054 #define COND_ONCE 0
0055 #define COND_LT 1
0056 #define COND_GT 2
0057 #define COND_NE 3
0058 #define COND_EQ 4
0059 #define COND_LE 5
0060 #define COND_GE 6
0061 #define COND_FOREVER 7
0062 
0063 #define INC_INIT(cond, val) \
0064   (BSP_FLD32(cond, 29, 31) \
0065     | BSP_FLD32((int16_t) (val), 0, 15))
0066 
0067 #define TERM_FIRST 0
0068 #define TERM_SECOND 1
0069 #define TERM_INIT 2
0070 #define TERM_UNUSED 3
0071 
0072 #define DEREF 1
0073 
0074 #define LCD_TERM(val) BSP_FLD32(val, 13, 14)
0075 
0076 #define LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \
0077   (BSP_BIT32(31) \
0078     | BSP_FLD32(deref0, 29, 29) \
0079     | BSP_FLD32(iniidx0, 23, 28) \
0080     | BSP_FLD32(deref1, 21, 21) \
0081     | BSP_FLD32(iniidx1, 15, 20) \
0082     | LCD_TERM(term) \
0083     | BSP_FLD32(termop, 6, 11) \
0084     | BSP_FLD32(inc0, 3, 5) \
0085     | BSP_FLD32(inc1, 0, 2))
0086 
0087 #define LCDEXT(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \
0088   (BSP_BIT32(30) \
0089     | LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1))
0090 
0091 #define LCDPLUS(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1) \
0092   (BSP_BIT32(22) \
0093     | LCD(deref0, iniidx0, deref1, iniidx1, term, termop, inc0, inc1))
0094 
0095 #define LCDINIT(val) \
0096   (BSP_BIT32(31) \
0097     | BSP_FLD32((val) >> 13, 15, 29) \
0098     | LCD_TERM(TERM_INIT) \
0099     | BSP_FLD32(val, 0, 12))
0100 
0101 #define MORE 0x4
0102 
0103 #define TFD 0x2
0104 
0105 #define INT 0x1
0106 
0107 #define DRD_FLAGS(val) BSP_FLD32(val, 26, 28)
0108 
0109 #define INIT_ALWAYS 0
0110 #define INIT_SCTMR_0 1
0111 #define INIT_SCTMR_1 2
0112 #define INIT_FEC_RX 3
0113 #define INIT_FEC_TX 4
0114 #define INIT_ATA_RX 5
0115 #define INIT_ATA_TX 6
0116 #define INIT_SCPCI_RX 7
0117 #define INIT_SCPCI_TX 8
0118 #define INIT_PSC3_RX 9
0119 #define INIT_PSC3_TX 10
0120 #define INIT_PSC2_RX 11
0121 #define INIT_PSC2_TX 12
0122 #define INIT_PSC1_RX 13
0123 #define INIT_PSC1_TX 14
0124 #define INIT_SCTMR_2 15
0125 #define INIT_SCLPC 16
0126 #define INIT_PSC5_RX 17
0127 #define INIT_PSC5_TX 18
0128 #define INIT_PSC4_RX 19
0129 #define INIT_PSC4_TX 20
0130 #define INIT_I2C2_RX 21
0131 #define INIT_I2C2_TX 22
0132 #define INIT_I2C1_RX 23
0133 #define INIT_I2C1_TX 24
0134 #define INIT_PSC6_RX 25
0135 #define INIT_PSC6_TX 26
0136 #define INIT_IRDA_RX 25
0137 #define INIT_IRDA_TX 26
0138 #define INIT_SCTMR_3 27
0139 #define INIT_SCTMR_4 28
0140 #define INIT_SCTMR_5 29
0141 #define INIT_SCTMR_6 30
0142 #define INIT_SCTMR_7 31
0143 
0144 #define DRD_INIT(val) BSP_FLD32(val, 21, 25)
0145 
0146 #define SZ_8 1
0147 #define SZ_16 2
0148 #define SZ_32 0
0149 #define SZ_DYN 3
0150 
0151 #define DRD_RS(val) BSP_FLD32(val, 19, 20)
0152 
0153 #define DRD_WS(val) BSP_FLD32(val, 17, 18)
0154 
0155 #define DEST_VAR(val) (val)
0156 #define DEST_IDX(val) (BSP_BIT32(5) | (val))
0157 #define DEST_DEREF_IDX(val) (BSP_BIT32(5) | BSP_BIT32(4) | (val))
0158 
0159 #define SRC_VAR(val) (val)
0160 #define SRC_INC(val) (BSP_BIT32(5) | (val))
0161 #define SRC_EU_RESULT (BSP_BIT32(5) | BSP_BIT32(4) | BSP_BIT32(1) | BSP_BIT32(0))
0162 #define SRC_DEREF_EU_RESULT (BSP_BIT32(6) | BSP_BIT32(4) | BSP_BIT32(1) | BSP_BIT32(0))
0163 #define SRC_IDX(val) (BSP_BIT32(6) | BSP_BIT32(5) | (val))
0164 #define SRC_DEREF_IDX(val) (BSP_BIT32(6) | BSP_BIT32(5) | BSP_BIT32(4) | (val))
0165 #define SRC_NONE (BSP_BIT32(5) | BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(2) | BSP_BIT32(1) | BSP_BIT32(0))
0166 
0167 #define DRD1A(flags, init, dest, ws, src, rs) \
0168   (DRD_FLAGS(flags) \
0169     | DRD_INIT(init) \
0170     | DRD_RS(rs) \
0171     | DRD_WS(ws) \
0172     | BSP_FLD32(dest, 10, 15) \
0173     | BSP_FLD32(src, 3, 9))
0174 
0175 #define DRD1AEURESULT(flags, init, dest, ws, rs) \
0176   (DRD1A(flags, init, rs, ws, dest, SRC_EU_RESULT) \
0177     | BSP_FLD32(1, 0, 3))
0178 
0179 #define FUNC_LOAD_ACC 0
0180 #define FUNC_UNLOAD_ACC 1
0181 #define FUNC_AND 2
0182 #define FUNC_OR 3
0183 #define FUNC_XOR 4
0184 #define FUNC_ANDN 5
0185 #define FUNC_NOT 6
0186 #define FUNC_ADD 7
0187 #define FUNC_SUB 8
0188 #define FUNC_LSH 9
0189 #define FUNC_RSH 10
0190 #define FUNC_CRC8 11
0191 #define FUNC_CRC16 12
0192 #define FUNC_CRC32 13
0193 #define FUNC_ENDIAN32 14
0194 #define FUNC_ENDIAN16 15
0195 
0196 #define DRD2A(flags, func) \
0197   (BSP_BIT32(30) | BSP_BIT32(29) \
0198     | DRD_FLAGS(flags) \
0199     | BSP_FLD32(func, 0, 3))
0200 
0201 #define DRD2A5(flags, init, func, ws, rs) \
0202   (DRD2A(flags, func) \
0203     | DRD_RS(rs) \
0204     | DRD_WS(ws) \
0205     | DRD_INIT(init))
0206 
0207 #define OP_VAR(val) (val)
0208 #define OP_EU_RESULT (BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(1) | BSP_BIT32(0))
0209 #define OP_NONE (BSP_BIT32(4) | BSP_BIT32(3) | BSP_BIT32(2) | BSP_BIT32(1) | BSP_BIT32(0))
0210 #define OP_IDX(val) (BSP_BIT32(5) | (val))
0211 #define OP_DEREF_IDX(val) (BSP_BIT32(5) | BSP_BIT32(4) | (val))
0212 
0213 #define DRD2B1(dest, op0, op1) \
0214   (BSP_FLD32(dest, 22, 27) \
0215     | BSP_FLD32(SRC_EU_RESULT, 14, 20) \
0216     | BSP_FLD32(3, 12, 13) \
0217     | BSP_FLD32(op0, 6, 11) \
0218     | BSP_FLD32(op1, 0, 5))
0219 
0220 #define DRD2B2(op0, op1) \
0221   (BSP_BIT32(29) \
0222     | BSP_FLD32(3, 26, 27) \
0223     | BSP_FLD32(op0, 20, 25) \
0224     | BSP_FLD32(op1, 14, 19) \
0225     | BSP_FLD32(0, 12, 13) \
0226     | BSP_FLD32(OP_NONE, 6, 11) \
0227     | BSP_FLD32(OP_NONE, 0, 5))
0228 
0229 #define NOP 0x1f8
0230 
0231 /** @} */
0232 
0233 #ifdef __cplusplus
0234 }
0235 #endif /* __cplusplus */
0236 
0237 #endif /* BESTCOMM_OPS_H */