aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorUri Shkolnik <urishk@yahoo.com>2009-04-20 12:00:52 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 18:14:22 -0400
commitcb17f9047d2c6f248f2f87f4783ca90db7b3f445 (patch)
tree60af67ecc7ca20704817ffdef741e5970cd3c803 /drivers
parentebb6c22e80ccb2889b9c459df36d686d223911f5 (diff)
V4L/DVB (11561): Siano: add messages handling for big-endian target
Add code that modify the content of Siano's protocol messages when running with big-endian target. Signed-off-by: Uri Shkolnik <uris@siano-ms.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/siano/smsendian.c100
-rw-r--r--drivers/media/dvb/siano/smsendian.h32
2 files changed, 132 insertions, 0 deletions
diff --git a/drivers/media/dvb/siano/smsendian.c b/drivers/media/dvb/siano/smsendian.c
new file mode 100644
index 000000000000..d79aa051269a
--- /dev/null
+++ b/drivers/media/dvb/siano/smsendian.c
@@ -0,0 +1,100 @@
1/****************************************************************
2
3 Siano Mobile Silicon, Inc.
4 MDTV receiver kernel modules.
5 Copyright (C) 2006-2009, Uri Shkolnik
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 ****************************************************************/
21
22#include <asm/byteorder.h>
23
24#include "smsendian.h"
25#include "smscoreapi.h"
26
27void smsendian_handle_tx_message(void *buffer)
28{
29#ifdef __BIG_ENDIAN
30 struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer;
31 int i;
32 int msgWords;
33
34 switch (msg->xMsgHeader.msgType) {
35 case MSG_SMS_DATA_DOWNLOAD_REQ:
36 {
37 msg->msgData[0] = le32_to_cpu(msg->msgData[0]);
38 break;
39 }
40
41 default:
42 msgWords = (msg->xMsgHeader.msgLength -
43 sizeof(struct SmsMsgHdr_ST))/4;
44
45 for (i = 0; i < msgWords; i++)
46 msg->msgData[i] = le32_to_cpu(msg->msgData[i]);
47
48 break;
49 }
50#endif /* __BIG_ENDIAN */
51}
52
53void smsendian_handle_rx_message(void *buffer)
54{
55#ifdef __BIG_ENDIAN
56 struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer;
57 int i;
58 int msgWords;
59
60 switch (msg->xMsgHeader.msgType) {
61 case MSG_SMS_GET_VERSION_EX_RES:
62 {
63 struct SmsVersionRes_ST *ver =
64 (struct SmsVersionRes_ST *) msg;
65 ver->ChipModel = le16_to_cpu(ver->ChipModel);
66 break;
67 }
68
69 case MSG_SMS_DVBT_BDA_DATA:
70 case MSG_SMS_DAB_CHANNEL:
71 case MSG_SMS_DATA_MSG:
72 {
73 break;
74 }
75
76 default:
77 {
78 msgWords = (msg->xMsgHeader.msgLength -
79 sizeof(struct SmsMsgHdr_ST))/4;
80
81 for (i = 0; i < msgWords; i++)
82 msg->msgData[i] = le32_to_cpu(msg->msgData[i]);
83
84 break;
85 }
86 }
87#endif /* __BIG_ENDIAN */
88}
89
90void smsendian_handle_message_header(void *msg)
91{
92#ifdef __BIG_ENDIAN
93 struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)msg;
94
95 phdr->msgType = le16_to_cpu(phdr->msgType);
96 phdr->msgLength = le16_to_cpu(phdr->msgLength);
97 phdr->msgFlags = le16_to_cpu(phdr->msgFlags);
98#endif /* __BIG_ENDIAN */
99}
100
diff --git a/drivers/media/dvb/siano/smsendian.h b/drivers/media/dvb/siano/smsendian.h
new file mode 100644
index 000000000000..7fbedc6a6527
--- /dev/null
+++ b/drivers/media/dvb/siano/smsendian.h
@@ -0,0 +1,32 @@
1/****************************************************************
2
3Siano Mobile Silicon, Inc.
4MDTV receiver kernel modules.
5Copyright (C) 2006-2009, Uri Shkolnik
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20****************************************************************/
21
22#ifndef __SMS_ENDIAN_H__
23#define __SMS_ENDIAN_H__
24
25#include <asm/byteorder.h>
26
27void smsendian_handle_tx_message(void *buffer);
28void smsendian_handle_rx_message(void *buffer);
29void smsendian_handle_message_header(void *msg);
30
31#endif /* __SMS_ENDIAN_H__ */
32