AssertNonvoid function

Hi folks.

I am working with spi drivers example in C language.
in this path: https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/spi/examples/xspi_polled_example.c

I came across this function [inside Xilinx BSP package]

1
2
3
4
5
6
7
8
9
10
 #define Xil_AssertNonvoid(Expression)             \
{                                                  \
    if (Expression) {                              \
        Xil_AssertStatus = XIL_ASSERT_NONE;       \
    } else {                                       \
        Xil_Assert(__FILE__, __LINE__);            \
        Xil_AssertStatus = XIL_ASSERT_OCCURRED;   \
        return 0;                                  \
    }                                              \
} 

/*****************************************************************************/
/**
* @brief This assert macro is to be used for functions that do return a
* value. This in conjunction with the Xil_AssertWait boolean can be
* used to accommodate tests so that asserts which fail allow execution
* to continue.
*
* @param Expression: expression to be evaluated. If it evaluates to false,
* the assert occurs.
*
* @return Returns 0 unless the Xil_AssertWait variable is true, in which
* case no return is made and an infinite loop is entered.
*
******************************************************************************/


This isn't look familiar to what i deal with in the past.
What is the purpose of this function?
its a debugging function to tell you the file and line number where things went wrong.
Topic archived. No new replies allowed.