-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.h
74 lines (66 loc) · 1.93 KB
/
debug.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
/*
**
** Some debugging macros by David Gerber <zapek@vapor.com>
**
** Use: DB(("now crashing\n")) or DBD(("now crashing\n"))
** for a printout with 1 second delay
**
** Works with SAS/C and GCC
**
** $Id: debug.h,v 1.2 2003/04/27 03:13:10 zapek Exp $
**
*/
#if (DEBUG==1)
#ifdef __GNUC__ /* GCC */
#define __FUNC__ __FUNCTION__
#define kprintf dprintf
#endif
#ifdef PPC
/*
* Define if PowerUP debug output has to go through
* the internal serial port.
* Otherwise use the magic function to send stuffs too
* sushi (discontinued)
*/
#define PPC_RAW_SERIAL
#ifdef PPC_RAW_SERIAL
#ifdef __cplusplus /* C++ */
extern "C" { void PPCkprintf(const char *, ...); };
#define DB(x) { PPCkprintf(__FILE__ "/[%4ld]" ,__LINE__); PPCkprintf x ; }
#else
extern void PPCkprintf(const char *, ...);
#define DB(x) { PPCkprintf(__FILE__ "[%4ld]/" __FUNC__ "() : ",__LINE__); PPCkprintf x ; }
#endif
#else
#include <exec/types.h>
#include <exec/memory.h>
#include <powerup/ppclib/interface.h>
extern struct ExecBase *SysBase;
extern UWORD execdebug[];
#ifdef __cplusplus /* C++ */
extern "C" { void kprintf( char *cstring, ...); };
#else
extern void kprintf( char *cstring, ...);
#endif
#define DB(x) { kprintf x ; }
#endif /* PPC_RAW_SERIAL */
#else
#ifdef __cplusplus /* C++ */
extern "C" { void kprintf(char *, ...); };
#ifndef MBX
extern "C" { void Delay( long ); };
#endif
#define DB(x) { kprintf(__FILE__ "/[%4ld]" ,__LINE__); kprintf x ; }
#ifndef MBX
#define DBD(x) { Delay(50); kprintf(__FILE__ "/",__LINE__); kprintf x ; }
#endif
#else
extern void kprintf(char *, ...);
#define DB(x) { kprintf(__FILE__ "[%4ld]/" __FUNC__ "() : ",__LINE__); kprintf x ; }
#define DBD(x) { Delay(50); kprintf(__FILE__ "[%4ld]:" __FUNC__ "() : ",__LINE__); kprintf x ; }
#endif
#endif
#else
#define DB(x)
#define DBD(x)
#endif