2 * @file IxNpeDlMacros_p.h
4 * @author Intel Corporation
5 * @date 21 January 2002
7 * @brief This file contains the macros for the IxNpeDl component.
11 * IXP400 SW Release version 2.0
13 * -- Copyright Notice --
16 * Copyright 2001-2005, Intel Corporation.
17 * All rights reserved.
20 * SPDX-License-Identifier: BSD-3-Clause
22 * -- End of Copyright Notice --
26 * @defgroup IxNpeDlMacros_p IxNpeDlMacros_p
28 * @brief Macros for the IxNpeDl component.
33 #ifndef IXNPEDLMACROS_P_H
34 #define IXNPEDLMACROS_P_H
38 * Put the user defined include files required.
41 /* To support IxNpeDl unit tests... */
43 #include "test/IxNpeDlTestReg.h"
56 * @typedef IxNpeDlTraceTypes
57 * @brief Enumeration defining IxNpeDl trace levels
61 IX_NPEDL_TRACE_OFF, /**< no trace */
62 IX_NPEDL_DEBUG, /**< debug */
63 IX_NPEDL_FN_ENTRY_EXIT /**< function entry/exit */
68 * #defines and macros.
71 /* Implementation of the following macros for use with IxNpeDl unit test code */
76 * @def IX_NPEDL_TRACE_LEVEL
78 * @brief IxNpeDl debug trace level
80 #define IX_NPEDL_TRACE_LEVEL IX_NPEDL_FN_ENTRY_EXIT
83 * @def IX_NPEDL_ERROR_REPORT
85 * @brief Mechanism for reporting IxNpeDl software errors
87 * @param char* [in] STR - Error string to report
89 * This macro simply prints the error string passed.
90 * Intended for use with IxNpeDl unit test code.
94 #define IX_NPEDL_ERROR_REPORT(STR) printf ("IxNpeDl ERROR: %s\n", (STR));
97 * @def IX_NPEDL_WARNING_REPORT
99 * @brief Mechanism for reporting IxNpeDl software errors
101 * @param char* [in] STR - Error string to report
103 * This macro simply prints the error string passed.
104 * Intended for use with IxNpeDl unit test code.
108 #define IX_NPEDL_WARNING_REPORT(STR) printf ("IxNpeDl WARNING: %s\n", (STR));
111 * @def IX_NPEDL_TRACE0
113 * @brief Mechanism for tracing debug for the IxNpeDl component, for no arguments
115 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
116 * @param char* [in] STR - Trace string
118 * This macro simply prints the trace string passed, if the level is supported.
119 * Intended for use with IxNpeDl unit test code.
123 #define IX_NPEDL_TRACE0(LEVEL, STR) \
125 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
127 printf ("IxNpeDl TRACE: "); \
134 * @def IX_NPEDL_TRACE1
136 * @brief Mechanism for tracing debug for the IxNpeDl component, with 1 argument
138 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
139 * @param char* [in] STR - Trace string
140 * @param argType [in] ARG1 - Argument to trace
142 * This macro simply prints the trace string passed, if the level is supported.
143 * Intended for use with IxNpeDl unit test code.
147 #define IX_NPEDL_TRACE1(LEVEL, STR, ARG1) \
149 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
151 printf ("IxNpeDl TRACE: "); \
152 printf (STR, ARG1); \
158 * @def IX_NPEDL_TRACE2
160 * @brief Mechanism for tracing debug for the IxNpeDl component, with 2 arguments
162 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
163 * @param char* [in] STR - Trace string
164 * @param argType [in] ARG1 - Argument to trace
165 * @param argType [in] ARG2 - Argument to trace
167 * This macro simply prints the trace string passed, if the level is supported.
168 * Intended for use with IxNpeDl unit test code.
172 #define IX_NPEDL_TRACE2(LEVEL, STR, ARG1, ARG2) \
174 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
176 printf ("IxNpeDl TRACE: "); \
177 printf (STR, ARG1, ARG2); \
184 * @def IX_NPEDL_REG_WRITE
186 * @brief Mechanism for writing to a memory-mapped register
188 * @param UINT32 [in] base - Base memory address for this NPE's registers
189 * @param UINT32 [in] offset - Offset from base memory address
190 * @param UINT32 [in] value - Value to write to register
192 * This macro calls a function from Unit Test code to write a register. This
193 * allows extra flexibility for unit testing of the IxNpeDl component.
197 #define IX_NPEDL_REG_WRITE(base, offset, value) \
199 ixNpeDlTestRegWrite (base, offset, value); \
204 * @def IX_NPEDL_REG_READ
206 * @brief Mechanism for reading from a memory-mapped register
208 * @param UINT32 [in] base - Base memory address for this NPE's registers
209 * @param UINT32 [in] offset - Offset from base memory address
210 * @param UINT32 *[out] value - Value read from register
212 * This macro calls a function from Unit Test code to read a register. This
213 * allows extra flexibility for unit testing of the IxNpeDl component.
217 #define IX_NPEDL_REG_READ(base, offset, value) \
219 ixNpeDlTestRegRead (base, offset, value); \
223 /* Implementation of the following macros when integrated with IxOsal */
224 #else /* #if (CPU != XSCALE) */
228 * @def IX_NPEDL_TRACE_LEVEL
230 * @brief IxNpeDl debug trace level
232 #define IX_NPEDL_TRACE_LEVEL IX_NPEDL_DEBUG
236 * @def IX_NPEDL_ERROR_REPORT
238 * @brief Mechanism for reporting IxNpeDl software errors
240 * @param char* [in] STR - Error string to report
242 * This macro is used to report IxNpeDl software errors.
246 #define IX_NPEDL_ERROR_REPORT(STR) \
247 ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, STR, 0, 0, 0, 0, 0, 0);
250 * @def IX_NPEDL_WARNING_REPORT
252 * @brief Mechanism for reporting IxNpeDl software warnings
254 * @param char* [in] STR - Warning string to report
256 * This macro is used to report IxNpeDl software warnings.
260 #define IX_NPEDL_WARNING_REPORT(STR) \
261 ixOsalLog (IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0);
265 * @def IX_NPEDL_TRACE0
267 * @brief Mechanism for tracing debug for the IxNpeDl component, for no arguments
269 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
270 * @param char* [in] STR - Trace string
272 * This macro simply prints the trace string passed, if the level is supported.
276 #define IX_NPEDL_TRACE0(LEVEL, STR) \
278 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
280 if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
282 ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0); \
284 else if (LEVEL == IX_NPEDL_DEBUG) \
286 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0); \
292 * @def IX_NPEDL_TRACE1
294 * @brief Mechanism for tracing debug for the IxNpeDl component, with 1 argument
296 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
297 * @param char* [in] STR - Trace string
298 * @param argType [in] ARG1 - Argument to trace
300 * This macro simply prints the trace string passed, if the level is supported.
304 #define IX_NPEDL_TRACE1(LEVEL, STR, ARG1) \
306 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
308 if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
310 ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, 0, 0, 0, 0, 0); \
312 else if (LEVEL == IX_NPEDL_DEBUG) \
314 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, 0, 0, 0, 0, 0); \
320 * @def IX_NPEDL_TRACE2
322 * @brief Mechanism for tracing debug for the IxNpeDl component, with 2 arguments
324 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
325 * @param char* [in] STR - Trace string
326 * @param argType [in] ARG1 - Argument to trace
327 * @param argType [in] ARG2 - Argument to trace
329 * This macro simply prints the trace string passed, if the level is supported.
333 #define IX_NPEDL_TRACE2(LEVEL, STR, ARG1, ARG2) \
335 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
337 if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
339 ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, ARG2, 0, 0, 0, 0); \
341 else if (LEVEL == IX_NPEDL_DEBUG) \
343 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, ARG2, 0, 0, 0, 0); \
349 * @def IX_NPEDL_REG_WRITE
351 * @brief Mechanism for writing to a memory-mapped register
353 * @param UINT32 [in] base - Base memory address for this NPE's registers
354 * @param UINT32 [in] offset - Offset from base memory address
355 * @param UINT32 [in] value - Value to write to register
357 * This macro forms the address of the register from base address + offset, and
358 * dereferences that address to write the contents of the register.
362 #define IX_NPEDL_REG_WRITE(base, offset, value) \
363 IX_OSAL_WRITE_LONG(((base) + (offset)), (value))
368 * @def IX_NPEDL_REG_READ
370 * @brief Mechanism for reading from a memory-mapped register
372 * @param UINT32 [in] base - Base memory address for this NPE's registers
373 * @param UINT32 [in] offset - Offset from base memory address
374 * @param UINT32 *[out] value - Value read from register
376 * This macro forms the address of the register from base address + offset, and
377 * dereferences that address to read the register contents.
381 #define IX_NPEDL_REG_READ(base, offset, value) \
382 *(value) = IX_OSAL_READ_LONG(((base) + (offset)))
384 #endif /* #if (CPU != XSCALE) */
386 #endif /* IXNPEDLMACROS_P_H */
389 * @} defgroup IxNpeDlMacros_p