Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

118 строки
5.3 KiB

  1. /**
  2. *
  3. * \file
  4. *
  5. * \brief This module contains debug APIs declarations.
  6. *
  7. * Copyright (c) 2015 - 2018 Atmel Corporation. All rights reserved.
  8. *
  9. * \asf_license_start
  10. *
  11. * \page License
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions are met:
  15. *
  16. * 1. Redistributions of source code must retain the above copyright notice,
  17. * this list of conditions and the following disclaimer.
  18. *
  19. * 2. Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. *
  23. * 3. The name of Atmel may not be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  27. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  28. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  29. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  30. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  34. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  35. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * \asf_license_stop
  39. *
  40. */
  41. #ifndef _NM_DEBUG_H_
  42. #define _NM_DEBUG_H_
  43. #include "bsp/include/nm_bsp.h"
  44. /* #include "bsp/include/nm_bsp_internal.h" */
  45. /**@defgroup DebugDefines DebugDefines
  46. * @ingroup WlanDefines
  47. */
  48. /**@{*/
  49. #define M2M_LOG_NONE 0
  50. #define M2M_LOG_ERROR 1
  51. #define M2M_LOG_INFO 2
  52. #define M2M_LOG_REQ 3
  53. #define M2M_LOG_DBG 4
  54. #if (defined __APS3_CORTUS__)
  55. #define M2M_LOG_LEVEL M2M_LOG_INFO
  56. #else
  57. #define M2M_LOG_LEVEL M2M_LOG_REQ
  58. #endif
  59. #define M2M_ERR(...)
  60. #define M2M_INFO(...)
  61. #define M2M_REQ(...)
  62. #define M2M_DBG(...)
  63. #define M2M_PRINT(...)
  64. #if (CONF_WINC_DEBUG == 1)
  65. #undef M2M_PRINT
  66. #define M2M_PRINT(...) \
  67. do { \
  68. CONF_WINC_PRINTF(__VA_ARGS__); \
  69. CONF_WINC_PRINTF("\r"); \
  70. } while (0)
  71. #if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
  72. #undef M2M_ERR
  73. #define M2M_ERR(...) \
  74. do { \
  75. CONF_WINC_PRINTF("(APP)(ERR)[%s][%d]", __FUNCTION__, __LINE__); \
  76. CONF_WINC_PRINTF(__VA_ARGS__); \
  77. CONF_WINC_PRINTF("\r"); \
  78. } while (0)
  79. #if (M2M_LOG_LEVEL >= M2M_LOG_INFO)
  80. #undef M2M_INFO
  81. #define M2M_INFO(...) \
  82. do { \
  83. CONF_WINC_PRINTF("(APP)(INFO)"); \
  84. CONF_WINC_PRINTF(__VA_ARGS__); \
  85. CONF_WINC_PRINTF("\r"); \
  86. } while (0)
  87. #if (M2M_LOG_LEVEL >= M2M_LOG_REQ)
  88. #undef M2M_REQ
  89. #define M2M_REQ(...) \
  90. do { \
  91. CONF_WINC_PRINTF("(APP)(R)"); \
  92. CONF_WINC_PRINTF(__VA_ARGS__); \
  93. CONF_WINC_PRINTF("\r"); \
  94. } while (0)
  95. #if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
  96. #undef M2M_DBG
  97. #define M2M_DBG(...) \
  98. do { \
  99. CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]", __FUNCTION__, __LINE__); \
  100. CONF_WINC_PRINTF(__VA_ARGS__); \
  101. CONF_WINC_PRINTF("\r"); \
  102. } while (0)
  103. #endif /*M2M_LOG_DBG*/
  104. #endif /*M2M_LOG_REQ*/
  105. #endif /*M2M_LOG_INFO*/
  106. #endif /*M2M_LOG_ERROR*/
  107. #endif /*CONF_WINC_DEBUG */
  108. /**@}*/
  109. #endif /* _NM_DEBUG_H_ */