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 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions
23 * 1. Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in the
27 * documentation and/or other materials provided with the distribution.
28 * 3. Neither the name of the Intel Corporation nor the names of its contributors
29 * may be used to endorse or promote products derived from this software
30 * without specific prior written permission.
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
34 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
37 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * -- End of Copyright Notice --
50 * @defgroup IxNpeDlMacros_p IxNpeDlMacros_p
52 * @brief Macros for the IxNpeDl component.
57 #ifndef IXNPEDLMACROS_P_H
58 #define IXNPEDLMACROS_P_H
62 * Put the user defined include files required.
65 /* To support IxNpeDl unit tests... */
67 #include "test/IxNpeDlTestReg.h"
80 * @typedef IxNpeDlTraceTypes
81 * @brief Enumeration defining IxNpeDl trace levels
85 IX_NPEDL_TRACE_OFF, /**< no trace */
86 IX_NPEDL_DEBUG, /**< debug */
87 IX_NPEDL_FN_ENTRY_EXIT /**< function entry/exit */
92 * #defines and macros.
95 /* Implementation of the following macros for use with IxNpeDl unit test code */
100 * @def IX_NPEDL_TRACE_LEVEL
102 * @brief IxNpeDl debug trace level
104 #define IX_NPEDL_TRACE_LEVEL IX_NPEDL_FN_ENTRY_EXIT
107 * @def IX_NPEDL_ERROR_REPORT
109 * @brief Mechanism for reporting IxNpeDl software errors
111 * @param char* [in] STR - Error string to report
113 * This macro simply prints the error string passed.
114 * Intended for use with IxNpeDl unit test code.
118 #define IX_NPEDL_ERROR_REPORT(STR) printf ("IxNpeDl ERROR: %s\n", (STR));
121 * @def IX_NPEDL_WARNING_REPORT
123 * @brief Mechanism for reporting IxNpeDl software errors
125 * @param char* [in] STR - Error string to report
127 * This macro simply prints the error string passed.
128 * Intended for use with IxNpeDl unit test code.
132 #define IX_NPEDL_WARNING_REPORT(STR) printf ("IxNpeDl WARNING: %s\n", (STR));
135 * @def IX_NPEDL_TRACE0
137 * @brief Mechanism for tracing debug for the IxNpeDl component, for no arguments
139 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
140 * @param char* [in] STR - Trace string
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_TRACE0(LEVEL, STR) \
149 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
151 printf ("IxNpeDl TRACE: "); \
158 * @def IX_NPEDL_TRACE1
160 * @brief Mechanism for tracing debug for the IxNpeDl component, with 1 argument
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
166 * This macro simply prints the trace string passed, if the level is supported.
167 * Intended for use with IxNpeDl unit test code.
171 #define IX_NPEDL_TRACE1(LEVEL, STR, ARG1) \
173 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
175 printf ("IxNpeDl TRACE: "); \
176 printf (STR, ARG1); \
182 * @def IX_NPEDL_TRACE2
184 * @brief Mechanism for tracing debug for the IxNpeDl component, with 2 arguments
186 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
187 * @param char* [in] STR - Trace string
188 * @param argType [in] ARG1 - Argument to trace
189 * @param argType [in] ARG2 - Argument to trace
191 * This macro simply prints the trace string passed, if the level is supported.
192 * Intended for use with IxNpeDl unit test code.
196 #define IX_NPEDL_TRACE2(LEVEL, STR, ARG1, ARG2) \
198 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
200 printf ("IxNpeDl TRACE: "); \
201 printf (STR, ARG1, ARG2); \
208 * @def IX_NPEDL_REG_WRITE
210 * @brief Mechanism for writing to a memory-mapped register
212 * @param UINT32 [in] base - Base memory address for this NPE's registers
213 * @param UINT32 [in] offset - Offset from base memory address
214 * @param UINT32 [in] value - Value to write to register
216 * This macro calls a function from Unit Test code to write a register. This
217 * allows extra flexibility for unit testing of the IxNpeDl component.
221 #define IX_NPEDL_REG_WRITE(base, offset, value) \
223 ixNpeDlTestRegWrite (base, offset, value); \
228 * @def IX_NPEDL_REG_READ
230 * @brief Mechanism for reading from a memory-mapped register
232 * @param UINT32 [in] base - Base memory address for this NPE's registers
233 * @param UINT32 [in] offset - Offset from base memory address
234 * @param UINT32 *[out] value - Value read from register
236 * This macro calls a function from Unit Test code to read a register. This
237 * allows extra flexibility for unit testing of the IxNpeDl component.
241 #define IX_NPEDL_REG_READ(base, offset, value) \
243 ixNpeDlTestRegRead (base, offset, value); \
247 /* Implementation of the following macros when integrated with IxOsal */
248 #else /* #if (CPU != XSCALE) */
252 * @def IX_NPEDL_TRACE_LEVEL
254 * @brief IxNpeDl debug trace level
256 #define IX_NPEDL_TRACE_LEVEL IX_NPEDL_DEBUG
260 * @def IX_NPEDL_ERROR_REPORT
262 * @brief Mechanism for reporting IxNpeDl software errors
264 * @param char* [in] STR - Error string to report
266 * This macro is used to report IxNpeDl software errors.
270 #define IX_NPEDL_ERROR_REPORT(STR) \
271 ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, STR, 0, 0, 0, 0, 0, 0);
274 * @def IX_NPEDL_WARNING_REPORT
276 * @brief Mechanism for reporting IxNpeDl software warnings
278 * @param char* [in] STR - Warning string to report
280 * This macro is used to report IxNpeDl software warnings.
284 #define IX_NPEDL_WARNING_REPORT(STR) \
285 ixOsalLog (IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0);
289 * @def IX_NPEDL_TRACE0
291 * @brief Mechanism for tracing debug for the IxNpeDl component, for no arguments
293 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
294 * @param char* [in] STR - Trace string
296 * This macro simply prints the trace string passed, if the level is supported.
300 #define IX_NPEDL_TRACE0(LEVEL, STR) \
302 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
304 if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
306 ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0); \
308 else if (LEVEL == IX_NPEDL_DEBUG) \
310 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0); \
316 * @def IX_NPEDL_TRACE1
318 * @brief Mechanism for tracing debug for the IxNpeDl component, with 1 argument
320 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
321 * @param char* [in] STR - Trace string
322 * @param argType [in] ARG1 - Argument to trace
324 * This macro simply prints the trace string passed, if the level is supported.
328 #define IX_NPEDL_TRACE1(LEVEL, STR, ARG1) \
330 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
332 if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
334 ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, 0, 0, 0, 0, 0); \
336 else if (LEVEL == IX_NPEDL_DEBUG) \
338 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, 0, 0, 0, 0, 0); \
344 * @def IX_NPEDL_TRACE2
346 * @brief Mechanism for tracing debug for the IxNpeDl component, with 2 arguments
348 * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
349 * @param char* [in] STR - Trace string
350 * @param argType [in] ARG1 - Argument to trace
351 * @param argType [in] ARG2 - Argument to trace
353 * This macro simply prints the trace string passed, if the level is supported.
357 #define IX_NPEDL_TRACE2(LEVEL, STR, ARG1, ARG2) \
359 if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
361 if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
363 ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, ARG2, 0, 0, 0, 0); \
365 else if (LEVEL == IX_NPEDL_DEBUG) \
367 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, ARG2, 0, 0, 0, 0); \
373 * @def IX_NPEDL_REG_WRITE
375 * @brief Mechanism for writing to a memory-mapped register
377 * @param UINT32 [in] base - Base memory address for this NPE's registers
378 * @param UINT32 [in] offset - Offset from base memory address
379 * @param UINT32 [in] value - Value to write to register
381 * This macro forms the address of the register from base address + offset, and
382 * dereferences that address to write the contents of the register.
386 #define IX_NPEDL_REG_WRITE(base, offset, value) \
387 IX_OSAL_WRITE_LONG(((base) + (offset)), (value))
392 * @def IX_NPEDL_REG_READ
394 * @brief Mechanism for reading from a memory-mapped register
396 * @param UINT32 [in] base - Base memory address for this NPE's registers
397 * @param UINT32 [in] offset - Offset from base memory address
398 * @param UINT32 *[out] value - Value read from register
400 * This macro forms the address of the register from base address + offset, and
401 * dereferences that address to read the register contents.
405 #define IX_NPEDL_REG_READ(base, offset, value) \
406 *(value) = IX_OSAL_READ_LONG(((base) + (offset)))
408 #endif /* #if (CPU != XSCALE) */
410 #endif /* IXNPEDLMACROS_P_H */
413 * @} defgroup IxNpeDlMacros_p