xref: /haiku/headers/private/bluetooth/btDebug.h (revision a5a3b2d9a3d95cbae71eaf371708c73a1780ac0d)
1 /*
2  * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3  *
4  * All rights reserved. Distributed under the terms of the MIT License.
5  *
6  */
7 
8 
9 #ifdef BT_DEBUG_THIS_MODULE
10 	#ifndef MODULE_NAME
11 	//#warning MODULE_NAME not defined for Haiku BT debugging tools
12 	#define MODULE_NAME "BT"
13 	#endif
14 
15 	#ifndef SUBMODULE_NAME
16 	//#warning SUBMODULE_NAME not defined for Haiku BT debugging tools
17 	#define SUBMODULE_NAME ""
18 	#endif
19 
20 	#ifndef SUBMODULE_COLOR
21 	//#warning SUBMODULE_COLOR not defined for Haiku BT debugging tools
22 	#define SUBMODULE_COLOR 38
23 	#endif
24 
25 	#define debugf(a,param...) dprintf("\x1b[%dm" MODULE_NAME " " SUBMODULE_NAME " " "%s\x1b[0m: " a,SUBMODULE_COLOR,__FUNCTION__, param);
26 	#define flowf(a) dprintf("\x1b[%dm" MODULE_NAME " " SUBMODULE_NAME " " "%s\x1b[0m: " a,SUBMODULE_COLOR,__FUNCTION__);
27 #else
28 	#define debugf(a,param...)
29 	#define flowf(a,param...)
30 #endif
31 #undef BT_DEBUG_THIS_MODULE
32 
33 #define TOUCH(x) ((void)(x))
34 
35 /* */
36 #if 0
37 #pragma mark - Kernel Auxiliary Stuff -
38 #endif
39 
40 static inline uint32 TEST_AND_SET(uint32 *byte, uint32 bit_mask) {
41 
42 	uint32 val = (*byte&bit_mask)!=0;
43 	*byte |= bit_mask;
44 	return val;
45 }
46 
47 static inline uint32 TEST_AND_CLEAR(uint32* byte, uint32 bit_mask) {
48 
49 	uint32 val = (*byte&bit_mask)!=0;
50 	*byte &= ~bit_mask;
51 	return val;
52 }
53