OpenCores
URL https://opencores.org/ocsvn/mb-jpeg/mb-jpeg/trunk

Subversion Repositories mb-jpeg

[/] [mb-jpeg/] [tags/] [STEP1_1/] [microblaze_0/] [include/] [xbasic_types.h] - Blame information for rev 66

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 quickwayne
/* $Id: xbasic_types.h,v 1.1 2006-06-23 18:59:00 quickwayne Exp $ */
2
/******************************************************************************
3
*
4
*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
5
*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
6
*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
7
*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
8
*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
9
*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
10
*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
11
*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
12
*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
13
*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
14
*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
15
*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
16
*       FOR A PARTICULAR PURPOSE.
17
*
18
*       (c) Copyright 2002-2004 Xilinx Inc.
19
*       All rights reserved.
20
*
21
******************************************************************************/
22
/*****************************************************************************/
23
/**
24
*
25
* @file xbasic_types.h
26
*
27
* This file contains basic types for Xilinx software IP.  These types do not
28
* follow the standard naming convention with respect to using the component
29
* name in front of each name because they are considered to be primitives.
30
*
31
* @note
32
*
33
* This file contains items which are architecture dependent.
34
*
35
* <pre>
36
* MODIFICATION HISTORY:
37
*
38
* Ver   Who    Date   Changes
39
* ----- ---- -------- -------------------------------------------------------
40
* 1.00a rmm  12/14/01 First release
41
*       rmm  05/09/03 Added "xassert always" macros to rid ourselves of diab
42
*                     compiler warnings
43
* 1.00a rpm  11/07/03 Added XNullHandler function as a stub interrupt handler
44
* 1.00a rpm  07/21/04 Added XExceptionHandler typedef for processor exceptions
45
* 1.00a xd   11/03/04 Improved support for doxygen.
46
* </pre>
47
*
48
******************************************************************************/
49
 
50
#ifndef XBASIC_TYPES_H      /* prevent circular inclusions */
51
#define XBASIC_TYPES_H      /* by using protection macros */
52
 
53
/***************************** Include Files *********************************/
54
 
55
 
56
/************************** Constant Definitions *****************************/
57
 
58
/** Xboolean true */
59
#define XTRUE       1
60
/** Xboolean false */
61
#define XFALSE      0
62
 
63
#ifndef NULL
64
#define NULL 0
65
#endif
66
/** Null */
67
#define XNULL NULL
68
 
69
#define XCOMPONENT_IS_READY     0x11111111  /**< component has been initialized */
70
#define XCOMPONENT_IS_STARTED   0x22222222  /**< component has been started */
71
 
72
/* the following constants and declarations are for unit test purposes and are
73
 * designed to be used in test applications.
74
 */
75
#define XTEST_PASSED    0
76
#define XTEST_FAILED    1
77
 
78
#define XASSERT_NONE     0
79
#define XASSERT_OCCURRED 1
80
 
81
extern unsigned int XAssertStatus;
82
extern void XAssert(char *, int);
83
 
84
/**************************** Type Definitions *******************************/
85
 
86
/** @name Primitive types
87
 * These primitive types are created for transportability.
88
 * They are dependent upon the target architecture.
89
 * @{
90
 */
91
typedef unsigned char   Xuint8;     /**< unsigned 8-bit */
92
typedef char            Xint8;      /**< signed 8-bit */
93
typedef unsigned short  Xuint16;    /**< unsigned 16-bit */
94
typedef short           Xint16;     /**< signed 16-bit */
95
typedef unsigned long   Xuint32;    /**< unsigned 32-bit */
96
typedef long            Xint32;     /**< signed 32-bit */
97
typedef float           Xfloat32;   /**< 32-bit floating point */
98
typedef double          Xfloat64;   /**< 64-bit double precision floating point */
99
typedef unsigned long   Xboolean;   /**< boolean (XTRUE or XFALSE) */
100
 
101
typedef struct
102
{
103
    Xuint32 Upper;
104
    Xuint32 Lower;
105
} Xuint64;
106
 
107
/*@}*/
108
 
109
/**
110
 * This data type defines an interrupt handler for a device.
111
 * The argument points to the instance of the component
112
 */
113
typedef void (*XInterruptHandler)(void *InstancePtr);
114
 
115
/**
116
 * This data type defines an exception handler for a processor.
117
 * The argument points to the instance of the component
118
 */
119
typedef void (*XExceptionHandler)(void *InstancePtr);
120
 
121
/**
122
 * This data type defines a callback to be invoked when an
123
 * assert occurs. The callback is invoked only when asserts are enabled
124
 */
125
typedef void (*XAssertCallback)(char* FilenamePtr, int LineNumber);
126
 
127
/***************** Macros (Inline Functions) Definitions *********************/
128
 
129
/*****************************************************************************/
130
/**
131
* Return the most significant half of the 64 bit data type.
132
*
133
* @param    x is the 64 bit word.
134
*
135
* @return   The upper 32 bits of the 64 bit word.
136
*
137
* @note     None.
138
*
139
******************************************************************************/
140
#define XUINT64_MSW(x) ((x).Upper)
141
 
142
/*****************************************************************************/
143
/**
144
* Return the least significant half of the 64 bit data type.
145
*
146
* @param    x is the 64 bit word.
147
*
148
* @return   The lower 32 bits of the 64 bit word.
149
*
150
* @note     None.
151
*
152
******************************************************************************/
153
#define XUINT64_LSW(x) ((x).Lower)
154
 
155
 
156
#ifndef NDEBUG
157
 
158
/*****************************************************************************/
159
/**
160
* This assert macro is to be used for functions that do not return anything
161
* (void). This in conjunction with the XWaitInAssert boolean can be used to
162
* accomodate tests so that asserts which fail allow execution to continue.
163
*
164
* @param    expression is the expression to evaluate. If it evaluates to
165
*           false, the assert occurs.
166
*
167
* @return   Returns void unless the XWaitInAssert variable is true, in which
168
*           case no return is made and an infinite loop is entered.
169
*
170
* @note     None.
171
*
172
******************************************************************************/
173
#define XASSERT_VOID(expression)                   \
174
{                                                  \
175
    if (expression)                                \
176
    {                                              \
177
        XAssertStatus = XASSERT_NONE;              \
178
    }                                              \
179
    else                                           \
180
    {                                              \
181
        XAssert(__FILE__, __LINE__);               \
182
                XAssertStatus = XASSERT_OCCURRED;  \
183
        return;                                    \
184
    }                                              \
185
}
186
 
187
/*****************************************************************************/
188
/**
189
* This assert macro is to be used for functions that do return a value. This in
190
* conjunction with the XWaitInAssert boolean can be used to accomodate tests so
191
* that asserts which fail allow execution to continue.
192
*
193
* @param    expression is the expression to evaluate. If it evaluates to false,
194
*           the assert occurs.
195
*
196
* @return   Returns 0 unless the XWaitInAssert variable is true, in which case
197
*           no return is made and an infinite loop is entered.
198
*
199
* @note     None.
200
*
201
******************************************************************************/
202
#define XASSERT_NONVOID(expression)                \
203
{                                                  \
204
    if (expression)                                \
205
    {                                              \
206
        XAssertStatus = XASSERT_NONE;              \
207
    }                                              \
208
    else                                           \
209
    {                                              \
210
        XAssert(__FILE__, __LINE__);               \
211
                XAssertStatus = XASSERT_OCCURRED;  \
212
        return 0;                                  \
213
    }                                              \
214
}
215
 
216
/*****************************************************************************/
217
/**
218
* Always assert. This assert macro is to be used for functions that do not
219
* return anything (void). Use for instances where an assert should always
220
* occur.
221
*
222
* @return Returns void unless the XWaitInAssert variable is true, in which case
223
*         no return is made and an infinite loop is entered.
224
*
225
* @note   None.
226
*
227
******************************************************************************/
228
#define XASSERT_VOID_ALWAYS()                      \
229
{                                                  \
230
   XAssert(__FILE__, __LINE__);                    \
231
           XAssertStatus = XASSERT_OCCURRED;       \
232
   return;                                         \
233
}
234
 
235
/*****************************************************************************/
236
/**
237
* Always assert. This assert macro is to be used for functions that do return
238
* a value. Use for instances where an assert should always occur.
239
*
240
* @return Returns void unless the XWaitInAssert variable is true, in which case
241
*         no return is made and an infinite loop is entered.
242
*
243
* @note   None.
244
*
245
******************************************************************************/
246
#define XASSERT_NONVOID_ALWAYS()                   \
247
{                                                  \
248
   XAssert(__FILE__, __LINE__);                    \
249
           XAssertStatus = XASSERT_OCCURRED;       \
250
   return 0;                                       \
251
}
252
 
253
 
254
#else
255
 
256
#define XASSERT_VOID(expression)
257
#define XASSERT_VOID_ALWAYS()
258
#define XASSERT_NONVOID(expression)
259
#define XASSERT_NONVOID_ALWAYS()
260
#endif
261
 
262
/************************** Function Prototypes ******************************/
263
 
264
void XAssertSetCallback(XAssertCallback Routine);
265
void XNullHandler(void *NullParameter);
266
 
267
#endif          /* end of protection macro */
268
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.