ADuCM4x50 Device Drivers API Reference Manual
Release 4.0.0.0
common.h
1
13
#ifndef COMMON_H
14
#define COMMON_H
15
16
#ifdef __ICCARM__
17
/*
18
* Pm106 (rule 20.9): the input/output library <stdio.h> shall not be used in
19
production code
20
* The purpose of this header is to provide I/O facilities based on stdio.
21
*/
22
#pragma diag_suppress=Pm106
23
#endif
/* __ICCARM__ */
24
25
#include <stdint.h>
26
#include <stdio.h>
27
#include <stdlib.h>
28
#include <stddef.h>
29
#include <string.h>
30
31
32
#ifdef __ICCARM__
33
/*
34
* IAR MISRA C 2004 error suppressions.
35
*
36
* Pm011 (rule 6.3): The basic types of char, int, short, long, float shall not be used.
37
* Pm064 (rule 16.1): functions with variable number of arguments shall not be used.
38
*/
39
#pragma diag_suppress=Pm011,Pm064
40
#endif
/* __ICCARM__ */
41
42
43
#ifdef __cplusplus
44
extern
"C"
{
45
#endif
46
47
/* Enable REDIRECT_OUTPUT_TO_UART to send the output to UART terminal.
48
This requires the UART Driver(adi_uart.c) to be included in the project */
49
/* #define REDIRECT_OUTPUT_TO_UART */
50
51
extern
char
aDebugString[150];
52
53
#ifdef __ICCARM__
54
/*
55
* Pm154 (rule 19.10): in the definition of a function-like macro, each instance
56
* of a parameter shall be enclosed in parentheses
57
* The __VA_ARGS__ macro cannot be enclosed in parentheses.
58
*/
59
#pragma diag_suppress=Pm154
60
#endif
/* __ICCARM__ */
61
62
#define DEBUG_MESSAGE(...) \
63
do { \
64
sprintf(aDebugString,__VA_ARGS__); \
65
common_Perf(aDebugString); \
66
} while(0)
67
68
#ifdef __ICCARM__
69
#pragma diag_default=Pm154
70
#endif
/* __ICCARM__ */
71
72
#define DEBUG_RESULT(s,result,expected_value) \
73
do { \
74
if ((result) != (expected_value)) { \
75
sprintf(aDebugString,"%s %d", __FILE__,__LINE__); \
76
common_Fail(aDebugString); \
77
sprintf(aDebugString,"%s Error Code: 0x%08X\n\rFailed\n\r",(s),(result)); \
78
common_Perf(aDebugString); \
79
exit(0); \
80
} \
81
} while (0)
82
83
/********************************************************************************
84
* API function prototypes
85
*********************************************************************************/
86
void
common_Init(
void
);
87
void
common_Pass(
void
);
88
void
common_Fail(
char
*FailureReason);
89
void
common_Perf(
char
*InfoString);
90
91
#ifdef __cplusplus
92
}
93
#endif
94
95
#endif
/* COMMON_H */
Include
common.h
Generated on Tue Aug 31 2021 19:04:43 for ADuCM4x50 Device Drivers API Reference Manual by
1.8.15