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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
/* include/linux/smux.h
*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/
#ifndef SMUX_H
#define SMUX_H
enum {
SMUX_DATA_0,
SMUX_DATA_1,
SMUX_DATA_2,
SMUX_DATA_3,
SMUX_DATA_4,
SMUX_DATA_5,
SMUX_DATA_6,
SMUX_DATA_7,
SMUX_DATA_8,
SMUX_DATA_9,
SMUX_USB_RMNET_DATA_0,
SMUX_USB_DUN_0,
SMUX_USB_DIAG_0,
SMUX_SYS_MONITOR_0,
SMUX_CSVT_0,
SMUX_DATA_CTL_0 = 32,
SMUX_DATA_CTL_1,
SMUX_DATA_CTL_2,
SMUX_DATA_CTL_3,
SMUX_DATA_CTL_4,
SMUX_DATA_CTL_5,
SMUX_DATA_CTL_6,
SMUX_DATA_CTL_7,
SMUX_DATA_CTL_8,
SMUX_DATA_CTL_9,
SMUX_USB_RMNET_CTL_0,
SMUX_USB_DUN_CTL_0_UNUSED,
SMUX_USB_DIAG_CTL_0,
SMUX_SYS_MONITOR_CTL_0,
SMUX_CSVT_CTL_0,
SMUX_TEST_LCID,
SMUX_NUM_LOGICAL_CHANNELS,
};
enum {
SMUX_CONNECTED,
SMUX_DISCONNECTED,
SMUX_READ_DONE,
SMUX_READ_FAIL,
SMUX_WRITE_DONE,
SMUX_WRITE_FAIL,
SMUX_TIOCM_UPDATE,
SMUX_LOW_WM_HIT,
SMUX_HIGH_WM_HIT,
SMUX_RX_RETRY_HIGH_WM_HIT,
SMUX_RX_RETRY_LOW_WM_HIT,
};
enum {
SMUX_CH_OPTION_LOCAL_LOOPBACK = 1 << 0,
SMUX_CH_OPTION_REMOTE_LOOPBACK = 1 << 1,
SMUX_CH_OPTION_REMOTE_TX_STOP = 1 << 2,
SMUX_CH_OPTION_AUTO_REMOTE_TX_STOP = 1 << 3,
};
struct smux_meta_disconnected {
int is_ssr;
};
struct smux_meta_read {
void *pkt_priv;
void *buffer;
int len;
};
struct smux_meta_write {
void *pkt_priv;
void *buffer;
int len;
};
struct smux_meta_tiocm {
uint32_t tiocm_old;
uint32_t tiocm_new;
};
#ifdef CONFIG_N_SMUX
int msm_smux_open(uint8_t lcid, void *priv,
void (*notify)(void *priv, int event_type, const void *metadata),
int (*get_rx_buffer)(void *priv, void **pkt_priv,
void **buffer, int size));
int msm_smux_close(uint8_t lcid);
/**
* Write data to a logical channel.
*
* @lcid Logical channel ID
* @pkt_priv Client data that will be returned with the SMUX_WRITE_DONE or
* SMUX_WRITE_FAIL notification.
* @data Data to write
* @len Length of @data
*
* @returns 0 for success, <0 otherwise
*
* Data may be written immediately after msm_smux_open() is called, but
* the data will wait in the transmit queue until the channel has been
* fully opened.
*
* Once the data has been written, the client will receive either a completion
* (SMUX_WRITE_DONE) or a failure notice (SMUX_WRITE_FAIL).
*/
int msm_smux_write(uint8_t lcid, void *pkt_priv, const void *data, int len);
int msm_smux_is_ch_full(uint8_t lcid);
int msm_smux_is_ch_low(uint8_t lcid);
long msm_smux_tiocm_get(uint8_t lcid);
int msm_smux_tiocm_set(uint8_t lcid, uint32_t set, uint32_t clear);
int msm_smux_set_ch_option(uint8_t lcid, uint32_t set, uint32_t clear);
#else
static inline int msm_smux_open(uint8_t lcid, void *priv,
void (*notify)(void *priv, int event_type, const void *metadata),
int (*get_rx_buffer)(void *priv, void **pkt_priv,
void **buffer, int size))
{
return -ENODEV;
}
static inline int msm_smux_close(uint8_t lcid)
{
return -ENODEV;
}
static inline int msm_smux_write(uint8_t lcid, void *pkt_priv,
const void *data, int len)
{
return -ENODEV;
}
static inline int msm_smux_is_ch_full(uint8_t lcid)
{
return -ENODEV;
}
static inline int msm_smux_is_ch_low(uint8_t lcid)
{
return -ENODEV;
}
static inline long msm_smux_tiocm_get(uint8_t lcid)
{
return 0;
}
static inline int msm_smux_tiocm_set(uint8_t lcid, uint32_t set, uint32_t clear)
{
return -ENODEV;
}
static inline int msm_smux_set_ch_option(uint8_t lcid, uint32_t set,
uint32_t clear)
{
return -ENODEV;
}
#endif
#endif
|