ADuCM302x Device Drivers API Reference Manual
Release 3.1.2.0
common.h
1
46
#ifndef COMMON_H
47
#define COMMON_H
48
49
#ifdef __ICCARM__
50
/*
51
* Pm106 (rule 20.9): the input/output library <stdio.h> shall not be used in
52
production code
53
* The purpose of this header is to provide I/O facilities based on stdio.
54
*/
55
#pragma diag_suppress=Pm106
56
#endif
/* __ICCARM__ */
57
58
#include <stdint.h>
59
#include <stdio.h>
60
#include <stdlib.h>
61
#include <stddef.h>
62
#include <string.h>
63
64
65
#ifdef __ICCARM__
66
/*
67
* IAR MISRA C 2004 error suppressions.
68
*
69
* Pm011 (rule 6.3): The basic types of char, int, short, long, float shall not be used.
70
* Pm064 (rule 16.1): functions with variable number of arguments shall not be used.
71
*/
72
#pragma diag_suppress=Pm011,Pm064
73
#endif
/* __ICCARM__ */
74
75
76
#ifdef __cplusplus
77
extern
"C"
{
78
#endif
79
80
/* Enable REDIRECT_OUTPUT_TO_UART to send the output to UART terminal.
81
This requires the UART Driver(adi_uart.c) to be included in the project */
82
/* #define REDIRECT_OUTPUT_TO_UART */
83
84
extern
char
aDebugString[150];
85
86
#ifdef __ICCARM__
87
/*
88
* Pm154 (rule 19.10): in the definition of a function-like macro, each instance
89
* of a parameter shall be enclosed in parentheses
90
* The __VA_ARGS__ macro cannot be enclosed in parentheses.
91
*/
92
#pragma diag_suppress=Pm154
93
#endif
/* __ICCARM__ */
94
95
#define DEBUG_MESSAGE(...) \
96
do { \
97
sprintf(aDebugString,__VA_ARGS__); \
98
common_Perf(aDebugString); \
99
} while(0)
100
101
#ifdef __ICCARM__
102
#pragma diag_default=Pm154
103
#endif
/* __ICCARM__ */
104
105
#define DEBUG_RESULT(s,result,expected_value) \
106
do { \
107
if ((result) != (expected_value)) { \
108
sprintf(aDebugString,"%s %d", __FILE__,__LINE__); \
109
common_Fail(aDebugString); \
110
sprintf(aDebugString,"%s Error Code: 0x%08X\n\rFailed\n\r",(s),(result)); \
111
common_Perf(aDebugString); \
112
exit(0); \
113
} \
114
} while (0)
115
116
/********************************************************************************
117
* API function prototypes
118
*********************************************************************************/
119
void
common_Init(
void
);
120
void
common_Pass(
void
);
121
void
common_Fail(
char
*FailureReason);
122
void
common_Perf(
char
*InfoString);
123
124
#ifdef __cplusplus
125
}
126
#endif
127
128
#endif
/* COMMON_H */
Include
common.h
Generated on Mon Aug 6 2018 21:48:23 for ADuCM302x Device Drivers API Reference Manual by
1.8.13