[0904_8] Siano: add messages handling for big-endian target
PATCH 1/1 [0904_8] Siano: add messages handling for big-endian target
# HG changeset patch
# User Uri Shkolnik <[email protected]>
# Date 1238696826 -10800
# Node ID e8d224d81e2adde182162ab156aa98725e43f5c0
# Parent 7b5d5a3a7b8e80359e770041ca4c8cf407d893d6 [PATCH] [0904_8] Siano: add messages handling for big-endian target
From: Uri Shkolnik <[email protected]>
Add code that modify the content of Siano's protocol messages when running with big-endian target.
Priority: normal
linux/drivers/media/dvb/siano/smsendian.c new file +100 -0
@@ -0,0 +1,100 @@ +/**************************************************************** + +Siano Mobile Silicon, Inc. +MDTV receiver kernel modules. +Copyright (C) 2006-2009, Uri Shkolnik + +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 +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +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. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +****************************************************************/ + +#include <asm/byteorder.h> + +#include "smsendian.h" +#include "smscoreapi.h" + +void smsendian_handle_tx_message (void *buffer) +{ +#ifdef __BIG_ENDIAN +struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer; +int i; +int msgWords; + +switch (msg->xMsgHeader.msgType) { +case MSG_SMS_DATA_DOWNLOAD_REQ : + { + msg->msgData[0 ] =le32_to_cpu (msg->msgData[0 ]); +break ; + } + +default : + msgWords = (msg->xMsgHeader.msgLength - +sizeof (struct SmsMsgHdr_ST ))/4 ; + +for (i =0 ; i < msgWords; i++) + msg->msgData[i] =le32_to_cpu (msg->msgData[i]); + +break ; + } +#endif /* __BIG_ENDIAN */ +} + +void smsendian_handle_rx_message (void *buffer) +{ +#ifdef __BIG_ENDIAN +struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer; +int i; +int msgWords; + +switch (msg->xMsgHeader.msgType) { +case MSG_SMS_GET_VERSION_EX_RES : + { +struct SmsVersionRes_ST *ver = + (struct SmsVersionRes_ST *) msg; + ver->ChipModel =le16_to_cpu (ver->ChipModel); +break ; + } + +case MSG_SMS_DVBT_BDA_DATA : +case MSG_SMS_DAB_CHANNEL : +case MSG_SMS_DATA_MSG : + { +break ; + } + +default : + { + msgWords = (msg->xMsgHeader.msgLength - +sizeof (struct SmsMsgHdr_ST ))/4 ; + +for (i =0 ; i < msgWords; i++) + msg->msgData[i] =le32_to_cpu (msg->msgData[i]); + +break ; + } + } +#endif /* __BIG_ENDIAN */ +} + +void smsendian_handle_message_header (void *msg) +{ +#ifdef __BIG_ENDIAN +struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)msg; + + phdr->msgType =le16_to_cpu (phdr->msgType); + phdr->msgLength =le16_to_cpu (phdr->msgLength); + phdr->msgFlags =le16_to_cpu (phdr->msgFlags); +#endif /* __BIG_ENDIAN */ +} +
linux/drivers/media/dvb/siano/smsendian.h new file +32 -0
@@ -0,0 +1,32 @@ +/**************************************************************** + +Siano Mobile Silicon, Inc. +MDTV receiver kernel modules. +Copyright (C) 2006-2009, Uri Shkolnik + +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 +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +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. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +****************************************************************/ + +#ifndef __SMS_ENDIAN_H__ +#define __SMS_ENDIAN_H__ + +#include <asm/byteorder.h> + +void smsendian_handle_tx_message (void *buffer); +void smsendian_handle_rx_message (void *buffer); +void smsendian_handle_message_header (void *msg); + +#endif /* __SMS_ENDIAN_H__ */ +
Quoted 3 lines · On Sun, 5 Apr 2009 01:59:50 -0700 (PDT) Uri Shkolnik <[email protected]> wrote:
Add code that modify the content of Siano's protocol messages when running with big-endian target.
Maybe due to one of the other patches that weren't applied, but this one didn't compile:
/home/v4l/master/v4l/smsdvb.c:49: error: field 'sms_stat_dvb' has incomplete type /home/v4l/master/v4l/smsdvb.c: In function 'smsdvb_onresponse':/home/v4l/master/v4l/smsdvb.c:95: error: invalid application of 'sizeof' to incomplete type 'struct TRANSMISSION_STATISTICS_S' /home/v4l/master/v4l/smsdvb.c:95: error: invalid application of 'sizeof' to incomplete type 'struct TRANSMISSION_STATISTICS_S' /home/v4l/master/v4l/smsdvb.c:101: error: implicit declaration of function 'CORRECT_STAT_BANDWIDTH' /home/v4l/master/v4l/smsdvb.c:102: error: implicit declaration of function 'CORRECT_STAT_TRANSMISSON_MODE' /home/v4l/master/v4l/smsdvb.c:109: error: storage size of 'SignalStatusData' isn't known /home/v4l/master/v4l/smsdvb.c:125: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:126: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:127: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:128: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:129: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:130: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:131: error: implicit declaration of function 'CORRECT_STAT_RSSI' /home/v4l/master/v4l/smsdvb.c:133: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:134: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:135: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:136: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:141: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:145: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:148: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:149: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:151: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:152: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:153: error: dereferencing pointer to incomplete type /home/v4l/master/v4l/smsdvb.c:109: warning: unused variable 'SignalStatusData'
make[3]: *** [/home/v4l/master/v4l/smsdvb.o] Error 1
Cheers,
Mauro
Quoted 8 lines · On Mon, 20 Apr 2009 12:48:39 -0300 Mauro Carvalho Chehab…
Quoted 3 lines · On Sun, 5 Apr 2009 01:59:50 -0700 (PDT) Uri Shkolnik <[email protected]> wrote:
Add code that modify the content of Siano's protocol messages when running with big-endian target.
Maybe due to one of the other patches that weren't applied, but this one didn't compile:
Sorry, my fault. This is some trash from a previous patch that got rejected. Patch added, thanks.
Cheers,
Mauro