This source file includes following definitions.
- as10x_cmd_add_PID_filter
- as10x_cmd_del_PID_filter
- as10x_cmd_start_streaming
- as10x_cmd_stop_streaming
1
2
3
4
5
6
7 #include <linux/kernel.h>
8 #include "as102_drv.h"
9 #include "as10x_cmd.h"
10
11
12
13
14
15
16
17
18 int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
19 struct as10x_ts_filter *filter)
20 {
21 int error;
22 struct as10x_cmd_t *pcmd, *prsp;
23
24 pcmd = adap->cmd;
25 prsp = adap->rsp;
26
27
28 as10x_cmd_build(pcmd, (++adap->cmd_xid),
29 sizeof(pcmd->body.add_pid_filter.req));
30
31
32 pcmd->body.add_pid_filter.req.proc_id =
33 cpu_to_le16(CONTROL_PROC_SETFILTER);
34 pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
35 pcmd->body.add_pid_filter.req.stream_type = filter->type;
36
37 if (filter->idx < 16)
38 pcmd->body.add_pid_filter.req.idx = filter->idx;
39 else
40 pcmd->body.add_pid_filter.req.idx = 0xFF;
41
42
43 if (adap->ops->xfer_cmd) {
44 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
45 sizeof(pcmd->body.add_pid_filter.req)
46 + HEADER_SIZE, (uint8_t *) prsp,
47 sizeof(prsp->body.add_pid_filter.rsp)
48 + HEADER_SIZE);
49 } else {
50 error = AS10X_CMD_ERROR;
51 }
52
53 if (error < 0)
54 goto out;
55
56
57 error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
58
59 if (error == 0) {
60
61 filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
62 }
63
64 out:
65 return error;
66 }
67
68
69
70
71
72
73
74
75 int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
76 uint16_t pid_value)
77 {
78 int error;
79 struct as10x_cmd_t *pcmd, *prsp;
80
81 pcmd = adap->cmd;
82 prsp = adap->rsp;
83
84
85 as10x_cmd_build(pcmd, (++adap->cmd_xid),
86 sizeof(pcmd->body.del_pid_filter.req));
87
88
89 pcmd->body.del_pid_filter.req.proc_id =
90 cpu_to_le16(CONTROL_PROC_REMOVEFILTER);
91 pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value);
92
93
94 if (adap->ops->xfer_cmd) {
95 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
96 sizeof(pcmd->body.del_pid_filter.req)
97 + HEADER_SIZE, (uint8_t *) prsp,
98 sizeof(prsp->body.del_pid_filter.rsp)
99 + HEADER_SIZE);
100 } else {
101 error = AS10X_CMD_ERROR;
102 }
103
104 if (error < 0)
105 goto out;
106
107
108 error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP);
109
110 out:
111 return error;
112 }
113
114
115
116
117
118
119
120 int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap)
121 {
122 int error;
123 struct as10x_cmd_t *pcmd, *prsp;
124
125 pcmd = adap->cmd;
126 prsp = adap->rsp;
127
128
129 as10x_cmd_build(pcmd, (++adap->cmd_xid),
130 sizeof(pcmd->body.start_streaming.req));
131
132
133 pcmd->body.start_streaming.req.proc_id =
134 cpu_to_le16(CONTROL_PROC_START_STREAMING);
135
136
137 if (adap->ops->xfer_cmd) {
138 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
139 sizeof(pcmd->body.start_streaming.req)
140 + HEADER_SIZE, (uint8_t *) prsp,
141 sizeof(prsp->body.start_streaming.rsp)
142 + HEADER_SIZE);
143 } else {
144 error = AS10X_CMD_ERROR;
145 }
146
147 if (error < 0)
148 goto out;
149
150
151 error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP);
152
153 out:
154 return error;
155 }
156
157
158
159
160
161
162
163 int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap)
164 {
165 int8_t error;
166 struct as10x_cmd_t *pcmd, *prsp;
167
168 pcmd = adap->cmd;
169 prsp = adap->rsp;
170
171
172 as10x_cmd_build(pcmd, (++adap->cmd_xid),
173 sizeof(pcmd->body.stop_streaming.req));
174
175
176 pcmd->body.stop_streaming.req.proc_id =
177 cpu_to_le16(CONTROL_PROC_STOP_STREAMING);
178
179
180 if (adap->ops->xfer_cmd) {
181 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
182 sizeof(pcmd->body.stop_streaming.req)
183 + HEADER_SIZE, (uint8_t *) prsp,
184 sizeof(prsp->body.stop_streaming.rsp)
185 + HEADER_SIZE);
186 } else {
187 error = AS10X_CMD_ERROR;
188 }
189
190 if (error < 0)
191 goto out;
192
193
194 error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP);
195
196 out:
197 return error;
198 }