1 /**
2  *
3  * \file
4  *
5  * \brief This module contains debug APIs declarations.
6  *
7  * Copyright (c) 2016-2017 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 
42 #ifndef _NM_DEBUG_H_
43 #define _NM_DEBUG_H_
44 
45 #include "bsp/include/nm_bsp.h"
46 #include "bsp/include/nm_bsp_internal.h"
47 
48 /**@defgroup  DebugDefines DebugDefines
49  * @ingroup WlanDefines
50  */
51 /**@{*/
52 
53 
54 #define M2M_LOG_NONE									0
55 #define M2M_LOG_ERROR									1
56 #define M2M_LOG_INFO									2
57 #define M2M_LOG_REQ										3
58 #define M2M_LOG_DBG										4
59 
60 #if (defined __APS3_CORTUS__)
61 #define M2M_LOG_LEVEL									M2M_LOG_INFO
62 #else
63 #define M2M_LOG_LEVEL									M2M_LOG_REQ
64 #endif
65 
66 
67 #define M2M_ERR(...)
68 #define M2M_INFO(...)
69 #define M2M_REQ(...)
70 #define M2M_DBG(...)
71 #define M2M_PRINT(...)
72 
73 #if (CONF_WINC_DEBUG == 1)
74 #undef M2M_PRINT
75 #define M2M_PRINT(...)							do{CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
76 #if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
77 #undef M2M_ERR
78 #define M2M_ERR(...)							do{CONF_WINC_PRINTF("(APP)(ERR)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
79 #if (M2M_LOG_LEVEL >= M2M_LOG_INFO)
80 #undef M2M_INFO
81 #define M2M_INFO(...)							do{CONF_WINC_PRINTF("(APP)(INFO)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
82 #if (M2M_LOG_LEVEL >= M2M_LOG_REQ)
83 #undef M2M_REQ
84 #define M2M_REQ(...)							do{CONF_WINC_PRINTF("(APP)(R)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
85 #if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
86 #undef M2M_DBG
87 #define M2M_DBG(...)							do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
88 #endif /*M2M_LOG_DBG*/
89 #endif /*M2M_LOG_REQ*/
90 #endif /*M2M_LOG_INFO*/
91 #endif /*M2M_LOG_ERROR*/
92 #endif /*CONF_WINC_DEBUG */
93 
94 /**@}*/
95 #endif /* _NM_DEBUG_H_ */
96