2 * @file IxNpeMhMacros_p.h
4 * @author Intel Corporation
7 * @brief This file contains the macros for the IxNpeMh 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 IxNpeMhMacros_p IxNpeMhMacros_p
52 * @brief Macros for the IxNpeMh component.
57 #ifndef IXNPEMHMACROS_P_H
58 #define IXNPEMHMACROS_P_H
60 /* if we are running as a unit test */
63 #endif /* #ifdef IX_UNIT_TEST */
68 * #defines for function return types, etc.
71 #define IX_NPEMH_SHOW_TEXT_WIDTH (40) /**< text width for stats display */
72 #define IX_NPEMH_SHOW_STAT_WIDTH (10) /**< stat width for stats display */
77 * @brief Macro for displaying a stat preceded by a textual description.
80 #define IX_NPEMH_SHOW(TEXT, STAT) \
81 ixOsalLog (IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, \
82 "%-40s: %10d\n", (int) TEXT, (int) STAT, 0, 0, 0, 0)
85 * Prototypes for interface functions.
89 * @typedef IxNpeMhTraceTypes
91 * @brief Enumeration defining IxNpeMh trace levels
96 IX_NPEMH_TRACE_OFF
= IX_OSAL_LOG_LVL_NONE
, /**< no trace */
97 IX_NPEMH_WARNING
= IX_OSAL_LOG_LVL_WARNING
, /**< warning */
98 IX_NPEMH_DEBUG
= IX_OSAL_LOG_LVL_MESSAGE
, /**< debug */
99 IX_NPEMH_FN_ENTRY_EXIT
= IX_OSAL_LOG_LVL_DEBUG3
/**< function entry/exit */
103 #define IX_NPEMH_TRACE_LEVEL (IX_NPEMH_FN_ENTRY_EXIT) /**< trace level */
105 #define IX_NPEMH_TRACE_LEVEL (IX_NPEMH_TRACE_OFF) /**< trace level */
109 * @def IX_NPEMH_TRACE0
111 * @brief Trace macro taking 0 arguments.
114 #define IX_NPEMH_TRACE0(LEVEL, STR) \
115 IX_NPEMH_TRACE6(LEVEL, STR, 0, 0, 0, 0, 0, 0)
118 * @def IX_NPEMH_TRACE1
120 * @brief Trace macro taking 1 argument.
123 #define IX_NPEMH_TRACE1(LEVEL, STR, ARG1) \
124 IX_NPEMH_TRACE6(LEVEL, STR, ARG1, 0, 0, 0, 0, 0)
127 * @def IX_NPEMH_TRACE2
129 * @brief Trace macro taking 2 arguments.
132 #define IX_NPEMH_TRACE2(LEVEL, STR, ARG1, ARG2) \
133 IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, 0, 0, 0, 0)
136 * @def IX_NPEMH_TRACE3
138 * @brief Trace macro taking 3 arguments.
141 #define IX_NPEMH_TRACE3(LEVEL, STR, ARG1, ARG2, ARG3) \
142 IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, 0, 0, 0)
145 * @def IX_NPEMH_TRACE4
147 * @brief Trace macro taking 4 arguments.
150 #define IX_NPEMH_TRACE4(LEVEL, STR, ARG1, ARG2, ARG3, ARG4) \
151 IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, 0, 0)
154 * @def IX_NPEMH_TRACE5
156 * @brief Trace macro taking 5 arguments.
159 #define IX_NPEMH_TRACE5(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, ARG5) \
160 IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, ARG5, 0)
163 * @def IX_NPEMH_TRACE6
165 * @brief Trace macro taking 6 arguments.
168 #define IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
170 if (LEVEL <= IX_NPEMH_TRACE_LEVEL) \
172 (void) ixOsalLog (LEVEL, IX_OSAL_LOG_DEV_STDOUT, (STR), \
173 (int)(ARG1), (int)(ARG2), (int)(ARG3), \
174 (int)(ARG4), (int)(ARG5), (int)(ARG6)); \
179 * @def IX_NPEMH_ERROR_REPORT
181 * @brief Error reporting facility.
184 #define IX_NPEMH_ERROR_REPORT(STR) \
186 (void) ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, \
187 (STR), 0, 0, 0, 0, 0, 0); \
190 /* if we are running on XScale, i.e. real environment */
194 * @def IX_NPEMH_REGISTER_READ
196 * @brief This macro reads a memory-mapped register.
199 #define IX_NPEMH_REGISTER_READ(registerAddress, value) \
201 *value = IX_OSAL_READ_LONG(registerAddress); \
205 * @def IX_NPEMH_REGISTER_READ_BITS
207 * @brief This macro partially reads a memory-mapped register.
210 #define IX_NPEMH_REGISTER_READ_BITS(registerAddress, value, mask) \
212 *value = (IX_OSAL_READ_LONG(registerAddress) & mask); \
216 * @def IX_NPEMH_REGISTER_WRITE
218 * @brief This macro writes a memory-mapped register.
221 #define IX_NPEMH_REGISTER_WRITE(registerAddress, value) \
223 IX_OSAL_WRITE_LONG(registerAddress, value); \
227 * @def IX_NPEMH_REGISTER_WRITE_BITS
229 * @brief This macro partially writes a memory-mapped register.
232 #define IX_NPEMH_REGISTER_WRITE_BITS(registerAddress, value, mask) \
234 UINT32 orig = IX_OSAL_READ_LONG(registerAddress); \
236 orig |= (value & mask); \
237 IX_OSAL_WRITE_LONG(registerAddress, orig); \
241 /* if we are running as a unit test */
242 #else /* #if CPU==XSCALE */
244 #include "IxNpeMhTestRegister.h"
247 * @def IX_NPEMH_REGISTER_READ
249 * @brief This macro reads a memory-mapped register.
252 #define IX_NPEMH_REGISTER_READ(registerAddress, value) \
254 ixNpeMhTestRegisterRead (registerAddress, value); \
258 * @def IX_NPEMH_REGISTER_READ_BITS
260 * @brief This macro partially reads a memory-mapped register.
263 #define IX_NPEMH_REGISTER_READ_BITS(registerAddress, value, mask) \
265 ixNpeMhTestRegisterReadBits (registerAddress, value, mask); \
269 * @def IX_NPEMH_REGISTER_WRITE
271 * @brief This macro writes a memory-mapped register.
274 #define IX_NPEMH_REGISTER_WRITE(registerAddress, value) \
276 ixNpeMhTestRegisterWrite (registerAddress, value); \
280 * @def IX_NPEMH_REGISTER_WRITE_BITS
282 * @brief This macro partially writes a memory-mapped register.
285 #define IX_NPEMH_REGISTER_WRITE_BITS(registerAddress, value, mask) \
287 ixNpeMhTestRegisterWriteBits (registerAddress, value, mask); \
290 #endif /* #if CPU==XSCALE */
292 #endif /* IXNPEMHMACROS_P_H */
295 * @} defgroup IxNpeMhMacros_p