Commit 9cc08121 authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[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: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarPiotr Chmura <chmooreck@poczta.onet.pl>
Signed-off-by: default avatarSylwester Nawrocki <snjw23@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e54d081d
/* /*
* Abilis Systems Single DVB-T Receiver * Abilis Systems Single DVB-T Receiver
* Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
* Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -21,7 +22,8 @@ ...@@ -21,7 +22,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include "as102_drv.h" #include "as102_drv.h"
#elif defined(WIN32) #elif defined(WIN32)
#if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
/* win32 ddk implementation */
#include "wdm.h" #include "wdm.h"
#include "Device.h" #include "Device.h"
#include "endian_mgmt.h" /* FIXME */ #include "endian_mgmt.h" /* FIXME */
...@@ -51,43 +53,42 @@ ...@@ -51,43 +53,42 @@
*/ */
int as10x_cmd_turn_on(as10x_handle_t *phandle) int as10x_cmd_turn_on(as10x_handle_t *phandle)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = phandle->cmd;
prsp = phandle->rsp; prsp = phandle->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); as10x_cmd_build(pcmd, (++phandle->cmd_xid),
sizeof(pcmd->body.turn_on.req));
/* fill command */ /* fill command */
pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
/* send command */ /* send command */
if(phandle->ops->xfer_cmd) { if (phandle->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd( error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
phandle, sizeof(pcmd->body.turn_on.req) +
(uint8_t *) pcmd, HEADER_SIZE,
sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, (uint8_t *) prsp,
(uint8_t *) prsp, sizeof(prsp->body.turn_on.rsp) +
sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); HEADER_SIZE);
} } else {
else{ error = AS10X_CMD_ERROR;
error = AS10X_CMD_ERROR; }
}
if(error < 0) { if (error < 0)
goto out; goto out;
}
/* parse response */ /* parse response */
error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
/** /**
...@@ -98,42 +99,41 @@ int as10x_cmd_turn_on(as10x_handle_t *phandle) ...@@ -98,42 +99,41 @@ int as10x_cmd_turn_on(as10x_handle_t *phandle)
*/ */
int as10x_cmd_turn_off(as10x_handle_t *phandle) int as10x_cmd_turn_off(as10x_handle_t *phandle)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = phandle->cmd;
prsp = phandle->rsp; prsp = phandle->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); as10x_cmd_build(pcmd, (++phandle->cmd_xid),
sizeof(pcmd->body.turn_off.req));
/* fill command */ /* fill command */
pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
/* send command */ /* send command */
if(phandle->ops->xfer_cmd) { if (phandle->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd( error = phandle->ops->xfer_cmd(
phandle, (uint8_t *) pcmd, phandle, (uint8_t *) pcmd,
sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, sizeof(pcmd->body.turn_off.req) + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE);
} } else {
else{ error = AS10X_CMD_ERROR;
error = AS10X_CMD_ERROR; }
}
if(error < 0) { if (error < 0)
goto out; goto out;
}
/* parse response */ /* parse response */
error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP);
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
/** /**
...@@ -145,50 +145,54 @@ int as10x_cmd_turn_off(as10x_handle_t *phandle) ...@@ -145,50 +145,54 @@ int as10x_cmd_turn_off(as10x_handle_t *phandle)
*/ */
int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
{ {
int error; int error;
struct as10x_cmd_t *preq, *prsp; struct as10x_cmd_t *preq, *prsp;
ENTER(); ENTER();
preq = phandle->cmd; preq = phandle->cmd;
prsp = phandle->rsp; prsp = phandle->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); as10x_cmd_build(preq, (++phandle->cmd_xid),
sizeof(preq->body.set_tune.req));
/* fill command */
preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); /* fill command */
preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE);
preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq);
preq->body.set_tune.req.args.hier_select = ptune->hier_select; preq->body.set_tune.req.args.bandwidth = ptune->bandwidth;
preq->body.set_tune.req.args.constellation = ptune->constellation; preq->body.set_tune.req.args.hier_select = ptune->hier_select;
preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; preq->body.set_tune.req.args.constellation = ptune->constellation;
preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; preq->body.set_tune.req.args.hierarchy = ptune->hierarchy;
preq->body.set_tune.req.args.code_rate = ptune->code_rate; preq->body.set_tune.req.args.interleaving_mode =
preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; ptune->interleaving_mode;
preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; preq->body.set_tune.req.args.code_rate = ptune->code_rate;
preq->body.set_tune.req.args.guard_interval = ptune->guard_interval;
/* send command */ preq->body.set_tune.req.args.transmission_mode =
if(phandle->ops->xfer_cmd) { ptune->transmission_mode;
error = phandle->ops->xfer_cmd(phandle,
(uint8_t *) preq, /* send command */
sizeof(preq->body.set_tune.req) + HEADER_SIZE, if (phandle->ops->xfer_cmd) {
(uint8_t *) prsp, error = phandle->ops->xfer_cmd(phandle,
sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); (uint8_t *) preq,
} else{ sizeof(preq->body.set_tune.req)
error = AS10X_CMD_ERROR; + HEADER_SIZE,
} (uint8_t *) prsp,
sizeof(prsp->body.set_tune.rsp)
if(error < 0) { + HEADER_SIZE);
goto out; } else {
} error = AS10X_CMD_ERROR;
}
/* parse response */
error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); if (error < 0)
goto out;
/* parse response */
error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP);
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
/** /**
...@@ -198,57 +202,55 @@ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) ...@@ -198,57 +202,55 @@ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
\return 0 when no error, < 0 in case of error. \return 0 when no error, < 0 in case of error.
\callgraph \callgraph
*/ */
int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
struct as10x_tune_status *pstatus)
{ {
int error; int error;
struct as10x_cmd_t *preq, *prsp; struct as10x_cmd_t *preq, *prsp;
ENTER(); ENTER();
preq = phandle->cmd; preq = phandle->cmd;
prsp = phandle->rsp; prsp = phandle->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(preq,(++phandle->cmd_xid), as10x_cmd_build(preq, (++phandle->cmd_xid),
sizeof(preq->body.get_tune_status.req)); sizeof(preq->body.get_tune_status.req));
/* fill command */ /* fill command */
preq->body.get_tune_status.req.proc_id = preq->body.get_tune_status.req.proc_id =
cpu_to_le16(CONTROL_PROC_GETTUNESTAT); cpu_to_le16(CONTROL_PROC_GETTUNESTAT);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (phandle->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd( error = phandle->ops->xfer_cmd(
phandle, phandle,
(uint8_t *) preq, (uint8_t *) preq,
sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, sizeof(preq->body.get_tune_status.req) + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE);
} } else {
else{ error = AS10X_CMD_ERROR;
error = AS10X_CMD_ERROR; }
}
if (error < 0)
if (error < 0) { goto out;
goto out;
} /* parse response */
error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP);
/* parse response */ if (error < 0)
error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); goto out;
if (error < 0) {
goto out; /* Response OK -> get response data */
} pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state;
pstatus->signal_strength =
/* Response OK -> get response data */ le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength);
pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER);
pstatus->signal_strength = pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER);
le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength);
pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER);
pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER);
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
/** /**
...@@ -260,56 +262,58 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status ...@@ -260,56 +262,58 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status
*/ */
int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
{ {
int error;
int error; struct as10x_cmd_t *pcmd, *prsp;
struct as10x_cmd_t *pcmd, *prsp;
ENTER();
ENTER();
pcmd = phandle->cmd;
pcmd = phandle->cmd; prsp = phandle->rsp;
prsp = phandle->rsp;
/* prepare command */
/* prepare command */ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); sizeof(pcmd->body.get_tps.req));
/* fill command */ /* fill command */
pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); pcmd->body.get_tune_status.req.proc_id =
cpu_to_le16(CONTROL_PROC_GETTPS);
/* send command */
if(phandle->ops->xfer_cmd) { /* send command */
error = phandle->ops->xfer_cmd(phandle, if (phandle->ops->xfer_cmd) {
(uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, error = phandle->ops->xfer_cmd(phandle,
(uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); (uint8_t *) pcmd,
} sizeof(pcmd->body.get_tps.req) +
else{ HEADER_SIZE,
error = AS10X_CMD_ERROR; (uint8_t *) prsp,
} sizeof(prsp->body.get_tps.rsp) +
HEADER_SIZE);
if(error < 0) { } else {
goto out; error = AS10X_CMD_ERROR;
} }
/* parse response */ if (error < 0)
error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); goto out;
if (error < 0) {
goto out; /* parse response */
} error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP);
if (error < 0)
/* Response OK -> get response data */ goto out;
ptps->constellation = prsp->body.get_tps.rsp.tps.constellation;
ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; /* Response OK -> get response data */
ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; ptps->constellation = prsp->body.get_tps.rsp.tps.constellation;
ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy;
ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode;
ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP;
ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP;
ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval;
ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode;
ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP;
ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP;
ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID);
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
/** /**
...@@ -322,59 +326,58 @@ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) ...@@ -322,59 +326,58 @@ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
struct as10x_demod_stats *pdemod_stats) struct as10x_demod_stats *pdemod_stats)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = phandle->cmd;
prsp = phandle->rsp; prsp = phandle->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++phandle->cmd_xid),
sizeof(pcmd->body.get_demod_stats.req)); sizeof(pcmd->body.get_demod_stats.req));
/* fill command */ /* fill command */
pcmd->body.get_demod_stats.req.proc_id = pcmd->body.get_demod_stats.req.proc_id =
cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS);
/* send command */ /* send command */
if(phandle->ops->xfer_cmd) { if (phandle->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = phandle->ops->xfer_cmd(phandle,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, sizeof(pcmd->body.get_demod_stats.req)
(uint8_t *) prsp, + HEADER_SIZE,
sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); (uint8_t *) prsp,
} sizeof(prsp->body.get_demod_stats.rsp)
else{ + HEADER_SIZE);
error = AS10X_CMD_ERROR; } else {
} error = AS10X_CMD_ERROR;
}
if(error < 0) {
goto out; if (error < 0)
} goto out;
/* parse response */ /* parse response */
error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP);
if (error < 0) { if (error < 0)
goto out; goto out;
}
/* Response OK -> get response data */
/* Response OK -> get response data */ pdemod_stats->frame_count =
pdemod_stats->frame_count = le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count);
le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); pdemod_stats->bad_frame_count =
pdemod_stats->bad_frame_count = le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count);
le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); pdemod_stats->bytes_fixed_by_rs =
pdemod_stats->bytes_fixed_by_rs = le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs);
le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); pdemod_stats->mer =
pdemod_stats->mer = le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer);
le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); pdemod_stats->has_started =
pdemod_stats->has_started = prsp->body.get_demod_stats.rsp.stats.has_started;
prsp->body.get_demod_stats.rsp.stats.has_started;
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
/** /**
...@@ -388,50 +391,49 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, ...@@ -388,50 +391,49 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
uint8_t *is_ready) uint8_t *is_ready)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = phandle->cmd;
prsp = phandle->rsp; prsp = phandle->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++phandle->cmd_xid),
sizeof(pcmd->body.get_impulse_rsp.req)); sizeof(pcmd->body.get_impulse_rsp.req));
/* fill command */ /* fill command */
pcmd->body.get_impulse_rsp.req.proc_id = pcmd->body.get_impulse_rsp.req.proc_id =
cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP);
/* send command */ /* send command */
if(phandle->ops->xfer_cmd) { if (phandle->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = phandle->ops->xfer_cmd(phandle,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, sizeof(pcmd->body.get_impulse_rsp.req)
(uint8_t *) prsp, + HEADER_SIZE,
sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); (uint8_t *) prsp,
} sizeof(prsp->body.get_impulse_rsp.rsp)
else{ + HEADER_SIZE);
error = AS10X_CMD_ERROR; } else {
} error = AS10X_CMD_ERROR;
}
if(error < 0) {
goto out; if (error < 0)
} goto out;
/* parse response */ /* parse response */
error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP);
if (error < 0) { if (error < 0)
goto out; goto out;
}
/* Response OK -> get response data */
/* Response OK -> get response data */ *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready;
*is_ready = prsp->body.get_impulse_rsp.rsp.is_ready;
out: out:
LEAVE(); LEAVE();
return(error); return error;
} }
...@@ -447,10 +449,10 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, ...@@ -447,10 +449,10 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
void as10x_cmd_build(struct as10x_cmd_t *pcmd, void as10x_cmd_build(struct as10x_cmd_t *pcmd,
uint16_t xid, uint16_t cmd_len) uint16_t xid, uint16_t cmd_len)
{ {
pcmd->header.req_id = cpu_to_le16(xid); pcmd->header.req_id = cpu_to_le16(xid);
pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID);
pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION);
pcmd->header.data_len = cpu_to_le16(cmd_len); pcmd->header.data_len = cpu_to_le16(cmd_len);
} }
/** /**
...@@ -463,16 +465,17 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, ...@@ -463,16 +465,17 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd,
*/ */
int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
{ {
int error; int error;
/* extract command error code */ /* extract command error code */
error = prsp->body.common.rsp.error; error = prsp->body.common.rsp.error;
if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { if ((error == 0) &&
return 0; (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) {
} return 0;
}
return AS10X_CMD_ERROR; return AS10X_CMD_ERROR;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment