AAX SDK  2.4.1
Avid Audio Extensions Development Kit
AAX_Assert.h
Go to the documentation of this file.
1 /*================================================================================================*/
2 /*
3  *
4  * Copyright 2013-2015, 2018 by Avid Technology, Inc.
5  * All rights reserved.
6  *
7  * CONFIDENTIAL: This document contains confidential information. Do not
8  * read or examine this document unless you are an Avid Technology employee
9  * or have signed a non-disclosure agreement with Avid Technology which protects
10  * the confidentiality of this document. DO NOT DISCLOSE ANY INFORMATION
11  * CONTAINED IN THIS DOCUMENT TO ANY THIRD-PARTY WITHOUT THE PRIOR WRITTEN CONSENT
12  * OF Avid Technology, INC.
13  *
14  */
15 
57 #ifndef AAX_ASSERT_H
58 #define AAX_ASSERT_H
59 
60 #include "AAX_Enums.h"
61 
62 
172 #ifdef _TMS320C6X // TI-only
173 
174  #ifndef TI_SHELL_TRACING_H
175  #include "TI_Shell_Tracing.h"
176  #endif
177 
178  typedef AAX_ETracePriorityDSP EAAX_Trace_Priority;
179 
180  #define kAAX_Trace_Priority_None AAX_eTracePriorityDSP_None
181  #define kAAX_Trace_Priority_High AAX_eTracePriorityDSP_High
182  #define kAAX_Trace_Priority_Normal AAX_eTracePriorityDSP_Normal
183  #define kAAX_Trace_Priority_Low AAX_eTracePriorityDSP_Low
184  #define kAAX_Trace_Priority_Lowest AAX_eTracePriorityDSP_Low
185 
186  //Note that the Message provided to AAX_TRACE must be a cons string available for indefinite time
187  // because sending it to the host is done asynchronously.
188  #define AAX_TRACE_RELEASE( ... ) TISHELLTRACE( __VA_ARGS__ )
189 
190  //Stack traces not supported on TI - just log
191  #define AAX_STACKTRACE_RELEASE( ... ) TISHELLTRACE( __VA_ARGS__ )
192  #define AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, ... ) TISHELLTRACE( iTracePriority, __VA_ARGS__ )
193 
194  #define _STRINGIFY(x) #x
195  #define _TOSTRING(x) _STRINGIFY(x)
196 
197  #define AAX_ASSERT( condition ) \
198  { \
199  if( ! (condition) ) _DoTrace( AAX_eTracePriorityDSP_Assert, \
200  CAT(CAT( CAT(__FILE__, ":"), _TOSTRING(__LINE__) ) , CAT(" failed: ", #condition) ) );\
201  }
202 
203  #if defined(_DEBUG)
204  #define AAX_DEBUGASSERT( condition ) AAX_ASSERT( condition )
205  #define AAX_TRACE( ... ) AAX_TRACE_RELEASE( __VA_ARGS__ )
206  #define AAX_STACKTRACE( ... ) AAX_STACKTRACE_RELEASE( __VA_ARGS__ )
207  #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, __VA_ARGS__ )
208 
209  #else
210  #define AAX_DEBUGASSERT( condition ) do { ; } while (0)
211  #define AAX_TRACE( ... ) do { ; } while (0)
212  #define AAX_STACKTRACE( ... ) do { ; } while (0)
213  #define AAX_TRACEORSTACKTRACE( ... ) do { ; } while (0)
214  #endif
215 
216 #else // Host:
217 
218  #ifndef AAX_CHOSTSERVICES_H
219  #include "AAX_CHostServices.h"
220  #endif
221 
223 
224  #define kAAX_Trace_Priority_None AAX_eTracePriorityHost_None
225  #define kAAX_Trace_Priority_High AAX_eTracePriorityHost_High
226  #define kAAX_Trace_Priority_Normal AAX_eTracePriorityHost_Normal
227  #define kAAX_Trace_Priority_Low AAX_eTracePriorityHost_Low
228  #define kAAX_Trace_Priority_Lowest AAX_eTracePriorityHost_Lowest
229 
230  //Note that the Message provided to AAX_TRACE must be a const string available for indefinite time
231  // because sending it to the host is done asynchronously on TI
232  #define AAX_TRACE_RELEASE( iPriority, ... ) \
233  { \
234  AAX_CHostServices::Trace ( iPriority, __VA_ARGS__ ); \
235  };
236 
237  #define AAX_STACKTRACE_RELEASE( iPriority, ... ) \
238  { \
239  AAX_CHostServices::StackTrace ( iPriority, iPriority, __VA_ARGS__ ); \
240  };
241 
242  #define AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, ... ) \
243  { \
244  AAX_CHostServices::StackTrace ( iTracePriority, iStackTracePriority, __VA_ARGS__ ); \
245  };
246 
247  #if defined(_DEBUG)
248 
249  #define AAX_ASSERT( condition ) \
250  { \
251  if( ! ( condition ) ) { \
252  AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log | (int32_t)AAX_eAssertFlags_Dialog ); \
253  } \
254  };
255 
256  #define AAX_DEBUGASSERT( condition ) \
257  { \
258  if( ! ( condition ) ) { \
259  AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log | (int32_t)AAX_eAssertFlags_Dialog ); \
260  } \
261  };
262 
263  #define AAX_TRACE( iPriority, ... ) AAX_TRACE_RELEASE( iPriority, __VA_ARGS__ )
264  #define AAX_STACKTRACE( iPriority, ... ) AAX_STACKTRACE_RELEASE( iPriority, __VA_ARGS__ )
265  #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) AAX_TRACEORSTACKTRACE_RELEASE( iTracePriority, iStackTracePriority, __VA_ARGS__ )
266 
267  #else
268  #define AAX_ASSERT( condition ) \
269  { \
270  if( ! ( condition ) ) { \
271  AAX_CHostServices::HandleAssertFailure( __FILE__, __LINE__, #condition, (int32_t)AAX_eAssertFlags_Log ); \
272  } \
273  };
274 
275  #define AAX_DEBUGASSERT( condition ) do { ; } while (0)
276  #define AAX_TRACE( iPriority, ... ) do { ; } while (0)
277  #define AAX_STACKTRACE( iPriority, ... ) do { ; } while (0)
278  #define AAX_TRACEORSTACKTRACE( iTracePriority, iStackTracePriority, ... ) do { ; } while (0)
279  #endif
280 
281 #endif
282 
283 
284 #endif // include guard
285 // end of AAX_Assert.h
AAX_ETracePriorityHost AAX_ETracePriority
Definition: AAX_Assert.h:222
Concrete implementation of the AAX_IHostServices interface.
Utility functions for byte-swapping. Used by AAX_CChunkDataParser.
AAX_ETracePriorityHost
Platform-specific tracing priorities.
Definition: AAX_Enums.h:76
AAX_ETracePriorityDSP
Platform-specific tracing priorities.
Definition: AAX_Enums.h:91