Path: blob/master/drivers/media/dvb/siano/smsendian.c
15111 views
/****************************************************************12Siano Mobile Silicon, Inc.3MDTV receiver kernel modules.4Copyright (C) 2006-2009, Uri Shkolnik56This program is free software: you can redistribute it and/or modify7it under the terms of the GNU General Public License as published by8the Free Software Foundation, either version 2 of the License, or9(at your option) any later version.1011This program is distributed in the hope that it will be useful,12but WITHOUT ANY WARRANTY; without even the implied warranty of13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14GNU General Public License for more details.1516You should have received a copy of the GNU General Public License17along with this program. If not, see <http://www.gnu.org/licenses/>.1819****************************************************************/2021#include <asm/byteorder.h>2223#include "smsendian.h"24#include "smscoreapi.h"2526void smsendian_handle_tx_message(void *buffer)27{28#ifdef __BIG_ENDIAN29struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer;30int i;31int msgWords;3233switch (msg->xMsgHeader.msgType) {34case MSG_SMS_DATA_DOWNLOAD_REQ:35{36msg->msgData[0] = le32_to_cpu(msg->msgData[0]);37break;38}3940default:41msgWords = (msg->xMsgHeader.msgLength -42sizeof(struct SmsMsgHdr_ST))/4;4344for (i = 0; i < msgWords; i++)45msg->msgData[i] = le32_to_cpu(msg->msgData[i]);4647break;48}49#endif /* __BIG_ENDIAN */50}51EXPORT_SYMBOL_GPL(smsendian_handle_tx_message);5253void smsendian_handle_rx_message(void *buffer)54{55#ifdef __BIG_ENDIAN56struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer;57int i;58int msgWords;5960switch (msg->xMsgHeader.msgType) {61case MSG_SMS_GET_VERSION_EX_RES:62{63struct SmsVersionRes_ST *ver =64(struct SmsVersionRes_ST *) msg;65ver->ChipModel = le16_to_cpu(ver->ChipModel);66break;67}6869case MSG_SMS_DVBT_BDA_DATA:70case MSG_SMS_DAB_CHANNEL:71case MSG_SMS_DATA_MSG:72{73break;74}7576default:77{78msgWords = (msg->xMsgHeader.msgLength -79sizeof(struct SmsMsgHdr_ST))/4;8081for (i = 0; i < msgWords; i++)82msg->msgData[i] = le32_to_cpu(msg->msgData[i]);8384break;85}86}87#endif /* __BIG_ENDIAN */88}89EXPORT_SYMBOL_GPL(smsendian_handle_rx_message);9091void smsendian_handle_message_header(void *msg)92{93#ifdef __BIG_ENDIAN94struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)msg;9596phdr->msgType = le16_to_cpu(phdr->msgType);97phdr->msgLength = le16_to_cpu(phdr->msgLength);98phdr->msgFlags = le16_to_cpu(phdr->msgFlags);99#endif /* __BIG_ENDIAN */100}101EXPORT_SYMBOL_GPL(smsendian_handle_message_header);102103104