aboutsummaryrefslogtreecommitdiff
path: root/include/linux/usb/usbdiag.h
blob: dd277c012d86d35da69add5c45e56fc57b747231 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * Copyright (c) 2008-2010, 2012-2014, The Linux Foundation.
 * All rights reserved.
 *
 * All source code in this file is licensed under the following license except
 * where indicated.
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can find it at http://www.fsf.org
 */

#ifndef _DRIVERS_USB_DIAG_H_
#define _DRIVERS_USB_DIAG_H_

#include <linux/err.h>

/*++ 2014/09/18, USB Team, PCN00002 ++*/
/*DRIVER_DIAG_FUNCTION*/
#define DIAG_ERR(fmt, args...) \
	printk(KERN_ERR "[USBDIAG:ERR] " fmt, ## args)
#define DIAG_WARNING(fmt, args...) \
	printk(KERN_WARNING "[USBDIAG] " fmt, ## args)
#define DIAG_INFO(fmt, args...) \
	printk(KERN_INFO "[USBDIAG] " fmt, ## args)
#define DIAG_DBUG(fmt, args...) \
		do { \
			if (diag7k_debug_mask) \
				printk(KERN_INFO "[USBDIAG] " fmt, ## args); \
			else \
				printk(KERN_DEBUG "[USBDIAG] " fmt, ## args); \
		} while (0)

/*DRIVER_DIAGFWD_FUNCTION*/
#define DIAGFWD_ERR(fmt, args...) \
	printk(KERN_ERR "[DIADFWD:ERR] " fmt, ## args)
#define DIAGFWD_WARNING(fmt, args...) \
	printk(KERN_WARNING "[DIAGFWD] " fmt, ## args)
#define DIAGFWD_INFO(fmt, args...) \
	printk(KERN_INFO "[DIAGFWD] " fmt, ## args)
#define DIAGFWD_DBUG(fmt, args...) \
		do { \
			if (diag7k_debug_mask) \
				printk(KERN_INFO "[USBDIAG] " fmt, ## args); \
			else \
				printk(KERN_DEBUG "[USBDIAG] " fmt, ## args); \
		} while (0)

/* DRIVER_SDLOG_FUNCTION*/
#define SDLOG_ERR(fmt, args...) \
	printk(KERN_ERR "[DIAGSD:ERR] " fmt, ## args)
#define SDLOG_WARNING(fmt, args...) \
	printk(KERN_WARNING "[DIAGSD] " fmt, ## args)
#define SDLOG_INFO(fmt, args...) \
	printk(KERN_INFO "[DIAGSD] " fmt, ## args)
#define SDLOG_DBUG(fmt, args...) \
		do { \
			if (diag7k_debug_mask) \
				printk(KERN_INFO "[DIAGSD] " fmt, ## args); \
			else \
				printk(KERN_DEBUG "[DIAGSD] " fmt, ## args); \
		} while (0)
/*-- 2014/09/18, USB Team, PCN00002 --*/
/*++ 2014/10/17, USB Team, PCN00016 ++*/
/* #define SDQXDM_DEBUG */
#define DIAG_XPST 1
/*-- 2014/10/17, USB Team, PCN00016 --*/
#define DIAG_LEGACY		"diag"
#define DIAG_MDM		"diag_mdm"
#define DIAG_QSC		"diag_qsc"
#define DIAG_MDM2		"diag_mdm2"

#define USB_DIAG_CONNECT	0
#define USB_DIAG_DISCONNECT	1
#define USB_DIAG_WRITE_DONE	2
#define USB_DIAG_READ_DONE	3

struct diag_request {
	char *buf;
	int length;
	int actual;
	int status;
	void *context;
};

struct usb_diag_ch {
	const char *name;
	struct list_head list;
	void (*notify)(void *priv, unsigned event, struct diag_request *d_req);
	void *priv;
	void *priv_usb;
};

#ifdef CONFIG_USB_G_ANDROID
struct usb_diag_ch *usb_diag_open(const char *name, void *priv,
		void (*notify)(void *, unsigned, struct diag_request *));
void usb_diag_close(struct usb_diag_ch *ch);
int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read);
int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req);
int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req);
#else
static inline struct usb_diag_ch *usb_diag_open(const char *name, void *priv,
		void (*notify)(void *, unsigned, struct diag_request *))
{
	return ERR_PTR(-ENODEV);
}
static inline void usb_diag_close(struct usb_diag_ch *ch)
{
}
static inline
int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
{
	return -ENODEV;
}
static inline
int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req)
{
	return -ENODEV;
}
static inline
int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req)
{
	return -ENODEV;
}
#endif /* CONFIG_USB_G_ANDROID */
/*++ 2014/10/17, USB Team, PCN00016 ++*/
int checkcmd_modem_epst(unsigned char *buf);
int modem_to_userspace(void *buf, int r, int cmdtype, int is9k);
extern int sdio_diag_initialized;
extern int smd_diag_initialized;

#endif /* _DRIVERS_USB_DIAG_H_ */
/*-- 2014/10/17, USB Team, PCN00016 --*/