pci.c: try a different version of write_flush()
[acx-mac80211.git] / acx_log.h
blob58bf2a96203e624c8186eb1ba52d81452de1d5af
1 #ifndef _ACX_LOG_H_
2 #define _ACX_LOG_H_
4 /*
5 * acx_log.h: logging constants and functions.
7 * Copyright (c) 2008, Francis Galiegue <fgaliegue@gmail.com> for the ACX100
8 * driver project.
10 * This file is licensed under GPL version 2.
14 * For KERN_*, and printk()
16 #include <linux/kernel.h>
19 * The acx_debug.h file defines the log level and default log mask.
21 #include "acx_debug.h"
23 #define ACX_LOG_LEVEL ACX_DEBUG
26 * Helpers to log MAC addresses
29 #define MACSTR "%02X:%02X:%02X:%02X:%02X:%02X"
30 #define MAC(bytevector) \
31 ((unsigned char *)bytevector)[0], \
32 ((unsigned char *)bytevector)[1], \
33 ((unsigned char *)bytevector)[2], \
34 ((unsigned char *)bytevector)[3], \
35 ((unsigned char *)bytevector)[4], \
36 ((unsigned char *)bytevector)[5]
39 * What to log.
41 #define L_LOCK 0x0001 /* Locking */
42 #define L_INIT 0x0002 /* Card initialization */
43 #define L_IRQ 0x0004 /* Interrupt handling */
44 #define L_ASSOC 0x0008 /* Assocation (network join) and station log */
45 #define L_FUNC 0x0010 /* Function enter/leave */
46 #define L_XFER 0x0020 /* TX management */
47 #define L_DATA 0x0040 /* Data transfer */
48 #define L_IOCTL 0x0080 /* Log ioctl calls */
49 #define L_CTL 0x0100 /* Log of low-level ctl commands */
50 #define L_BUFR 0x0200 /* Debug rx buffer mgmt (ring buffer etc.) */
51 #define L_XFER_BEACON 0x0400 /* Also log beacon packets */
52 #define L_BUFT 0x0800 /* Debug tx buffer mgmt (ring buffer etc.) */
53 #define L_USBRXTX 0x1000 /* Debug USB rx/tx operations */
54 #define L_BUF (L_BUFR|L_BUFT)
55 #define L_REALLYVERBOSE 0x2000 /* Flood me, baby! */
56 #define L_ANY 0xffff
59 * Log levels.
61 #define LOG_WARNING 0
62 #define LOG_INFO 1
63 #define LOG_DEBUG 2
65 #define MAX_LOG_LEVEL 2
68 * Function declarations.
70 * The acx_log_dump() function also dumps a buffer taken as an argument.
73 void acx_log(int level, int what, const char *fmt, ...);
74 void acx_log_ratelimited(int level, int what, const char *fmt, ...);
75 void acx_log_dump(int level, int what, const void *buf, ssize_t buflen,
76 const char *fmt, ...);
78 #if ACX_LOG_LEVEL == 2
80 #define __FUNCTION_ENTER 0
81 #define __FUNCTION_EXIT 1
82 #define __FUNCTION_EXIT_WITHARG 2
84 void __function_enter_exit(const char *, int, int);
85 #define FN_ENTER do { \
86 __function_enter_exit(__func__, __FUNCTION_ENTER, 0); \
87 } while (0)
89 #define FN_EXIT0 do { \
90 __function_enter_exit(__func__, __FUNCTION_EXIT, 0); \
91 } while (0)
93 #define FN_EXIT1(retcode) do { \
94 __function_enter_exit(__func__, __FUNCTION_EXIT_WITHARG, retcode); \
95 } while (0)
97 #else
99 #define FN_ENTER do {} while(0)
100 #define FN_EXIT do {} while(0)
101 #define FN_EXIT1(retcode) do {} while(0)
103 #endif /* ACX_LOG_LEVEL == 2 */
105 #endif /* _ACX_LOG_H_ */