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

108 строки
3.4 KiB

  1. /**
  2. *
  3. * \file
  4. *
  5. * \brief This module contains debug APIs declarations.
  6. *
  7. * Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
  8. *
  9. * \asf_license_start
  10. *
  11. * \page License
  12. *
  13. * Subject to your compliance with these terms, you may use Microchip
  14. * software and any derivatives exclusively with Microchip products.
  15. * It is your responsibility to comply with third party license terms applicable
  16. * to your use of third party software (including open source software) that
  17. * may accompany Microchip software.
  18. *
  19. * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
  20. * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
  21. * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
  22. * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
  23. * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
  24. * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
  25. * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
  26. * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
  27. * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
  28. * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
  29. * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
  30. *
  31. * \asf_license_stop
  32. *
  33. */
  34. #ifndef _NM_DEBUG_H_
  35. #define _NM_DEBUG_H_
  36. #include "bsp/include/nm_bsp.h"
  37. #include "bsp/include/nm_bsp_internal.h"
  38. #define M2M_LOG_NONE 0
  39. #define M2M_LOG_ERROR 1
  40. #define M2M_LOG_INFO 2
  41. #define M2M_LOG_REQ 3
  42. #define M2M_LOG_DBG 4
  43. #define M2M_LOG_LEVEL M2M_LOG_DBG
  44. /**/
  45. #if !((defined __MSP430FR5739)||(defined __MCF964548__))
  46. #define M2M_ERR(...)
  47. #define M2M_INFO(...)
  48. #define M2M_REQ(...)
  49. #define M2M_DBG(...)
  50. #if (CONF_WINC_DEBUG == 1)
  51. #define M2M_PRINT(...) do{CONF_WINC_PRINTF(__VA_ARGS__);}while(0)
  52. #if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
  53. #undef M2M_ERR
  54. #define M2M_ERR(...) do{CONF_WINC_PRINTF("(APP)(ERR)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
  55. #if (M2M_LOG_LEVEL >= M2M_LOG_INFO)
  56. #undef M2M_INFO
  57. #define M2M_INFO(...) do{CONF_WINC_PRINTF("(APP)(INFO)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
  58. #if (M2M_LOG_LEVEL >= M2M_LOG_REQ)
  59. #undef M2M_REQ
  60. #define M2M_REQ(...) do{CONF_WINC_PRINTF("(APP)(R)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
  61. #if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
  62. #undef M2M_DBG
  63. #define M2M_DBG(...) do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
  64. #endif
  65. #endif
  66. #endif
  67. #endif
  68. #else
  69. #define M2M_ERR(...)
  70. #define M2M_DBG(...)
  71. #define M2M_REQ(...)
  72. #define M2M_INFO(...)
  73. #define M2M_PRINT(...)
  74. #endif
  75. #else
  76. #if (!defined __MCF964548__)||(!defined __SAMD21J18A__)
  77. static void M2M_ERR(const char *_format, ...) //__attribute__ ((__format__ (M2M_ERR, 1, 2)))
  78. {
  79. }
  80. static void M2M_DBG(const char *_format, ...) //__attribute__ ((__format__ (M2M_DBG, 1, 2)))
  81. {
  82. }
  83. static void M2M_REQ(const char *_format, ...) //__attribute__ ((__format__ (M2M_DBG, 1, 2)))
  84. {
  85. }
  86. static void M2M_INFO(const char *_format, ...) // __attribute__ ((__format__ (M2M_INFO, 1, 2)))
  87. {
  88. }
  89. static void M2M_PRINT(const char *_format, ...) // __attribute__ ((__format__ (M2M_INFO, 1, 2)))
  90. {
  91. }
  92. static void CONF_WINC_PRINTF(const char *_format, ...)
  93. {
  94. }
  95. #endif
  96. #endif
  97. #endif /* _NM_DEBUG_H_ */