DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
dbgfuncs.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
26 // pre-processor mechanism so multiple inclusions don't cause compilation error
27 #ifndef _DBGFUNCS_H
28 #define _DBGFUNCS_H
29 
30 // uncomment this for assert prints
31 //#define DEBUG_ASSERT
32 
33 // uncomment this for standard ANSI C assertions
34 //#define DEBUG_ASSERT_STANDARD
35 
36 // uncomment this for func start/end messages
37 //#define DEBUG_FUNCTION
38 
39 #ifdef DEBUG_ASSERT_STANDARD
40  #undef assert
41  #include <assert.h>
42 #endif
43 
44 // function profiling macros
45 #ifdef DEBUG_FUNCTIONS
46 #include "stbhwc.h"
47  #define FUNCTION_START(x) STB_SPDebugWrite("START: " # x)
48  #define FUNCTION_FINISH(x) STB_SPDebugWrite("END : " # x)
49 #else
50  #define FUNCTION_START(x)
51  #define FUNCTION_FINISH(x)
52 #endif
53 
54 // assertion macros
55 #ifdef DEBUG_ASSERT
56  #include "stbhwc.h"
57  #define ASSERT(assertion) if (!(assertion)) { STB_SPDebugAssertFail(__FILE__, __LINE__, # assertion); }
58 #else // DEBUG_ASSERT
59  #ifdef DEBUG_ASSERT_STANDARD
60  #define ASSERT(assertion) assert(assertion)
61  #else // DEBUG_ASSERT_STANDARD
62  #define ASSERT(assertion)
63  #endif // DEBUG_ASSERT_STANDARD
64 #endif // DEBUG_ASSERT
65 
66 #if defined(DEBUG_PRINTING_ENABLED)
67  #include "stbhwc.h"
68  #if !defined(NO_FUNC_ID)
69  #define DBGPRINT(x, ...) STB_SPDebugWrite( "%s:%d " x, __FUNCTION__, __LINE__, ##__VA_ARGS__);
70  #else // compiler does not support __FUNCTION__
71  #define DBGPRINT(x, ...) STB_SPDebugWrite( "%s:%d " x, __FILE__, __LINE__, ##__VA_ARGS__);
72  #endif
73 #else
74  #define DBGPRINT(...)
75 #endif /*DEBUG_PRINTING_ENABLED*/
76 
77 #endif // _DBGFUNCS_H
78 
Function prototypes for HW control.