vg_lite_debug.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /****************************************************************************
  2. *
  3. * Copyright 2012 - 2023 Vivante Corporation, Santa Clara, California.
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * 'Software'), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject
  12. * to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial
  16. * portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  19. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21. * IN NO EVENT SHALL VIVANTE AND/OR ITS SUPPLIERS BE LIABLE FOR ANY
  22. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. *****************************************************************************/
  27. #ifndef _vg_lite_debug_h_
  28. #define _vg_lite_debug_h_
  29. #include "vg_lite_kernel.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #define vg_lite_kernel_print vg_lite_hal_trace
  34. #define vg_lite_kernel_trace vg_lite_hal_trace
  35. #define vg_lite_kernel_error vg_lite_hal_print
  36. #define vg_lite_kernel_hintmsg vg_lite_hal_trace
  37. #define VG_IS_SUCCESS(error) (error == VG_LITE_SUCCESS)
  38. #define VG_IS_ERROR(error) (error != VG_LITE_SUCCESS)
  39. #define ONERROR(func) \
  40. do \
  41. { \
  42. error = func; \
  43. if (VG_IS_ERROR(error)) \
  44. { \
  45. vg_lite_kernel_error((char *)"ONERROR: status = %d(%s) %s(%d)\n", error, vg_lite_hal_Status2Name(error), __FUNCTION__, __LINE__); \
  46. goto on_error; \
  47. } \
  48. } \
  49. while (VG_FALSE)
  50. #define ASSERT(arg) \
  51. do \
  52. { \
  53. if (!(arg)) \
  54. { \
  55. error = VG_LITE_INVALID_ARGUMENT;\
  56. goto on_error; \
  57. } \
  58. } \
  59. while (VG_FALSE)
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif