1 |
5 |
quickwayne |
/* $Id $ */
|
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-2003 Xilinx Inc.
|
19 |
|
|
* All rights reserved.
|
20 |
|
|
*
|
21 |
|
|
******************************************************************************/
|
22 |
|
|
/*****************************************************************************/
|
23 |
|
|
/**
|
24 |
|
|
*
|
25 |
|
|
* @file xbasic_types.c
|
26 |
|
|
*
|
27 |
|
|
* This file contains basic functions for Xilinx software IP.
|
28 |
|
|
*
|
29 |
|
|
* <pre>
|
30 |
|
|
* MODIFICATION HISTORY:
|
31 |
|
|
*
|
32 |
|
|
* Ver Who Date Changes
|
33 |
|
|
* ----- ---- -------- -------------------------------------------------------
|
34 |
|
|
* 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler
|
35 |
|
|
* 1.00a xd 11/03/04 Improved support for doxygen.
|
36 |
|
|
* </pre>
|
37 |
|
|
*
|
38 |
|
|
******************************************************************************/
|
39 |
|
|
|
40 |
|
|
/***************************** Include Files *********************************/
|
41 |
|
|
|
42 |
|
|
#include "xbasic_types.h"
|
43 |
|
|
|
44 |
|
|
/************************** Constant Definitions *****************************/
|
45 |
|
|
|
46 |
|
|
/**************************** Type Definitions *******************************/
|
47 |
|
|
|
48 |
|
|
/***************** Macros (Inline Functions) Definitions *********************/
|
49 |
|
|
|
50 |
|
|
/************************** Variable Definitions *****************************/
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
* This variable allows testing to be done easier with asserts. An assert
|
54 |
|
|
* sets this variable such that a driver can evaluate this variable
|
55 |
|
|
* to determine if an assert occurred.
|
56 |
|
|
*/
|
57 |
|
|
unsigned int XAssertStatus;
|
58 |
|
|
|
59 |
|
|
/**
|
60 |
|
|
* This variable allows the assert functionality to be changed for testing
|
61 |
|
|
* such that it does not wait infinitely. Use the debugger to disable the
|
62 |
|
|
* waiting during testing of asserts.
|
63 |
|
|
*/
|
64 |
|
|
Xboolean XWaitInAssert = XTRUE;
|
65 |
|
|
|
66 |
|
|
/* The callback function to be invoked when an assert is taken */
|
67 |
|
|
static XAssertCallback XAssertCallbackRoutine = (XAssertCallback)XNULL;
|
68 |
|
|
|
69 |
|
|
/************************** Function Prototypes ******************************/
|
70 |
|
|
|
71 |
|
|
/*****************************************************************************/
|
72 |
|
|
/**
|
73 |
|
|
*
|
74 |
|
|
* Implements assert. Currently, it calls a user-defined callback function
|
75 |
|
|
* if one has been set. Then, it potentially enters an infinite loop depending
|
76 |
|
|
* on the value of the XWaitInAssert variable.
|
77 |
|
|
*
|
78 |
|
|
* @param File is the name of the filename of the source
|
79 |
|
|
* @param Line is the linenumber within File
|
80 |
|
|
*
|
81 |
|
|
* @return None.
|
82 |
|
|
*
|
83 |
|
|
* @note None.
|
84 |
|
|
*
|
85 |
|
|
******************************************************************************/
|
86 |
|
|
void XAssert(char *File, int Line)
|
87 |
|
|
{
|
88 |
|
|
/* if the callback has been set then invoke it */
|
89 |
|
|
if (XAssertCallbackRoutine != XNULL)
|
90 |
|
|
{
|
91 |
|
|
(*XAssertCallbackRoutine)(File, Line);
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
/* if specified, wait indefinitely such that the assert will show up
|
95 |
|
|
* in testing
|
96 |
|
|
*/
|
97 |
|
|
while (XWaitInAssert)
|
98 |
|
|
{
|
99 |
|
|
}
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
/*****************************************************************************/
|
103 |
|
|
/**
|
104 |
|
|
*
|
105 |
|
|
* Sets up a callback function to be invoked when an assert occurs. If there
|
106 |
|
|
* was already a callback installed, then it is replaced.
|
107 |
|
|
*
|
108 |
|
|
* @param Routine is the callback to be invoked when an assert is taken
|
109 |
|
|
*
|
110 |
|
|
* @return None.
|
111 |
|
|
*
|
112 |
|
|
* @note This function has no effect if NDEBUG is set
|
113 |
|
|
*
|
114 |
|
|
******************************************************************************/
|
115 |
|
|
void XAssertSetCallback(XAssertCallback Routine)
|
116 |
|
|
{
|
117 |
|
|
XAssertCallbackRoutine = Routine;
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/*****************************************************************************/
|
122 |
|
|
/**
|
123 |
|
|
*
|
124 |
|
|
* Null handler function. This follows the XInterruptHandler signature for
|
125 |
|
|
* interrupt handlers. It can be used to assign a null handler (a stub) to an
|
126 |
|
|
* interrupt controller vector table.
|
127 |
|
|
*
|
128 |
|
|
* @param NullParameter is an arbitrary void pointer and not used.
|
129 |
|
|
*
|
130 |
|
|
* @return None.
|
131 |
|
|
*
|
132 |
|
|
* @note None.
|
133 |
|
|
*
|
134 |
|
|
******************************************************************************/
|
135 |
|
|
void XNullHandler(void *NullParameter)
|
136 |
|
|
{
|
137 |
|
|
}
|
138 |
|
|
|