debug.h 2.5 KB

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