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
|
/**
*
* Common data types
*
* <!-- Copyright Giesecke & Devrient GmbH 2009 - 2012 -->
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef COMMON_H
#define COMMON_H
#include "connection.h"
#include "mcinq.h"
void mcapi_insert_connection(
struct connection *connection
);
void mcapi_remove_connection(
uint32_t seq
);
unsigned int mcapi_unique_id(
void
);
#define MC_DAEMON_PID 0xFFFFFFFF
#define MC_DRV_MOD_DEVNODE_FULLPATH "/dev/mobicore"
/* dummy function helper macro. */
#define DUMMY_FUNCTION() do {} while (0)
#define MCDRV_ERROR(txt, ...) \
printk(KERN_ERR "mcKernelApi %s() ### ERROR: " txt, \
__func__, \
##__VA_ARGS__)
#if defined(DEBUG)
/* #define DEBUG_VERBOSE */
#if defined(DEBUG_VERBOSE)
#define MCDRV_DBG_VERBOSE MCDRV_DBG
#else
#define MCDRV_DBG_VERBOSE(...) DUMMY_FUNCTION()
#endif
#define MCDRV_DBG(txt, ...) \
printk(KERN_INFO "mcKernelApi %s(): " txt, \
__func__, \
##__VA_ARGS__)
#define MCDRV_DBG_WARN(txt, ...) \
printk(KERN_WARNING "mcKernelApi %s() WARNING: " txt, \
__func__, \
##__VA_ARGS__)
#define MCDRV_DBG_ERROR(txt, ...) \
printk(KERN_ERR "mcKernelApi %s() ### ERROR: " txt, \
__func__, \
##__VA_ARGS__)
#define MCDRV_ASSERT(cond) \
do { \
if (unlikely(!(cond))) { \
panic("mcKernelApi Assertion failed: %s:%d\n", \
__FILE__, __LINE__); \
} \
} while (0)
#elif defined(NDEBUG)
#define MCDRV_DBG_VERBOSE(...) DUMMY_FUNCTION()
#define MCDRV_DBG(...) DUMMY_FUNCTION()
#define MCDRV_DBG_WARN(...) DUMMY_FUNCTION()
#define MCDRV_DBG_ERROR(...) DUMMY_FUNCTION()
#define MCDRV_ASSERT(...) DUMMY_FUNCTION()
#else
#error "Define DEBUG or NDEBUG"
#endif /* [not] defined(DEBUG_MCMODULE) */
#define LOG_I MCDRV_DBG_VERBOSE
#define LOG_W MCDRV_DBG_WARN
#define LOG_E MCDRV_DBG_ERROR
#define assert(expr) MCDRV_ASSERT(expr)
#endif /* COMMON_H */
/** @} */
|