aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/baseband_usb_chr.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/usb/serial/baseband_usb_chr.h
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'drivers/usb/serial/baseband_usb_chr.h')
-rw-r--r--drivers/usb/serial/baseband_usb_chr.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/drivers/usb/serial/baseband_usb_chr.h b/drivers/usb/serial/baseband_usb_chr.h
new file mode 100644
index 00000000000..7935e795a54
--- /dev/null
+++ b/drivers/usb/serial/baseband_usb_chr.h
@@ -0,0 +1,106 @@
1/*
2 * baseband_usb_chr.h
3 *
4 * USB character driver to communicate with baseband modems.
5 *
6 * Copyright (c) 2011, NVIDIA Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __BASEBAND_USB_CHR_H__
24#define __BASEBAND_USB_CHR_H__
25
26#define BASEBAND_USB_CHR_DEV_NAME "baseband_usb_chr"
27#define BASEBAND_USB_CHR_DEV_MAJOR 66
28
29#ifndef USB_CHR_RX_BUFSIZ
30#define USB_CHR_RX_BUFSIZ (128*1024)
31#endif /* USB_CHR_RX_BUFSIZ */
32
33#ifndef USB_CHR_TX_BUFSIZ
34#define USB_CHR_TX_BUFSIZ (128*1024)
35#endif /* USB_CHR_TX_BUFSIZ */
36
37#ifndef USB_CHR_TIMEOUT
38#define USB_CHR_TIMEOUT 5000 /* ms */
39#endif /* USB_CHR_TIMEOUT */
40
41#ifndef BASEBAND_IPC_NUM_RX_BUF
42#define BASEBAND_IPC_NUM_RX_BUF 32
43#endif /* BASEBAND_IPC_NUM_RX_BUF */
44
45#ifndef BASEBAND_IPC_NUM_TX_BUF
46#define BASEBAND_IPC_NUM_TX_BUF 16
47#endif /* BASEBAND_IPC_NUM_TX_BUF */
48
49#ifndef BASEBAND_IPC_BUFSIZ
50#define BASEBAND_IPC_BUFSIZ 65536
51#endif /* BASEBAND_IPC_BUFSIZ */
52
53struct baseband_ipc {
54 /* rx / tx data */
55 struct semaphore buf_sem;
56 struct {
57 /* linked list of data buffers */
58 struct list_head buf;
59 /* wait queue of processes trying to access data buffers */
60 wait_queue_head_t wait;
61 } rx, tx, rx_free, tx_free;
62 unsigned char *ipc_rx;
63 unsigned char *ipc_tx;
64 /* work queue
65 * - queued per ipc transaction
66 * - initiated by either:
67 * = interrupt on gpio line (rx data available)
68 * = tx data packet being added to tx linked list
69 */
70 struct workqueue_struct *workqueue;
71 struct work_struct work;
72 struct work_struct rx_work;
73 struct work_struct tx_work;
74};
75
76struct baseband_ipc_buf {
77 struct list_head list;
78 /* data buffer */
79 unsigned char data[BASEBAND_IPC_BUFSIZ];
80 /* offset of first data byte */
81 size_t offset;
82 /* number of valid data bytes */
83 size_t count;
84};
85
86struct baseband_usb {
87 struct baseband_ipc *ipc;
88 struct {
89 struct usb_driver *driver;
90 struct usb_device *device;
91 struct usb_interface *interface;
92 struct {
93 struct {
94 unsigned int in;
95 unsigned int out;
96 } isoch, bulk, interrupt;
97 } pipe;
98 /* currently active rx urb */
99 struct urb *rx_urb;
100 /* currently active tx urb */
101 struct urb *tx_urb;
102 } usb;
103};
104
105#endif /* __BASEBAND_USB_CHR_H__ */
106