-
Notifications
You must be signed in to change notification settings - Fork 3
/
app_serial.h
189 lines (150 loc) · 7.53 KB
/
app_serial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
*********************************************************************************************************
* uC/PROBE
*
* (c) Copyright 2003-2009; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
* Knowledge of the source code may NOT be used to develop a similar product.
* Please help us continue to provide the Embedded community with the finest
* software available. Your honesty is greatly appreciated.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* uC/Serial
* Application Code
*
* Filename : app_serial.h
* Version : V1.00
* Programmer(s) : FT
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) This header file is protected from multiple pre-processor inclusion through use of the
* APP_SERIAL_MODULE_PRESENT present pre-processor macro definition.
*********************************************************************************************************
*/
#ifndef APP_SERIAL_MODULE_PRESENT /* See Note #1. */
#define APP_SERIAL_MODULE_PRESENT
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include <lib_def.h>
#include <cpu.h>
#include <app_cfg.h>
/*
*********************************************************************************************************
* EXTERNS
*********************************************************************************************************
*/
#ifdef APP_SERIAL_MODULE
#define APP_SERIAL_MODULE_EXT
#else
#define APP_SERIAL_MODULE_EXT extern
#endif
/*
*********************************************************************************************************
* DEFAULT CONFIGURATION
*********************************************************************************************************
*/
#ifndef APP_CFG_SERIAL_EN
#define APP_CFG_SERIAL_EN DEF_DISABLED
#endif
#ifndef APP_SERIAL_CFG_TRACE_EN
#define APP_SERIAL_CFG_TRACE_EN DEF_DISABLED
#endif
/*
*********************************************************************************************************
* CONDITIONAL INCLUDE FILES
*********************************************************************************************************
*/
#if (APP_CFG_SERIAL_EN == DEF_ENABLED)
#include <serial.h>
#include <serial_bsp_stm3240x.h>
#endif
#if (APP_SERIAL_CFG_TRACE_EN == DEF_ENABLED)
#include <stdarg.h>
#include <stdio.h>
#include <lib_str.h>
#include <serial_line_tty.h>
#endif
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MACRO'S
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
#if (APP_CFG_SERIAL_EN == DEF_ENABLED)
CPU_BOOLEAN App_SerialInit (void);
#if (APP_SERIAL_CFG_TRACE_EN == DEF_ENABLED)
void App_SerPrintf (CPU_CHAR *format, ...);
void App_SerStrRd (CPU_CHAR *p_str,
CPU_SIZE_T len);
void App_SerStrWr (CPU_CHAR *p_str);
#endif
#endif
/*
*********************************************************************************************************
* CONFIGURATION ERRORS
*********************************************************************************************************
*/
#ifndef APP_CFG_SERIAL_EN
#error "APP_CFG_SERIAL_EN not #define'd in 'app_cfg.h' "
#error " [MUST be DEF_DISABLED] "
#error " [ || DEF_ENABLED ] "
#elif ((APP_CFG_SERIAL_EN != DEF_DISABLED) && \
(APP_CFG_SERIAL_EN != DEF_ENABLED ))
#error "APP_CFG_SERIAL_EN illegally #define'd in 'app_cfg.h' "
#error " [MUST be DEF_DISABLED] "
#error " [ || DEF_ENABLED ] "
#elif (APP_CFG_SERIAL_EN == DEF_ENABLED)
#ifndef APP_SERIAL_CFG_TRACE_EN
#error "APP_SERIAL_CFG_TRACE_EN not #define'd in 'app_cfg.h' "
#error " [MUST be DEF_DISABLED] "
#error " [ || DEF_ENABLED ] "
#elif ((APP_SERIAL_CFG_TRACE_EN != DEF_DISABLED) && \
(APP_SERIAL_CFG_TRACE_EN != DEF_ENABLED ))
#error "APP_SERIAL_CFG_TRACE_EN illegally #define'd in 'app_cfg.h' "
#error " [MUST be DEF_DISABLED] "
#error " [ || DEF_ENABLED ] "
#elif (APP_SERIAL_CFG_TRACE_EN == DEF_ENABLED)
#if !defined(APP_SERIAL_CFG_TRACE_PORT_NAME)
#error "APP_SERIAL_CFG_TRACE_PORT_NAME not #define'd in 'app_cfg.h' "
#endif
#endif
#endif
/*
*********************************************************************************************************
* MODULE END
*
* Note(s) : See 'MODULE Note #1'.
*********************************************************************************************************
*/
#endif /* End of APP_SERIAL_MODULE_PRESENT module include ... */
/* ... (see Note #1). */