debug.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //*****************************************************************************
  2. //
  3. // debug.h - Macros for assisting debug of the driver library.
  4. //
  5. // Copyright (c) 2006-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
  22. //
  23. //*****************************************************************************
  24. #ifndef __DEBUG_H__
  25. #define __DEBUG_H__
  26. //*****************************************************************************
  27. //
  28. // Prototype for the function that is called when an invalid argument is passed
  29. // to an API. This is only used when doing a DEBUG build.
  30. //
  31. //*****************************************************************************
  32. extern void __error__(char *pcFilename, unsigned long ulLine);
  33. //*****************************************************************************
  34. //
  35. // The ASSERT macro, which does the actual assertion checking. Typically, this
  36. // will be for procedure arguments.
  37. //
  38. //*****************************************************************************
  39. #ifdef DEBUG
  40. #define ASSERT(expr) { \
  41. if(!(expr)) \
  42. { \
  43. __error__(__FILE__, __LINE__); \
  44. } \
  45. }
  46. #else
  47. #define ASSERT(expr)
  48. #endif
  49. #endif // __DEBUG_H__