summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/eagle/esp_debug.h
blob: 7f198924e3ac9703ee4416ec0d3a54833fe975a3 (plain)
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
/*
 * Copyright (c) 2011 Espressif System.
 *
 */

#ifndef _DEBUG_H_

#define assert(v) BUG_ON(!(v))

#define ASSERT(v) BUG_ON(!(v))

#include <linux/slab.h>
#include <linux/debugfs.h>
#include <asm/uaccess.h>

typedef enum esp_type {
        ESP_BOOL,
        ESP_U8,
        ESP_U16,
        ESP_U32,
        ESP_U64
} esp_type;

struct dentry *esp_dump_var(const char *name, struct dentry *parent, void *value, esp_type type);

struct dentry *esp_dump_array(const char *name, struct dentry *parent, struct debugfs_blob_wrapper *blob);

struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size);

struct dentry *esp_debugfs_add_sub_dir(const char *name);

int esp_debugfs_init(void);

void esp_debugfs_exit(void);

enum {
        ESP_DBG_ERROR = BIT(0),
        ESP_DBG_TRACE = BIT(1),
        ESP_DBG_LOG = BIT(2),
        ESP_DBG = BIT(3),
        ESP_SHOW = BIT(4),
        ESP_DBG_TXAMPDU = BIT(5),
        ESP_DBG_OP = BIT(6),
	ESP_DBG_PS = BIT(7),
        ESP_DBG_ALL = 0xffffffff
};

extern unsigned int esp_msg_level;

#ifdef ESP_ANDROID_LOGGER
extern bool log_off;
#endif /* ESP_ANDROID_LOGGER */

#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
#include "esp_android.h"
#define esp_dbg(mask, fmt, args...) do {                  \
        if (esp_msg_level & mask)   			  \
	{						  \
		if (log_off)      		          \
			printk(fmt, ##args);              \
		else 					              \
            		logger_write(4, "esp_wifi", fmt, ##args);     \
	}							      \
    } while (0)
#else
#define esp_dbg(mask, fmt, args...) do {                  \
        if (esp_msg_level & mask)                         \
            printk(fmt, ##args);                          \
    } while (0)
#endif /* ANDROID && ESP_ANDROID_LOGGER */

void show_buf(u8 *buf, u32 len);

#ifdef HOST_RC
struct sip_rc_status;
struct ieee80211_tx_rate;

void esp_show_rcstatus(struct sip_rc_status *rcstatus);

void esp_show_tx_rates(struct ieee80211_tx_rate *rates);
#endif /* HOST_RC */

#endif /* _DEBUG_H_ */