aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2011-10-31 11:24:42 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 05:43:04 -0400
commit9cc08121f177e9618fe9108b0f5e2fb690d4df33 (patch)
treece0fcc5edb80284200533a2ea3042fa543ede73c
parente54d081dacdcdee7d10c1f87bacce89044519c5c (diff)
[media] staging: as102: Fix CodingStyle errors in file as10x_cmd.c
Fix Linux kernel coding style (whitespace and indentation) errors in file as10x_cmd.c. No functional changes. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Signed-off-by: Sylwester Nawrocki <snjw23@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/staging/media/as102/as10x_cmd.c573
1 files changed, 288 insertions, 285 deletions
diff --git a/drivers/staging/media/as102/as10x_cmd.c b/drivers/staging/media/as102/as10x_cmd.c
index cecb809a51a..222e7032ded 100644
--- a/drivers/staging/media/as102/as10x_cmd.c
+++ b/drivers/staging/media/as102/as10x_cmd.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * Abilis Systems Single DVB-T Receiver 2 * Abilis Systems Single DVB-T Receiver
3 * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> 3 * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
4 * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com>
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -21,7 +22,8 @@
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include "as102_drv.h" 23#include "as102_drv.h"
23#elif defined(WIN32) 24#elif defined(WIN32)
24 #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ 25 #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
26 /* win32 ddk implementation */
25 #include "wdm.h" 27 #include "wdm.h"
26 #include "Device.h" 28 #include "Device.h"
27 #include "endian_mgmt.h" /* FIXME */ 29 #include "endian_mgmt.h" /* FIXME */
@@ -51,43 +53,42 @@
51*/ 53*/
52int as10x_cmd_turn_on(as10x_handle_t *phandle) 54int as10x_cmd_turn_on(as10x_handle_t *phandle)
53{ 55{
54 int error; 56 int error;
55 struct as10x_cmd_t *pcmd, *prsp; 57 struct as10x_cmd_t *pcmd, *prsp;
56 58
57 ENTER(); 59 ENTER();
58 60
59 pcmd = phandle->cmd; 61 pcmd = phandle->cmd;
60 prsp = phandle->rsp; 62 prsp = phandle->rsp;
61 63
62 /* prepare command */ 64 /* prepare command */
63 as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); 65 as10x_cmd_build(pcmd, (++phandle->cmd_xid),
66 sizeof(pcmd->body.turn_on.req));
64 67
65 /* fill command */ 68 /* fill command */
66 pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); 69 pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
67 70
68 /* send command */ 71 /* send command */
69 if(phandle->ops->xfer_cmd) { 72 if (phandle->ops->xfer_cmd) {
70 error = phandle->ops->xfer_cmd( 73 error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
71 phandle, 74 sizeof(pcmd->body.turn_on.req) +
72 (uint8_t *) pcmd, 75 HEADER_SIZE,
73 sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, 76 (uint8_t *) prsp,
74 (uint8_t *) prsp, 77 sizeof(prsp->body.turn_on.rsp) +
75 sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); 78 HEADER_SIZE);
76 } 79 } else {
77 else{ 80 error = AS10X_CMD_ERROR;
78 error = AS10X_CMD_ERROR; 81 }
79 }
80 82
81 if(error < 0) { 83 if (error < 0)
82 goto out; 84 goto out;
83 }
84 85
85 /* parse response */ 86 /* parse response */
86 error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); 87 error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
87 88
88out: 89out:
89 LEAVE(); 90 LEAVE();
90 return(error); 91 return error;
91} 92}
92 93
93/** 94/**
@@ -98,42 +99,41 @@ out:
98*/ 99*/
99int as10x_cmd_turn_off(as10x_handle_t *phandle) 100int as10x_cmd_turn_off(as10x_handle_t *phandle)
100{ 101{
101 int error; 102 int error;
102 struct as10x_cmd_t *pcmd, *prsp; 103 struct as10x_cmd_t *pcmd, *prsp;
103 104
104 ENTER(); 105 ENTER();
105 106
106 pcmd = phandle->cmd; 107 pcmd = phandle->cmd;
107 prsp = phandle->rsp; 108 prsp = phandle->rsp;
108 109
109 /* prepare command */ 110 /* prepare command */
110 as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); 111 as10x_cmd_build(pcmd, (++phandle->cmd_xid),
112 sizeof(pcmd->body.turn_off.req));
111 113
112 /* fill command */ 114 /* fill command */
113 pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); 115 pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
114 116
115 /* send command */ 117 /* send command */
116 if(phandle->ops->xfer_cmd) { 118 if (phandle->ops->xfer_cmd) {
117 error = phandle->ops->xfer_cmd( 119 error = phandle->ops->xfer_cmd(
118 phandle, (uint8_t *) pcmd, 120 phandle, (uint8_t *) pcmd,
119 sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, 121 sizeof(pcmd->body.turn_off.req) + HEADER_SIZE,
120 (uint8_t *) prsp, 122 (uint8_t *) prsp,
121 sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); 123 sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE);
122 } 124 } else {
123 else{ 125 error = AS10X_CMD_ERROR;
124 error = AS10X_CMD_ERROR; 126 }
125 }
126 127
127 if(error < 0) { 128 if (error < 0)
128 goto out; 129 goto out;
129 }
130 130
131 /* parse response */ 131 /* parse response */
132 error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); 132 error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP);
133 133
134out: 134out:
135 LEAVE(); 135 LEAVE();
136 return(error); 136 return error;
137} 137}
138 138
139/** 139/**
@@ -145,50 +145,54 @@ out:
145 */ 145 */
146int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) 146int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
147{ 147{
148 int error; 148 int error;
149 struct as10x_cmd_t *preq, *prsp; 149 struct as10x_cmd_t *preq, *prsp;
150 150
151 ENTER(); 151 ENTER();
152 152
153 preq = phandle->cmd; 153 preq = phandle->cmd;
154 prsp = phandle->rsp; 154 prsp = phandle->rsp;
155 155
156 /* prepare command */ 156 /* prepare command */
157 as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); 157 as10x_cmd_build(preq, (++phandle->cmd_xid),
158 158 sizeof(preq->body.set_tune.req));
159 /* fill command */ 159
160 preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); 160 /* fill command */
161 preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); 161 preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE);
162 preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; 162 preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq);
163 preq->body.set_tune.req.args.hier_select = ptune->hier_select; 163 preq->body.set_tune.req.args.bandwidth = ptune->bandwidth;
164 preq->body.set_tune.req.args.constellation = ptune->constellation; 164 preq->body.set_tune.req.args.hier_select = ptune->hier_select;
165 preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; 165 preq->body.set_tune.req.args.constellation = ptune->constellation;
166 preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; 166 preq->body.set_tune.req.args.hierarchy = ptune->hierarchy;
167 preq->body.set_tune.req.args.code_rate = ptune->code_rate; 167 preq->body.set_tune.req.args.interleaving_mode =
168 preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; 168 ptune->interleaving_mode;
169 preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; 169 preq->body.set_tune.req.args.code_rate = ptune->code_rate;
170 170 preq->body.set_tune.req.args.guard_interval = ptune->guard_interval;
171 /* send command */ 171 preq->body.set_tune.req.args.transmission_mode =
172 if(phandle->ops->xfer_cmd) { 172 ptune->transmission_mode;
173 error = phandle->ops->xfer_cmd(phandle, 173
174 (uint8_t *) preq, 174 /* send command */
175 sizeof(preq->body.set_tune.req) + HEADER_SIZE, 175 if (phandle->ops->xfer_cmd) {
176 (uint8_t *) prsp, 176 error = phandle->ops->xfer_cmd(phandle,
177 sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); 177 (uint8_t *) preq,
178 } else{ 178 sizeof(preq->body.set_tune.req)
179 error = AS10X_CMD_ERROR; 179 + HEADER_SIZE,
180 } 180 (uint8_t *) prsp,
181 181 sizeof(prsp->body.set_tune.rsp)
182 if(error < 0) { 182 + HEADER_SIZE);
183 goto out; 183 } else {
184 } 184 error = AS10X_CMD_ERROR;
185 185 }
186 /* parse response */ 186
187 error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); 187 if (error < 0)
188 goto out;
189
190 /* parse response */
191 error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP);
188 192
189out: 193out:
190 LEAVE(); 194 LEAVE();
191 return(error); 195 return error;
192} 196}
193 197
194/** 198/**
@@ -198,57 +202,55 @@ out:
198 \return 0 when no error, < 0 in case of error. 202 \return 0 when no error, < 0 in case of error.
199 \callgraph 203 \callgraph
200 */ 204 */
201int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) 205int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
206 struct as10x_tune_status *pstatus)
202{ 207{
203 int error; 208 int error;
204 struct as10x_cmd_t *preq, *prsp; 209 struct as10x_cmd_t *preq, *prsp;
205 210
206 ENTER(); 211 ENTER();
207 212
208 preq = phandle->cmd; 213 preq = phandle->cmd;
209 prsp = phandle->rsp; 214 prsp = phandle->rsp;
210 215
211 /* prepare command */ 216 /* prepare command */
212 as10x_cmd_build(preq,(++phandle->cmd_xid), 217 as10x_cmd_build(preq, (++phandle->cmd_xid),
213 sizeof(preq->body.get_tune_status.req)); 218 sizeof(preq->body.get_tune_status.req));
214 219
215 /* fill command */ 220 /* fill command */
216 preq->body.get_tune_status.req.proc_id = 221 preq->body.get_tune_status.req.proc_id =
217 cpu_to_le16(CONTROL_PROC_GETTUNESTAT); 222 cpu_to_le16(CONTROL_PROC_GETTUNESTAT);
218 223
219 /* send command */ 224 /* send command */
220 if (phandle->ops->xfer_cmd) { 225 if (phandle->ops->xfer_cmd) {
221 error = phandle->ops->xfer_cmd( 226 error = phandle->ops->xfer_cmd(
222 phandle, 227 phandle,
223 (uint8_t *) preq, 228 (uint8_t *) preq,
224 sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, 229 sizeof(preq->body.get_tune_status.req) + HEADER_SIZE,
225 (uint8_t *) prsp, 230 (uint8_t *) prsp,
226 sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); 231 sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE);
227 } 232 } else {
228 else{ 233 error = AS10X_CMD_ERROR;
229 error = AS10X_CMD_ERROR; 234 }
230 } 235
231 236 if (error < 0)
232 if (error < 0) { 237 goto out;
233 goto out; 238
234 } 239 /* parse response */
235 240 error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP);
236 /* parse response */ 241 if (error < 0)
237 error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); 242 goto out;
238 if (error < 0) { 243
239 goto out; 244 /* Response OK -> get response data */
240 } 245 pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state;
241 246 pstatus->signal_strength =
242 /* Response OK -> get response data */ 247 le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength);
243 pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; 248 pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER);
244 pstatus->signal_strength = 249 pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER);
245 le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength);
246 pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER);
247 pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER);
248 250
249out: 251out:
250 LEAVE(); 252 LEAVE();
251 return(error); 253 return error;
252} 254}
253 255
254/** 256/**
@@ -260,56 +262,58 @@ out:
260 */ 262 */
261int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) 263int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
262{ 264{
263 265 int error;
264 int error; 266 struct as10x_cmd_t *pcmd, *prsp;
265 struct as10x_cmd_t *pcmd, *prsp; 267
266 268 ENTER();
267 ENTER(); 269
268 270 pcmd = phandle->cmd;
269 pcmd = phandle->cmd; 271 prsp = phandle->rsp;
270 prsp = phandle->rsp; 272
271 273 /* prepare command */
272 /* prepare command */ 274 as10x_cmd_build(pcmd, (++phandle->cmd_xid),
273 as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); 275 sizeof(pcmd->body.get_tps.req));
274 276
275 /* fill command */ 277 /* fill command */
276 pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); 278 pcmd->body.get_tune_status.req.proc_id =
277 279 cpu_to_le16(CONTROL_PROC_GETTPS);
278 /* send command */ 280
279 if(phandle->ops->xfer_cmd) { 281 /* send command */
280 error = phandle->ops->xfer_cmd(phandle, 282 if (phandle->ops->xfer_cmd) {
281 (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, 283 error = phandle->ops->xfer_cmd(phandle,
282 (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); 284 (uint8_t *) pcmd,
283 } 285 sizeof(pcmd->body.get_tps.req) +
284 else{ 286 HEADER_SIZE,
285 error = AS10X_CMD_ERROR; 287 (uint8_t *) prsp,
286 } 288 sizeof(prsp->body.get_tps.rsp) +
287 289 HEADER_SIZE);
288 if(error < 0) { 290 } else {
289 goto out; 291 error = AS10X_CMD_ERROR;
290 } 292 }
291 293
292 /* parse response */ 294 if (error < 0)
293 error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); 295 goto out;
294 if (error < 0) { 296
295 goto out; 297 /* parse response */
296 } 298 error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP);
297 299 if (error < 0)
298 /* Response OK -> get response data */ 300 goto out;
299 ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; 301
300 ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; 302 /* Response OK -> get response data */
301 ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; 303 ptps->constellation = prsp->body.get_tps.rsp.tps.constellation;
302 ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; 304 ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy;
303 ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; 305 ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode;
304 ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; 306 ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP;
305 ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; 307 ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP;
306 ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; 308 ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval;
307 ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; 309 ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode;
308 ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); 310 ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP;
311 ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP;
312 ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID);
309 313
310out: 314out:
311 LEAVE(); 315 LEAVE();
312 return(error); 316 return error;
313} 317}
314 318
315/** 319/**
@@ -322,59 +326,58 @@ out:
322int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, 326int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
323 struct as10x_demod_stats *pdemod_stats) 327 struct as10x_demod_stats *pdemod_stats)
324{ 328{
325 int error; 329 int error;
326 struct as10x_cmd_t *pcmd, *prsp; 330 struct as10x_cmd_t *pcmd, *prsp;
327 331
328 ENTER(); 332 ENTER();
329 333
330 pcmd = phandle->cmd; 334 pcmd = phandle->cmd;
331 prsp = phandle->rsp; 335 prsp = phandle->rsp;
332 336
333 /* prepare command */ 337 /* prepare command */
334 as10x_cmd_build(pcmd, (++phandle->cmd_xid), 338 as10x_cmd_build(pcmd, (++phandle->cmd_xid),
335 sizeof(pcmd->body.get_demod_stats.req)); 339 sizeof(pcmd->body.get_demod_stats.req));
336 340
337 /* fill command */ 341 /* fill command */
338 pcmd->body.get_demod_stats.req.proc_id = 342 pcmd->body.get_demod_stats.req.proc_id =
339 cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); 343 cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS);
340 344
341 /* send command */ 345 /* send command */
342 if(phandle->ops->xfer_cmd) { 346 if (phandle->ops->xfer_cmd) {
343 error = phandle->ops->xfer_cmd(phandle, 347 error = phandle->ops->xfer_cmd(phandle,
344 (uint8_t *) pcmd, 348 (uint8_t *) pcmd,
345 sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, 349 sizeof(pcmd->body.get_demod_stats.req)
346 (uint8_t *) prsp, 350 + HEADER_SIZE,
347 sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); 351 (uint8_t *) prsp,
348 } 352 sizeof(prsp->body.get_demod_stats.rsp)
349 else{ 353 + HEADER_SIZE);
350 error = AS10X_CMD_ERROR; 354 } else {
351 } 355 error = AS10X_CMD_ERROR;
352 356 }
353 if(error < 0) { 357
354 goto out; 358 if (error < 0)
355 } 359 goto out;
356 360
357 /* parse response */ 361 /* parse response */
358 error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); 362 error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP);
359 if (error < 0) { 363 if (error < 0)
360 goto out; 364 goto out;
361 } 365
362 366 /* Response OK -> get response data */
363 /* Response OK -> get response data */ 367 pdemod_stats->frame_count =
364 pdemod_stats->frame_count = 368 le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count);
365 le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); 369 pdemod_stats->bad_frame_count =
366 pdemod_stats->bad_frame_count = 370 le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count);
367 le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); 371 pdemod_stats->bytes_fixed_by_rs =
368 pdemod_stats->bytes_fixed_by_rs = 372 le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs);
369 le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); 373 pdemod_stats->mer =
370 pdemod_stats->mer = 374 le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer);
371 le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); 375 pdemod_stats->has_started =
372 pdemod_stats->has_started = 376 prsp->body.get_demod_stats.rsp.stats.has_started;
373 prsp->body.get_demod_stats.rsp.stats.has_started;
374 377
375out: 378out:
376 LEAVE(); 379 LEAVE();
377 return(error); 380 return error;
378} 381}
379 382
380/** 383/**
@@ -388,50 +391,49 @@ out:
388int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, 391int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
389 uint8_t *is_ready) 392 uint8_t *is_ready)
390{ 393{
391 int error; 394 int error;
392 struct as10x_cmd_t *pcmd, *prsp; 395 struct as10x_cmd_t *pcmd, *prsp;
393 396
394 ENTER(); 397 ENTER();
395 398
396 pcmd = phandle->cmd; 399 pcmd = phandle->cmd;
397 prsp = phandle->rsp; 400 prsp = phandle->rsp;
398 401
399 /* prepare command */ 402 /* prepare command */
400 as10x_cmd_build(pcmd, (++phandle->cmd_xid), 403 as10x_cmd_build(pcmd, (++phandle->cmd_xid),
401 sizeof(pcmd->body.get_impulse_rsp.req)); 404 sizeof(pcmd->body.get_impulse_rsp.req));
402 405
403 /* fill command */ 406 /* fill command */
404 pcmd->body.get_impulse_rsp.req.proc_id = 407 pcmd->body.get_impulse_rsp.req.proc_id =
405 cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); 408 cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP);
406 409
407 /* send command */ 410 /* send command */
408 if(phandle->ops->xfer_cmd) { 411 if (phandle->ops->xfer_cmd) {
409 error = phandle->ops->xfer_cmd(phandle, 412 error = phandle->ops->xfer_cmd(phandle,
410 (uint8_t *) pcmd, 413 (uint8_t *) pcmd,
411 sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, 414 sizeof(pcmd->body.get_impulse_rsp.req)
412 (uint8_t *) prsp, 415 + HEADER_SIZE,
413 sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); 416 (uint8_t *) prsp,
414 } 417 sizeof(prsp->body.get_impulse_rsp.rsp)
415 else{ 418 + HEADER_SIZE);
416 error = AS10X_CMD_ERROR; 419 } else {
417 } 420 error = AS10X_CMD_ERROR;
418 421 }
419 if(error < 0) { 422
420 goto out; 423 if (error < 0)
421 } 424 goto out;
422 425
423 /* parse response */ 426 /* parse response */
424 error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); 427 error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP);
425 if (error < 0) { 428 if (error < 0)
426 goto out; 429 goto out;
427 } 430
428 431 /* Response OK -> get response data */
429 /* Response OK -> get response data */ 432 *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready;
430 *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready;
431 433
432out: 434out:
433 LEAVE(); 435 LEAVE();
434 return(error); 436 return error;
435} 437}
436 438
437 439
@@ -447,10 +449,10 @@ out:
447void as10x_cmd_build(struct as10x_cmd_t *pcmd, 449void as10x_cmd_build(struct as10x_cmd_t *pcmd,
448 uint16_t xid, uint16_t cmd_len) 450 uint16_t xid, uint16_t cmd_len)
449{ 451{
450 pcmd->header.req_id = cpu_to_le16(xid); 452 pcmd->header.req_id = cpu_to_le16(xid);
451 pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); 453 pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID);
452 pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); 454 pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION);
453 pcmd->header.data_len = cpu_to_le16(cmd_len); 455 pcmd->header.data_len = cpu_to_le16(cmd_len);
454} 456}
455 457
456/** 458/**
@@ -463,16 +465,17 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd,
463*/ 465*/
464int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) 466int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
465{ 467{
466 int error; 468 int error;
467 469
468 /* extract command error code */ 470 /* extract command error code */
469 error = prsp->body.common.rsp.error; 471 error = prsp->body.common.rsp.error;
470 472
471 if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { 473 if ((error == 0) &&
472 return 0; 474 (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) {
473 } 475 return 0;
476 }
474 477
475 return AS10X_CMD_ERROR; 478 return AS10X_CMD_ERROR;
476} 479}
477 480
478 481