From patchwork Sun Apr 5 08:59:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uri Shkolnik X-Patchwork-Id: 16405 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n358xsGa018890 for ; Sun, 5 Apr 2009 08:59:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755072AbZDEI7y (ORCPT ); Sun, 5 Apr 2009 04:59:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755403AbZDEI7x (ORCPT ); Sun, 5 Apr 2009 04:59:53 -0400 Received: from web110811.mail.gq1.yahoo.com ([67.195.13.234]:38785 "HELO web110811.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755072AbZDEI7x (ORCPT ); Sun, 5 Apr 2009 04:59:53 -0400 Received: (qmail 7294 invoked by uid 60001); 5 Apr 2009 08:59:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1238921991; bh=b3BEB+zaFjXoYdBgsgRUYA7BrdxNldpt6PdrdIsX+r0=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=3MfwlKPqJNe7kKPuGwuXCx9vnrQd9NM4W58iVEJ/r20b084LdDYHEivSPPa8cZepjSOnGxtnDQdcaook/t/kLfuLoUBjSYhSPEvwfpyV2K+L3tBJdKV9IC2SwJgYdFESZMzOX0/lyeXu83bi4mLG5SE+BrRsiKLye411XGa4BaY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=cJjqymcMlrm51r9iqwkUkOPYdMOEykDm86RIaG3gq/Wn4YEK0yc3EcTfUNhpoEGqdTYGEB8WOpfsQonfrENYQJz889CsJZcMiDxm4FxPlaBY7Eqf8HTCSDOfUsLJ3ueSVSvoWchzF+PVYObA0N8XTaSwLKm1HcPOAIyj2p58qKw=; Message-ID: <204559.6386.qm@web110811.mail.gq1.yahoo.com> X-YMail-OSG: udlPUsMVM1lxfsIfGjJ9ix0cafrrDpEiJ6xKcJuc.qwkqXFkdbD3YGOIR5SlZyYXjkhX1lokRSzE.pdhpr503ZEDoXFyMuLIQmQEFmxiA1VM6xN0bAI08BcBmOZDd_DDqUluR44bpgCWYAczXThrnoNbTeNRtbloca9qQi9xSwMggIufG1w6L358V3TEdlN_h6wn02nltsg7nDuKJk2MBLmt7VEHzds9.kb3nS7HM7svUNjQgocluGIN9xGv7aS7MNta9OtUWdYtEXTtqwAp83v.n_KJBygQEIkgwCUk2UOW2Ok.EYQuz_TEzw6E_w0MyhJSBWy2t_XwscGPK1vn7YG2dqe3aMk9fWe87w09cj8IeA-- Received: from [199.203.99.233] by web110811.mail.gq1.yahoo.com via HTTP; Sun, 05 Apr 2009 01:59:50 PDT X-Mailer: YahooMailClassic/5.2.15 YahooMailWebService/0.7.289.1 Date: Sun, 5 Apr 2009 01:59:50 -0700 (PDT) From: Uri Shkolnik Subject: [PATCH] [0904_8] Siano: add messages handling for big-endian target To: LinuxML MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org # HG changeset patch # User Uri Shkolnik # Date 1238696826 -10800 # Node ID e8d224d81e2adde182162ab156aa98725e43f5c0 # Parent 7b5d5a3a7b8e80359e770041ca4c8cf407d893d6 [PATCH] [0904_8] Siano: add messages handling for big-endian target From: Uri Shkolnik Add code that modify the content of Siano's protocol messages when running with big-endian target. Priority: normal Signed-off-by: Uri Shkolnik --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -r 7b5d5a3a7b8e -r e8d224d81e2a linux/drivers/media/dvb/siano/smsendian.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux/drivers/media/dvb/siano/smsendian.c Thu Apr 02 21:27:06 2009 +0300 @@ -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 . + + ****************************************************************/ + +#include + +#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 */ +} + diff -r 7b5d5a3a7b8e -r e8d224d81e2a linux/drivers/media/dvb/siano/smsendian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux/drivers/media/dvb/siano/smsendian.h Thu Apr 02 21:27:06 2009 +0300 @@ -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 . + +****************************************************************/ + +#ifndef __SMS_ENDIAN_H__ +#define __SMS_ENDIAN_H__ + +#include + +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__ */ +