Netcruzer Library API  V2.03
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
nz_debug.h
Go to the documentation of this file.
1 
89 // Debug - documentation module
161 #ifndef NZ_DEBUG_H
162 #define NZ_DEBUG_H
163 
164 #include "nz_circularBuffer.h"
165 
166 #if !defined(SERPORT_DEBUG_CREATE_OWN_CIRBUFS)
167 #include "nz_serDataPorts.h"
168 #endif
169 
171 //Default Defines
172 
173 #if !defined(DEBUG_LEVEL_OFF)
174 #define DEBUG_LEVEL_OFF 0
175 #endif
176 
177 #if !defined(DEBUG_LEVEL_CRITICAL)
178 #define DEBUG_LEVEL_CRITICAL 1
179 #endif
180 
181 #if !defined(DEBUG_LEVEL_ERROR)
182 #define DEBUG_LEVEL_ERROR 2
183 #endif
184 
185 #if !defined(DEBUG_LEVEL_WARNING)
186 #define DEBUG_LEVEL_WARNING 3
187 #endif
188 
189 #if !defined(DEBUG_LEVEL_INFO)
190 #define DEBUG_LEVEL_INFO 4
191 #endif
192 
193 #if !defined(DEBUG_LEVEL_FINE)
194 #define DEBUG_LEVEL_FINE 5
195 #endif
196 
197 #if !defined(DEBUG_TEMP_BUF_SIZE)
198 #define DEBUG_TEMP_BUF_SIZE 128
199 #endif
200 
207 #if !defined(DEBUG_TXBUF_SIZE)
208 #define DEBUG_TXBUF_SIZE 256
209 #endif
210 
217 #if !defined(DEBUG_RXBUF_SIZE)
218 #define DEBUG_RXBUF_SIZE 32
219 #endif
220 
221 
223 //Defines
224 
225 
227 //Variables
228 
229 extern char debugTempBuf[DEBUG_TEMP_BUF_SIZE];
230 
231 //TX and RX "Circular Buffers". Use SERPORT_DEBUG_CREATE_OWN_CIRBUFS define to use this
232 //module without SERPORTs. If NOT defined, this modules requires nz_serDataPorts.c
233 #if defined(SERPORT_DEBUG_CREATE_OWN_CIRBUFS)
234  #if !defined(CIRBUF_TX_DEBUG)
235  extern CIRBUF cbufTxDebug; //Buffer used for Debug Tx
236  #define CIRBUF_TX_DEBUG (&cbufTxDebug)
237  #endif
238 
239  #if !defined(CIRBUF_RX_DEBUG)
240  extern CIRBUF cbufRxDebug; //Buffer used for Debug Rx
241  #define CIRBUF_RX_DEBUG (&cbufRxDebug)
242  #endif
243 #endif
244 
245 #if !defined(DEBUG_ERROR_FLAGS_DEFINED)
246 typedef union __attribute__((aligned(2), packed)) {
247  WORD val;
248  BYTE v[2];
249  struct {
250  unsigned long bSerPortMemAllocFail:1;
251  unsigned long bCirbufSizeError:1;
252  unsigned long bCirbufPacketFormatError:1;
253  unsigned long bDebugFlagsRes0_3:1;
254  unsigned long bDebugFlagsRes0_4:1;
255  unsigned long bDebugFlagsRes0_5:1;
256  unsigned long bDebugFlagsRes0_6:1;
257  unsigned long bDebugFlagsRes0_7:1;
258 
259  unsigned long bDebugFlagsRes1_0:1;
260  unsigned long bDebugFlagsRes1_1:1;
261  unsigned long bDebugFlagsRes1_2:1;
262  unsigned long bDebugFlagsRes1_3:1;
263  unsigned long bDebugFlagsRes1_4:1;
264  unsigned long bDebugFlagsRes1_5:1;
265  unsigned long bDebugFlagsRes1_6:1;
266  unsigned long bDebugFlagsRes1_7:1;
267  } bits;
269 #endif
270 
277 
278 
279 #if defined(HAS_NZ_DEBUGGING)
280 
289 void debugInit(void);
290 #else
291 #define debugInit()
292 #endif
293 
294 
295 #if defined(HAS_NZ_DEBUGGING)
296 
299 void debugAllInitDone(void);
300 #else
301 #define debugAllInitDone()
302 #endif
303 
304 
305 #if defined(HAS_NZ_DEBUGGING)
306 
309 void debugService(void);
310 #else
311 #define debugService()
312 #endif
313 
314 
315 #if defined(HAS_NZ_DEBUGGING)
316 
322 void debugPutChar(CHAR c);
323 #else
324 #define debugPutChar(c)
325 #endif
326 
327 
328 #if defined(HAS_NZ_DEBUGGING)
329 
336 void debugPutByte(BYTE b);
337 #else
338 #define debugPutByte(b)
339 #endif
340 
341 
342 #if defined(HAS_NZ_DEBUGGING)
343 
350 void debugPutWord(WORD w);
351 #else
352 #define debugPutWord(w)
353 #endif
354 
355 
356 #if defined(HAS_NZ_DEBUGGING)
357 
364 void debugPutArray(const BYTE* pArr, WORD size);
365 #else
366 #define debugPutArray(pArr, size)
367 #endif
368 
369 
370 #if defined(HAS_NZ_DEBUGGING)
371 
377 void debugPutString(const char * str);
378 #else
379 #define debugPutString(str)
380 #endif
381 
382 
383 #if defined(HAS_NZ_DEBUGGING)
384 
389 void debugPutHexByte(BYTE b);
390 #else
391 #define debugPutHexByte(w)
392 #endif
393 
394 
395 #if defined(HAS_NZ_DEBUGGING)
396 
401 void debugPutHexWord(WORD w);
402 #else
403 #define debugPutHexWord(w)
404 #endif
405 
406 
407 
408 #if defined(HAS_NZ_DEBUGGING)
409 
417 void debugPutHexLine(DWORD adr, BYTE* buf, BYTE len);
418 #else
419 #define debugPutHexLine(adr, buf, len)
420 #endif
421 
422 
423 #if defined(HAS_NZ_DEBUGGING)
424 
428 void debugWaitForSpace(BYTE required);
429 #else
430 #define debugWaitForSpace(required)
431 #endif
432 
433 
434 #if defined(HAS_NZ_DEBUGGING)
435 
438 void debugWaitTillAllSent(void);
439 #else
440 #define debugWaitTillAllSent()
441 #endif
442 
443 
444 #if defined(HAS_NZ_DEBUGGING)
445 
449 BOOL debugIsTxBufEmpty(void);
450 #else
451 #define debugIsTxBufEmpty() (1)
452 #endif
453 
461 #if !defined(DEBUG_PUT_STR)
462 #define DEBUG_PUT_STR(lvl, str) {if (MY_DEBUG_LEVEL >= lvl) {debugPutString(str);}}
463 #endif
464 
472 #if !defined(DEBUG_PUT_CHAR)
473 #define DEBUG_PUT_CHAR(lvl, c) {if (MY_DEBUG_LEVEL >= lvl) {debugPutChar(c);}}
474 #endif
475 
484 #if !defined(DEBUG_PUT_BYTE)
485 #define DEBUG_PUT_BYTE(lvl, c) {if (MY_DEBUG_LEVEL >= lvl) {debugPutByte(c);}}
486 #endif
487 
496 #if !defined(DEBUG_PUT_WORD)
497 #define DEBUG_PUT_WORD(lvl, w) {if (MY_DEBUG_LEVEL >= lvl) {debugPutWord(w);}}
498 #endif
499 
509 #if !defined(DEBUG_PUT_HEXBYTE)
510 #define DEBUG_PUT_HEXBYTE(lvl, b) {if (MY_DEBUG_LEVEL >= lvl) {debugPutHexByte(b);}}
511 #endif
512 
522 #if !defined(DEBUG_PUT_HEXWORD)
523 #define DEBUG_PUT_HEXWORD(lvl, w) {if (MY_DEBUG_LEVEL >= lvl) {debugPutHexWord(w);}}
524 #endif
525 
526 
527 #endif
528