From: Uri Shkolnik <urishk@yahoo.com>
To: Linux-dvb <linux-dvb@linuxtv.org>
Subject: [linux-dvb] [PATCH 5/5] Siano's SMS core system upgrade
Date: Wed, 19 Nov 2008 01:03:13 -0800 (PST) [thread overview]
Message-ID: <804196.56504.qm@web38803.mail.mud.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
This patch provides the following:
A) Support for firmware download for kernel versions < 2.6.10
B) SPI and SDIO interface driver registration
C) DVB-API v5 (S2) and Siano's subsystem registration
D) Indentation
Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: smscore_patch.diff --]
[-- Type: text/x-diff; name="smscore_patch.diff", Size: 55016 bytes --]
This patch provides the following:
A) Support for firmware download for kernel versions < 2.6.10
B) SPI and SDIO interface driver registration
C) DVB-API v5 (S2) and Siano's subsystem registration
D) Indentation
Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
diff -uNr v4l-dvb-c5f976cab011/linux/drivers/media/dvb/siano/smscoreapi.c v4l-dvb-c5f976cab011_0003/linux/drivers/media/dvb/siano/smscoreapi.c
--- v4l-dvb-c5f976cab011/linux/drivers/media/dvb/siano/smscoreapi.c 2008-11-16 15:40:21.000000000 +0200
+++ v4l-dvb-c5f976cab011_0003/linux/drivers/media/dvb/siano/smscoreapi.c 2008-11-19 10:29:50.000000000 +0200
@@ -1,25 +1,23 @@
-/*
- * Siano core API module
- *
- * This file contains implementation for the interface to sms core component
- *
- * author: Anatoly Greenblat
- *
- * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+/****************************************************************
+
+Siano Mobile Silicon, Inc.
+MDTV receiver kernel modules.
+Copyright (C) 2006-2008, 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 <linux/kernel.h>
#include <linux/init.h>
@@ -28,12 +26,19 @@
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/io.h>
+#include <linux/uaccess.h>
#include <linux/firmware.h>
#include "smscoreapi.h"
#include "sms-cards.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
+#define REQUEST_FIRMWARE_SUPPORTED
+#else
+#define DEFAULT_FW_FILE_PATH "/lib/firmware"
+#endif
+
int sms_debug;
module_param_named(debug, sms_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
@@ -45,17 +50,17 @@
struct smscore_idlist_t {
struct list_head entry;
- int id;
- int data_type;
+ int id;
+ int data_type;
};
struct smscore_client_t {
struct list_head entry;
struct smscore_device_t *coredev;
- void *context;
- struct list_head idlist;
- onresponse_t onresponse_handler;
- onremove_t onremove_handler;
+ void *context;
+ struct list_head idlist;
+ onresponse_t onresponse_handler;
+ onremove_t onremove_handler;
};
struct smscore_device_t {
@@ -63,34 +68,37 @@
struct list_head clients;
struct list_head subclients;
- spinlock_t clientslock;
+ spinlock_t clientslock;
struct list_head buffers;
- spinlock_t bufferslock;
- int num_buffers;
+ spinlock_t bufferslock;
+ int num_buffers;
- void *common_buffer;
- int common_buffer_size;
- dma_addr_t common_buffer_phys;
-
- void *context;
- struct device *device;
-
- char devpath[32];
- unsigned long device_flags;
-
- setmode_t setmode_handler;
- detectmode_t detectmode_handler;
- sendrequest_t sendrequest_handler;
- preload_t preload_handler;
- postload_t postload_handler;
+ void *common_buffer;
+ int common_buffer_size;
+ dma_addr_t common_buffer_phys;
+
+ void *context;
+ struct device *device;
+
+ char devpath[32];
+ unsigned long device_flags;
+
+ setmode_t setmode_handler;
+ detectmode_t detectmode_handler;
+ sendrequest_t sendrequest_handler;
+ preload_t preload_handler;
+ postload_t postload_handler;
- int mode, modes_supported;
+ int mode, modes_supported;
struct completion version_ex_done, data_download_done, trigger_done;
struct completion init_device_done, reload_start_done, resume_done;
int board_id;
+
+ u8 *fw_buf;
+ u32 fw_buf_size;
};
void smscore_set_board_id(struct smscore_device_t *core, int id)
@@ -105,9 +113,9 @@
struct smscore_registry_entry_t {
struct list_head entry;
- char devpath[32];
- int mode;
- enum sms_device_type_st type;
+ char devpath[32];
+ int mode;
+ enum sms_device_type_st type;
};
static struct list_head g_smscore_notifyees;
@@ -129,17 +137,15 @@
kmutex_lock(&g_smscore_registrylock);
for (next = g_smscore_registry.next;
- next != &g_smscore_registry;
- next = next->next) {
- entry = (struct smscore_registry_entry_t *) next;
+ next != &g_smscore_registry; next = next->next) {
+ entry = (struct smscore_registry_entry_t *)next;
if (!strcmp(entry->devpath, devpath)) {
kmutex_unlock(&g_smscore_registrylock);
return entry;
}
}
entry = (struct smscore_registry_entry_t *)
- kmalloc(sizeof(struct smscore_registry_entry_t),
- GFP_KERNEL);
+ kmalloc(sizeof(struct smscore_registry_entry_t), GFP_KERNEL);
if (entry) {
entry->mode = default_mode;
strcpy(entry->devpath, devpath);
@@ -199,7 +205,6 @@
sms_err("No registry found.");
}
-
static void list_add_locked(struct list_head *new, struct list_head *head,
spinlock_t *lock)
{
@@ -234,10 +239,9 @@
/* now notify callback about existing devices */
first = &g_smscore_devices;
for (next = first->next;
- next != first && !rc;
- next = next->next) {
+ next != first && !rc; next = next->next) {
struct smscore_device_t *coredev =
- (struct smscore_device_t *) next;
+ (struct smscore_device_t *)next;
rc = hotplug(coredev, coredev->device, 1);
}
@@ -270,7 +274,7 @@
for (next = first->next; next != first;) {
struct smscore_device_notifyee_t *notifyee =
- (struct smscore_device_notifyee_t *) next;
+ (struct smscore_device_notifyee_t *)next;
next = next->next;
if (notifyee->hotplug == hotplug) {
@@ -288,7 +292,7 @@
/* the client must call smscore_unregister_client from remove handler */
while (!list_empty(&coredev->clients)) {
- client = (struct smscore_client_t *) coredev->clients.next;
+ client = (struct smscore_client_t *)coredev->clients.next;
client->onremove_handler(client->context);
}
}
@@ -304,8 +308,8 @@
first = &g_smscore_notifyees;
for (next = first->next; next != first; next = next->next) {
- rc = ((struct smscore_device_notifyee_t *) next)->
- hotplug(coredev, device, arrival);
+ rc = ((struct smscore_device_notifyee_t *)next)->
+ hotplug(coredev, device, arrival);
if (rc < 0)
break;
}
@@ -318,7 +322,7 @@
dma_addr_t common_buffer_phys)
{
struct smscore_buffer_t *cb =
- kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
+ kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
if (!cb) {
sms_info("kmalloc(...) failed");
return NULL;
@@ -387,8 +391,8 @@
dev->num_buffers < params->num_buffers;
dev->num_buffers++, buffer += params->buffer_size) {
struct smscore_buffer_t *cb =
- smscore_createbuffer(buffer, dev->common_buffer,
- dev->common_buffer_phys);
+ smscore_createbuffer(buffer, dev->common_buffer,
+ dev->common_buffer_phys);
if (!cb) {
smscore_unregister_device(dev);
return -ENOMEM;
@@ -435,12 +439,17 @@
*/
int smscore_start_device(struct smscore_device_t *coredev)
{
- int rc = smscore_set_device_mode(
- coredev, smscore_registry_getmode(coredev->devpath));
+ int rc;
+
+#ifdef REQUEST_FIRMWARE_SUPPORTED
+ rc = smscore_set_device_mode(coredev,
+ smscore_registry_getmode(coredev->
+ devpath));
if (rc < 0) {
sms_info("set device mode faile , rc %d", rc);
return rc;
}
+#endif
kmutex_lock(&g_smscore_deviceslock);
@@ -465,13 +474,13 @@
return wait_for_completion_timeout(completion,
msecs_to_jiffies(10000)) ?
- 0 : -ETIME;
+ 0 : -ETIME;
}
static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
void *buffer, size_t size)
{
- struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer;
+ struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *)buffer;
struct SmsMsgHdr_ST *msg;
u32 mem_address = firmware->StartAddress;
u8 *payload = firmware->Payload;
@@ -502,26 +511,28 @@
while (size && rc >= 0) {
struct SmsDataDownload_ST *DataMsg =
- (struct SmsDataDownload_ST *) msg;
- int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE);
+ (struct SmsDataDownload_ST *)msg;
+ int payload_size = min((int)size, SMS_MAX_PAYLOAD_SIZE);
SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ,
- (u16)(sizeof(struct SmsMsgHdr_ST) +
- sizeof(u32) + payload_size));
+ (u16) (sizeof(struct SmsMsgHdr_ST) +
+ sizeof(u32) + payload_size));
DataMsg->MemAddr = mem_address;
memcpy(DataMsg->Payload, payload, payload_size);
if ((coredev->device_flags & SMS_ROM_NO_RESPONSE) &&
(coredev->mode == DEVICE_MODE_NONE))
- rc = coredev->sendrequest_handler(
- coredev->context, DataMsg,
- DataMsg->xMsgHeader.msgLength);
+ rc = coredev->sendrequest_handler(coredev->context,
+ DataMsg,
+ DataMsg->xMsgHeader.
+ msgLength);
else
- rc = smscore_sendrequest_and_wait(
- coredev, DataMsg,
- DataMsg->xMsgHeader.msgLength,
- &coredev->data_download_done);
+ rc = smscore_sendrequest_and_wait(coredev, DataMsg,
+ DataMsg->xMsgHeader.
+ msgLength,
+ &coredev->
+ data_download_done);
payload += payload_size;
size -= payload_size;
@@ -531,29 +542,35 @@
if (rc >= 0) {
if (coredev->mode == DEVICE_MODE_NONE) {
struct SmsMsgData_ST *TriggerMsg =
- (struct SmsMsgData_ST *) msg;
+ (struct SmsMsgData_ST *)msg;
SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ,
sizeof(struct SmsMsgHdr_ST) +
sizeof(u32) * 5);
TriggerMsg->msgData[0] = firmware->StartAddress;
- /* Entry point */
- TriggerMsg->msgData[1] = 5; /* Priority */
- TriggerMsg->msgData[2] = 0x200; /* Stack size */
- TriggerMsg->msgData[3] = 0; /* Parameter */
- TriggerMsg->msgData[4] = 4; /* Task ID */
+ /* Entry point */
+ TriggerMsg->msgData[1] = 5; /* Priority */
+ TriggerMsg->msgData[2] = 0x200; /* Stack size */
+ TriggerMsg->msgData[3] = 0; /* Parameter */
+ TriggerMsg->msgData[4] = 4; /* Task ID */
if (coredev->device_flags & SMS_ROM_NO_RESPONSE) {
- rc = coredev->sendrequest_handler(
- coredev->context, TriggerMsg,
- TriggerMsg->xMsgHeader.msgLength);
+ rc = coredev->sendrequest_handler(coredev->
+ context,
+ TriggerMsg,
+ TriggerMsg->
+ xMsgHeader.
+ msgLength);
msleep(100);
} else
- rc = smscore_sendrequest_and_wait(
- coredev, TriggerMsg,
- TriggerMsg->xMsgHeader.msgLength,
- &coredev->trigger_done);
+ rc = smscore_sendrequest_and_wait(coredev,
+ TriggerMsg,
+ TriggerMsg->
+ xMsgHeader.
+ msgLength,
+ &coredev->
+ trigger_done);
} else {
SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ,
sizeof(struct SmsMsgHdr_ST));
@@ -564,14 +581,12 @@
msleep(500);
}
- sms_debug("rc=%d, postload=%p ", rc,
- coredev->postload_handler);
+ sms_debug("rc=%d, postload=%p ", rc, coredev->postload_handler);
kfree(msg);
return ((rc >= 0) && coredev->postload_handler) ?
- coredev->postload_handler(coredev->context) :
- rc;
+ coredev->postload_handler(coredev->context) : rc;
}
/**
@@ -589,8 +604,11 @@
loadfirmware_t loadfirmware_handler)
{
int rc = -ENOENT;
+ u8 *fw_buf;
+ u32 fw_buf_size;
+
+#ifdef REQUEST_FIRMWARE_SUPPORTED
const struct firmware *fw;
- u8 *fw_buffer;
if (loadfirmware_handler == NULL && !(coredev->device_flags &
SMS_DEVICE_FAMILY2))
@@ -601,27 +619,38 @@
sms_info("failed to open \"%s\"", filename);
return rc;
}
- sms_info("read FW %s, size=%zd", filename, fw->size);
- fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT),
- GFP_KERNEL | GFP_DMA);
- if (fw_buffer) {
- memcpy(fw_buffer, fw->data, fw->size);
-
- rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ?
- smscore_load_firmware_family2(coredev,
- fw_buffer,
- fw->size) :
- loadfirmware_handler(coredev->context,
- fw_buffer, fw->size);
-
- kfree(fw_buffer);
- } else {
+ sms_info("read FW %s, size=%d", filename, fw->size);
+ fw_buf = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT),
+ GFP_KERNEL | GFP_DMA);
+ if (!fw_buf) {
sms_info("failed to allocate firmware buffer");
- rc = -ENOMEM;
+ return -ENOMEM;
+ }
+ memcpy(fw_buf, fw->data, fw->size);
+ fw_buf_size = fw->size;
+#else
+ if (!coredev->fw_buf) {
+ sms_info("missing fw file buffer");
+ return -EINVAL;
}
+ fw_buf = coredev->fw_buf;
+ fw_buf_size = coredev->fw_buf_size;
+#endif
- release_firmware(fw);
+ rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ?
+ smscore_load_firmware_family2(coredev,
+ fw_buf,
+ fw_buf_size) :
+ loadfirmware_handler(coredev->context, fw_buf, fw_buf_size);
+
+ kfree(fw_buf);
+#ifdef REQUEST_FIRMWARE_SUPPORTED
+ release_firmware(fw);
+#else
+ coredev->fw_buf = NULL;
+ coredev->fw_buf_size = 0;
+#endif
return rc;
}
@@ -673,6 +702,9 @@
coredev->common_buffer,
coredev->common_buffer_phys);
+ if (coredev->fw_buf != NULL)
+ kfree(coredev->fw_buf);
+
list_del(&coredev->entry);
kfree(coredev);
@@ -686,7 +718,7 @@
void *buffer = kmalloc(sizeof(struct SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT,
GFP_KERNEL | GFP_DMA);
struct SmsMsgHdr_ST *msg =
- (struct SmsMsgHdr_ST *) SMS_ALIGN_ADDRESS(buffer);
+ (struct SmsMsgHdr_ST *)SMS_ALIGN_ADDRESS(buffer);
int rc;
if (!buffer)
@@ -702,9 +734,10 @@
if (wait_for_completion_timeout(&coredev->resume_done,
msecs_to_jiffies(5000))) {
- rc = smscore_sendrequest_and_wait(
- coredev, msg, msg->msgLength,
- &coredev->version_ex_done);
+ rc = smscore_sendrequest_and_wait(coredev, msg,
+ msg->msgLength,
+ &coredev->
+ version_ex_done);
if (rc < 0)
sms_err("MSG_SMS_GET_VERSION_EX_REQ failed "
"second try, rc %d", rc);
@@ -718,23 +751,21 @@
}
static char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = {
- /*Stellar NOVA A0 Nova B0 VEGA*/
- /*DVBT*/
- {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"},
- /*DVBH*/
- {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"},
- /*TDMB*/
- {"none", "tdmb_nova_12mhz.inp", "none", "none"},
- /*DABIP*/
- {"none", "none", "none", "none"},
- /*BDA*/
- {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"},
- /*ISDBT*/
- {"none", "isdbt_nova_12mhz.inp", "dvb_nova_12mhz.inp", "none"},
- /*ISDBTBDA*/
- {"none", "isdbt_nova_12mhz.inp", "isdbt_nova_12mhz_b0.inp", "none"},
- /*CMMB*/
- {"none", "none", "none", "cmmb_vega_12mhz.inp"}
+ /*Stellar NOVA A0 Nova B0 VEGA */
+ /*DVBT*/
+ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"},
+ /*DVBH*/
+ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"},
+ /*TDMB*/
+ {"none", "tdmb_nova_12mhz.inp", "tdmb_nova_12mhz_b0.inp", "none"},
+ /*DABIP*/ {"none", "none", "none", "none"},
+ /*BDA*/
+ {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"},
+ /*ISDBT*/
+ {"none", "isdbt_nova_12mhz.inp", "isdbt_nova_12mhz_b0.inp", "none"},
+ /*ISDBTBDA*/
+ {"none", "isdbt_nova_12mhz.inp", "isdbt_nova_12mhz_b0.inp", "none"},
+ /*CMMB*/ {"none", "none", "none", "cmmb_vega_12mhz.inp"}
};
static inline char *sms_get_fw_name(struct smscore_device_t *coredev,
@@ -798,7 +829,8 @@
/* try again with the default firmware */
fw_filename = smscore_fw_lkup[mode][type];
rc = smscore_load_firmware_from_file(coredev,
- fw_filename, NULL);
+ fw_filename,
+ NULL);
if (rc < 0) {
sms_warn("error %d loading "
@@ -815,17 +847,18 @@
buffer = kmalloc(sizeof(struct SmsMsgData_ST) +
SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA);
if (buffer) {
- struct SmsMsgData_ST *msg =
- (struct SmsMsgData_ST *)
- SMS_ALIGN_ADDRESS(buffer);
+ struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)
+ SMS_ALIGN_ADDRESS(buffer);
SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ,
sizeof(struct SmsMsgData_ST));
msg->msgData[0] = mode;
- rc = smscore_sendrequest_and_wait(
- coredev, msg, msg->xMsgHeader.msgLength,
- &coredev->init_device_done);
+ rc = smscore_sendrequest_and_wait(coredev, msg,
+ msg->xMsgHeader.
+ msgLength,
+ &coredev->
+ init_device_done);
kfree(buffer);
} else {
@@ -860,6 +893,76 @@
}
/**
+ * calls device handler to get fw file name
+ *
+ * @param coredev pointer to a coredev object returned by
+ * smscore_register_device
+ * @param filename pointer to user buffer to fill the file name
+ *
+ * @return 0 on success, <0 on error.
+ */
+int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode,
+ char *filename)
+{
+ int rc = 0;
+ enum sms_device_type_st type;
+ char tmpname[200];
+
+ type = smscore_registry_gettype(coredev->devpath);
+
+#ifdef REQUEST_FIRMWARE_SUPPORTED
+ /* driver not need file system services */
+ tmpname[0] = '\0';
+#else
+ sprintf(tmpname, "%s/%s", DEFAULT_FW_FILE_PATH,
+ smscore_fw_lkup[mode][type]);
+#endif
+ if (copy_to_user(filename, tmpname, strlen(tmpname) + 1)) {
+ sms_err("Failed copy file path to user buffer\n");
+ return -EFAULT;
+ }
+ return rc;
+}
+
+/**
+ * calls device handler to keep fw buff for later use
+ *
+ * @param coredev pointer to a coredev object returned by
+ * smscore_register_device
+ * @param ufwbuf pointer to user fw buffer
+ * @param size size in bytes of buffer
+ *
+ * @return 0 on success, <0 on error.
+ */
+int smscore_send_fw_file(struct smscore_device_t *coredev, u8 *ufwbuf,
+ int size)
+{
+ int rc = 0;
+
+ /* free old buffer */
+ if (coredev->fw_buf != NULL) {
+ kfree(coredev->fw_buf);
+ coredev->fw_buf = NULL;
+ }
+
+ coredev->fw_buf = kmalloc(ALIGN(size, SMS_ALLOC_ALIGNMENT),
+ GFP_KERNEL | GFP_DMA);
+ if (!coredev->fw_buf) {
+ sms_err("Failed allocate FW buffer memory\n");
+ return -EFAULT;
+ }
+
+ if (copy_from_user(coredev->fw_buf, ufwbuf, size)) {
+ sms_err("Failed copy FW from user buffer\n");
+ kfree(coredev->fw_buf);
+ return -EFAULT;
+ }
+ coredev->fw_buf_size = size;
+
+ return rc;
+}
+
+/**
* calls device handler to get current mode of operation
*
* @param coredev pointer to a coredev object returned by
@@ -891,20 +994,19 @@
unsigned long flags;
struct list_head *firstid, *nextid;
-
spin_lock_irqsave(&coredev->clientslock, flags);
first = &coredev->clients;
- for (next = first->next;
- (next != first) && !client;
- next = next->next) {
+ for (next = first->next; (next != first)
+ && !client; next = next->next) {
firstid = &((struct smscore_client_t *)next)->idlist;
for (nextid = firstid->next;
- nextid != firstid;
- nextid = nextid->next) {
+ nextid != firstid; nextid = nextid->next) {
if ((((struct smscore_idlist_t *)nextid)->id == id) &&
- (((struct smscore_idlist_t *)nextid)->data_type == data_type ||
- (((struct smscore_idlist_t *)nextid)->data_type == 0))) {
- client = (struct smscore_client_t *) next;
+ (((struct smscore_idlist_t *)nextid)->data_type ==
+ data_type
+ || (((struct smscore_idlist_t *)nextid)->
+ data_type == 0))) {
+ client = (struct smscore_client_t *)next;
break;
}
}
@@ -926,14 +1028,14 @@
struct smscore_buffer_t *cb)
{
struct SmsMsgHdr_ST *phdr =
- (struct SmsMsgHdr_ST *)((u8 *) cb->p + cb->offset);
+ (struct SmsMsgHdr_ST *)((u8 *) cb->p + cb->offset);
struct smscore_client_t *client =
- smscore_find_client(coredev, phdr->msgType, phdr->msgDstId);
+ smscore_find_client(coredev, phdr->msgType, phdr->msgDstId);
int rc = -EBUSY;
#if 1
- static unsigned long last_sample_time; /* = 0; */
- static int data_total; /* = 0; */
+ static unsigned long last_sample_time; /* = 0; */
+ static int data_total; /* = 0; */
unsigned long time_now = jiffies_to_msecs(jiffies);
if (!last_sample_time)
@@ -952,31 +1054,30 @@
#endif
/* If no client registered for type & id,
* check for control client where type is not registered */
-#if 0
- if (!client)
- client = smscore_find_client(coredev, 0, phdr->msgDstId);
-#endif
if (client)
rc = client->onresponse_handler(client->context, cb);
if (rc < 0) {
switch (phdr->msgType) {
case MSG_SMS_GET_VERSION_EX_RES:
- {
- struct SmsVersionRes_ST *ver =
- (struct SmsVersionRes_ST *) phdr;
- sms_debug("MSG_SMS_GET_VERSION_EX_RES "
- "id %d prots 0x%x ver %d.%d",
- ver->FirmwareId, ver->SupportedProtocols,
- ver->RomVersionMajor, ver->RomVersionMinor);
-
- coredev->mode = ver->FirmwareId == 255 ?
- DEVICE_MODE_NONE : ver->FirmwareId;
- coredev->modes_supported = ver->SupportedProtocols;
+ {
+ struct SmsVersionRes_ST *ver =
+ (struct SmsVersionRes_ST *)phdr;
+ sms_debug("MSG_SMS_GET_VERSION_EX_RES "
+ "id %d prots 0x%x ver %d.%d",
+ ver->FirmwareId,
+ ver->SupportedProtocols,
+ ver->RomVersionMajor,
+ ver->RomVersionMinor);
+
+ coredev->mode = ver->FirmwareId == 255 ?
+ DEVICE_MODE_NONE : ver->FirmwareId;
+ coredev->modes_supported =
+ ver->SupportedProtocols;
- complete(&coredev->version_ex_done);
- break;
- }
+ complete(&coredev->version_ex_done);
+ break;
+ }
case MSG_SMS_INIT_DEVICE_RES:
sms_debug("MSG_SMS_INIT_DEVICE_RES");
complete(&coredev->init_device_done);
@@ -1026,7 +1127,7 @@
spin_lock_irqsave(&coredev->bufferslock, flags);
if (!list_empty(&coredev->buffers)) {
- cb = (struct smscore_buffer_t *) coredev->buffers.next;
+ cb = (struct smscore_buffer_t *)coredev->buffers.next;
list_del(&cb->entry);
}
@@ -1100,8 +1201,8 @@
{
struct smscore_client_t *newclient;
/* check that no other channel with same parameters exists */
- if (smscore_find_client(coredev, params->data_type,
- params->initial_id)) {
+ if (smscore_find_client(coredev,
+ params->data_type, params->initial_id)) {
sms_err("Client already exist.");
return -EEXIST;
}
@@ -1142,10 +1243,9 @@
spin_lock_irqsave(&coredev->clientslock, flags);
-
while (!list_empty(&client->idlist)) {
struct smscore_idlist_t *identry =
- (struct smscore_idlist_t *) client->idlist.next;
+ (struct smscore_idlist_t *)client->idlist.next;
list_del(&identry->entry);
kfree(identry);
}
@@ -1173,7 +1273,7 @@
void *buffer, size_t size)
{
struct smscore_device_t *coredev;
- struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer;
+ struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)buffer;
int rc;
if (client == NULL) {
@@ -1197,7 +1297,7 @@
return coredev->sendrequest_handler(coredev->context, buffer, size);
}
-#if 0
+#ifdef SMS_HOSTLIB_SUBSYS
/**
* return the size of large (common) buffer
*
@@ -1218,22 +1318,22 @@
*
* @return 0 on success, <0 on error.
*/
-static int smscore_map_common_buffer(struct smscore_device_t *coredev,
- struct vm_area_struct *vma)
+int smscore_map_common_buffer(struct smscore_device_t *coredev,
+ struct vm_area_struct *vma)
{
unsigned long end = vma->vm_end,
- start = vma->vm_start,
- size = PAGE_ALIGN(coredev->common_buffer_size);
+ start = vma->vm_start,
+ size = PAGE_ALIGN(coredev->common_buffer_size);
if (!(vma->vm_flags & (VM_READ | VM_SHARED)) ||
- (vma->vm_flags & VM_WRITE)) {
+ (vma->vm_flags & VM_WRITE)) {
sms_err("invalid vm flags");
return -EINVAL;
}
if ((end - start) != size) {
sms_err("invalid size %d expected %d",
- (int)(end - start), (int) size);
+ (int)(end - start), (int)size);
return -EINVAL;
}
@@ -1246,7 +1346,7 @@
return 0;
}
-#endif
+#endif /* SMS_HOSTLIB_SUBSYS */
static int __init smscore_module_init(void)
{
@@ -1259,25 +1359,125 @@
INIT_LIST_HEAD(&g_smscore_registry);
kmutex_init(&g_smscore_registrylock);
+ /* Register sub system adapter objects */
+
+#ifdef SMS_NET_SUBSYS
+ /* NET Register */
+ rc = smsnet_register();
+ if (rc) {
+ sms_err("Error registering Siano's network client.\n");
+ goto smsnet_error;
+ }
+#endif
+
+#ifdef SMS_HOSTLIB_SUBSYS
+ /* Char interface Register */
+ rc = smschar_register();
+ if (rc) {
+ sms_err("Error registering Siano's char device client.\n");
+ goto smschar_error;
+ }
+#endif
+
+#ifdef SMS_DVB3_SUBSYS
+ /* DVB v.3 Register */
+ rc = smsdvb_register();
+ if (rc) {
+ sms_err("Error registering DVB client.\n");
+ goto smsdvb_error;
+ }
+#endif
+
+ /* Register interfaces objects */
+
+#ifdef SMS_USB_DRV
/* USB Register */
rc = smsusb_register();
+ if (rc) {
+ sms_err("Error registering USB bus driver.\n");
+ goto sms_bus_drv_error;
+ }
+#endif
- /* DVB Register */
- rc = smsdvb_register();
+#ifdef SMS_SDIO_DRV
+ /* SDIO Register */
+ rc = smssdio_register();
+ if (rc) {
+ sms_err("Error registering SDIO bus driver.\n");
+ goto sms_bus_drv_error;
+ }
+#endif
+
+#ifdef SMS_SPI_PXA310_DRV
+ /* Intel PXA310 SPI Register */
+ rc = smsspi_register();
+ if (rc) {
+ sms_err("Error registering Intel PXA310 SPI bus driver.\n");
+ goto sms_bus_drv_error;
+ }
+#endif
+
+ return rc;
+
+sms_bus_drv_error:
+#ifdef SMS_DVB3_SUBSYS
+ smsdvb_unregister();
+smsdvb_error:
+#endif
+
+#ifdef SMS_HOSTLIB_SUBSYS
+ smschar_unregister();
+smschar_error:
+#endif
+
+#ifdef SMS_NET_SUBSYS
+ smsnet_unregister();
+smsnet_error:
+#endif
- sms_debug("rc %d", rc);
+ sms_err("rc %d", rc);
+ printk(KERN_INFO "%s, rc %d\n", __func__, rc);
return rc;
}
static void __exit smscore_module_exit(void)
{
+#ifdef SMS_NET_SUBSYS
+ /* Net Unregister */
+ smsnet_unregister();
+#endif
+
+#ifdef SMS_HOSTLIB_SUBSYS
+ /* Char interface Unregister */
+ smschar_unregister();
+#endif
+
+#ifdef SMS_DVB3_SUBSYS
+ /* DVB v.3 unregister */
+ smsdvb_unregister();
+#endif
+
+ /* Unegister interfaces objects */
+#ifdef SMS_USB_DRV
+ /* USB unregister */
+ smsusb_unregister();
+#endif
+
+#ifdef SMS_SDIO_DRV
+ /* SDIO unegister */
+ smssdio_unregister();
+#endif
+#ifdef SMS_SPI_PXA310_DRV
+ /* Intel PXA310 SPI unegister */
+ smsspi_unregister();
+#endif
kmutex_lock(&g_smscore_deviceslock);
while (!list_empty(&g_smscore_notifyees)) {
struct smscore_device_notifyee_t *notifyee =
- (struct smscore_device_notifyee_t *)
- g_smscore_notifyees.next;
+ (struct smscore_device_notifyee_t *)
+ g_smscore_notifyees.next;
list_del(¬ifyee->entry);
kfree(notifyee);
@@ -1287,26 +1487,20 @@
kmutex_lock(&g_smscore_registrylock);
while (!list_empty(&g_smscore_registry)) {
struct smscore_registry_entry_t *entry =
- (struct smscore_registry_entry_t *)
- g_smscore_registry.next;
+ (struct smscore_registry_entry_t *)
+ g_smscore_registry.next;
list_del(&entry->entry);
kfree(entry);
}
kmutex_unlock(&g_smscore_registrylock);
- /* DVB UnRegister */
- smsdvb_unregister();
-
- /* Unregister USB */
- smsusb_unregister();
-
sms_debug("");
}
module_init(smscore_module_init);
module_exit(smscore_module_exit);
-MODULE_DESCRIPTION("Driver for the Siano SMS1XXX USB dongle");
-MODULE_AUTHOR("Siano Mobile Silicon,,, (doronc@siano-ms.com)");
+MODULE_DESCRIPTION("Siano MDTV Core module");
+MODULE_AUTHOR("Siano Mobile Silicon, Inc. (uris@siano-ms.com)");
MODULE_LICENSE("GPL");
diff -uNr v4l-dvb-c5f976cab011/linux/drivers/media/dvb/siano/smscoreapi.h v4l-dvb-c5f976cab011_0003/linux/drivers/media/dvb/siano/smscoreapi.h
--- v4l-dvb-c5f976cab011/linux/drivers/media/dvb/siano/smscoreapi.h 2008-11-16 15:40:21.000000000 +0200
+++ v4l-dvb-c5f976cab011_0003/linux/drivers/media/dvb/siano/smscoreapi.h 2008-11-19 10:29:50.000000000 +0200
@@ -1,26 +1,26 @@
-/*
- * Driver for the Siano SMS1xxx USB dongle
- *
- * author: Anatoly Greenblat
- *
- * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+/****************************************************************
-#ifndef __smscoreapi_h__
-#define __smscoreapi_h__
+Siano Mobile Silicon, Inc.
+MDTV receiver kernel modules.
+Copyright (C) 2006-2008, 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_CORE_API_H__
+#define __SMS_CORE_API_H__
#include <linux/version.h>
#include <linux/device.h>
@@ -29,14 +29,15 @@
#include <linux/scatterlist.h>
#include <linux/types.h>
#include <asm/page.h>
-
+#include <linux/mutex.h>
#include "compat.h"
+
+#ifdef SMS_DVB3_SUBSYS
#include "dmxdev.h"
#include "dvbdev.h"
#include "dvb_demux.h"
#include "dvb_frontend.h"
-
-#include <linux/mutex.h>
+#endif
#define kmutex_init(_p_) mutex_init(_p_)
#define kmutex_lock(_p_) mutex_lock(_p_)
@@ -54,7 +55,7 @@
#define SMS_DEVICE_FAMILY2 1
#define SMS_ROM_NO_RESPONSE 2
-#define SMS_DEVICE_NOT_READY 0x8000000
+#define SMS_DEVICE_NOT_READY 0x8000000
enum sms_device_type_st {
SMS_STELLAR = 0,
@@ -68,80 +69,80 @@
struct smscore_client_t;
struct smscore_buffer_t;
-typedef int (*hotplug_t)(struct smscore_device_t *coredev,
- struct device *device, int arrival);
+typedef int (*hotplug_t) (struct smscore_device_t *coredev,
+ struct device *device, int arrival);
-typedef int (*setmode_t)(void *context, int mode);
-typedef void (*detectmode_t)(void *context, int *mode);
-typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
-typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
-typedef int (*preload_t)(void *context);
-typedef int (*postload_t)(void *context);
+typedef int (*setmode_t) (void *context, int mode);
+typedef void (*detectmode_t) (void *context, int *mode);
+typedef int (*sendrequest_t) (void *context, void *buffer, size_t size);
+typedef int (*loadfirmware_t) (void *context, void *buffer, size_t size);
+typedef int (*preload_t) (void *context);
+typedef int (*postload_t) (void *context);
-typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb);
-typedef void (*onremove_t)(void *context);
+typedef int (*onresponse_t) (void *context, struct smscore_buffer_t *cb);
+typedef void (*onremove_t) (void *context);
struct smscore_buffer_t {
/* public members, once passed to clients can be changed freely */
struct list_head entry;
- int size;
- int offset;
+ int size;
+ int offset;
/* private members, read-only for clients */
- void *p;
- dma_addr_t phys;
- unsigned long offset_in_common;
+ void *p;
+ dma_addr_t phys;
+ unsigned long offset_in_common;
};
struct smsdevice_params_t {
- struct device *device;
+ struct device *device;
- int buffer_size;
- int num_buffers;
+ int buffer_size;
+ int num_buffers;
- char devpath[32];
- unsigned long flags;
+ char devpath[32];
+ unsigned long flags;
- setmode_t setmode_handler;
- detectmode_t detectmode_handler;
- sendrequest_t sendrequest_handler;
- preload_t preload_handler;
- postload_t postload_handler;
+ setmode_t setmode_handler;
+ detectmode_t detectmode_handler;
+ sendrequest_t sendrequest_handler;
+ preload_t preload_handler;
+ postload_t postload_handler;
- void *context;
+ void *context;
enum sms_device_type_st device_type;
};
struct smsclient_params_t {
- int initial_id;
- int data_type;
- onresponse_t onresponse_handler;
- onremove_t onremove_handler;
+ int initial_id;
+ int data_type;
+ onresponse_t onresponse_handler;
+ onremove_t onremove_handler;
- void *context;
+ void *context;
};
/* GPIO definitions for antenna frequency domain control (SMS8021) */
-#define SMS_ANTENNA_GPIO_0 1
-#define SMS_ANTENNA_GPIO_1 0
+#define SMS_ANTENNA_GPIO_0 1
+#define SMS_ANTENNA_GPIO_1 0
-#define BW_8_MHZ 0
-#define BW_7_MHZ 1
-#define BW_6_MHZ 2
-#define BW_5_MHZ 3
-#define BW_ISDBT_1SEG 4
-#define BW_ISDBT_3SEG 5
+#define BW_8_MHZ 0
+#define BW_7_MHZ 1
+#define BW_6_MHZ 2
+#define BW_5_MHZ 3
+#define BW_ISDBT_1SEG 4
+#define BW_ISDBT_3SEG 5
#define MSG_HDR_FLAG_SPLIT_MSG 4
-#define MAX_GPIO_PIN_NUMBER 31
+#define MAX_GPIO_PIN_NUMBER 31
-#define HIF_TASK 11
-#define SMS_HOST_LIB 150
+#define HIF_TASK 11
+#define SMS_HOST_LIB 150
#define DVBT_BDA_CONTROL_MSG_ID 201
#define SMS_MAX_PAYLOAD_SIZE 240
-#define SMS_TUNE_TIMEOUT 500
+#define SMS_TUNE_TIMEOUT 500
#define MSG_SMS_GPIO_CONFIG_REQ 507
#define MSG_SMS_GPIO_CONFIG_RES 508
@@ -149,44 +150,44 @@
#define MSG_SMS_GPIO_SET_LEVEL_RES 510
#define MSG_SMS_GPIO_GET_LEVEL_REQ 511
#define MSG_SMS_GPIO_GET_LEVEL_RES 512
-#define MSG_SMS_RF_TUNE_REQ 561
-#define MSG_SMS_RF_TUNE_RES 562
+#define MSG_SMS_RF_TUNE_REQ 561
+#define MSG_SMS_RF_TUNE_RES 562
#define MSG_SMS_INIT_DEVICE_REQ 578
#define MSG_SMS_INIT_DEVICE_RES 579
#define MSG_SMS_ADD_PID_FILTER_REQ 601
#define MSG_SMS_ADD_PID_FILTER_RES 602
-#define MSG_SMS_REMOVE_PID_FILTER_REQ 603
-#define MSG_SMS_REMOVE_PID_FILTER_RES 604
-#define MSG_SMS_DAB_CHANNEL 607
-#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
-#define MSG_SMS_GET_PID_FILTER_LIST_RES 609
+#define MSG_SMS_REMOVE_PID_FILTER_REQ 603
+#define MSG_SMS_REMOVE_PID_FILTER_RES 604
+#define MSG_SMS_DAB_CHANNEL 607
+#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
+#define MSG_SMS_GET_PID_FILTER_LIST_RES 609
#define MSG_SMS_GET_STATISTICS_REQ 615
#define MSG_SMS_GET_STATISTICS_RES 616
-#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
-#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
-#define MSG_SMS_GET_STATISTICS_EX_REQ 653
-#define MSG_SMS_GET_STATISTICS_EX_RES 654
-#define MSG_SMS_SLEEP_RESUME_COMP_IND 655
+#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
+#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
+#define MSG_SMS_GET_STATISTICS_EX_REQ 653
+#define MSG_SMS_GET_STATISTICS_EX_RES 654
+#define MSG_SMS_SLEEP_RESUME_COMP_IND 655
#define MSG_SMS_DATA_DOWNLOAD_REQ 660
#define MSG_SMS_DATA_DOWNLOAD_RES 661
-#define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664
-#define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665
-#define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666
-#define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667
+#define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664
+#define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665
+#define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666
+#define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667
#define MSG_SMS_GET_VERSION_EX_REQ 668
#define MSG_SMS_GET_VERSION_EX_RES 669
-#define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670
+#define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670
#define MSG_SMS_I2C_SET_FREQ_REQ 685
#define MSG_SMS_GENERIC_I2C_REQ 687
#define MSG_SMS_GENERIC_I2C_RES 688
#define MSG_SMS_DVBT_BDA_DATA 693
-#define MSG_SW_RELOAD_REQ 697
-#define MSG_SMS_DATA_MSG 699
+#define MSG_SW_RELOAD_REQ 697
+#define MSG_SMS_DATA_MSG 699
#define MSG_SW_RELOAD_START_REQ 702
#define MSG_SW_RELOAD_START_RES 703
#define MSG_SW_RELOAD_EXEC_REQ 704
#define MSG_SW_RELOAD_EXEC_RES 705
-#define MSG_SMS_SPI_INT_LINE_SET_REQ 710
+#define MSG_SMS_SPI_INT_LINE_SET_REQ 710
#define MSG_SMS_ISDBT_TUNE_REQ 776
#define MSG_SMS_ISDBT_TUNE_RES 777
@@ -212,121 +213,125 @@
};
struct SmsMsgHdr_ST {
- u16 msgType;
- u8 msgSrcId;
- u8 msgDstId;
- u16 msgLength; /* Length of entire message, including header */
- u16 msgFlags;
+ u16 msgType;
+ u8 msgSrcId;
+ u8 msgDstId;
+ u16 msgLength; /* Length of entire message, including header */
+ u16 msgFlags;
};
struct SmsMsgData_ST {
- struct SmsMsgHdr_ST xMsgHeader;
- u32 msgData[1];
+ struct SmsMsgHdr_ST xMsgHeader;
+ u32 msgData[1];
};
struct SmsDataDownload_ST {
- struct SmsMsgHdr_ST xMsgHeader;
- u32 MemAddr;
- u8 Payload[SMS_MAX_PAYLOAD_SIZE];
+ struct SmsMsgHdr_ST xMsgHeader;
+ u32 MemAddr;
+ u8 Payload[SMS_MAX_PAYLOAD_SIZE];
};
struct SmsVersionRes_ST {
- struct SmsMsgHdr_ST xMsgHeader;
+ struct SmsMsgHdr_ST xMsgHeader;
- u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */
- u8 Step; /* 0 - Step A */
- u8 MetalFix; /* 0 - Metal 0 */
-
- u8 FirmwareId; /* 0xFF � ROM, otherwise the
- * value indicated by
- * SMSHOSTLIB_DEVICE_MODES_E */
- u8 SupportedProtocols; /* Bitwise OR combination of
- * supported protocols */
-
- u8 VersionMajor;
- u8 VersionMinor;
- u8 VersionPatch;
- u8 VersionFieldPatch;
-
- u8 RomVersionMajor;
- u8 RomVersionMinor;
- u8 RomVersionPatch;
- u8 RomVersionFieldPatch;
+ u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */
+ u8 Step; /* 0 - Step A */
+ u8 MetalFix; /* 0 - Metal 0 */
+
+ u8 FirmwareId; /* 0xFF � ROM, otherwise the
+ * value indicated by
+ * SMSHOSTLIB_DEVICE_MODES_E */
+ u8 SupportedProtocols; /* Bitwise OR combination of
+ * supported protocols */
+
+ u8 VersionMajor;
+ u8 VersionMinor;
+ u8 VersionPatch;
+ u8 VersionFieldPatch;
+
+ u8 RomVersionMajor;
+ u8 RomVersionMinor;
+ u8 RomVersionPatch;
+ u8 RomVersionFieldPatch;
- u8 TextLabel[34];
+ u8 TextLabel[34];
};
struct SmsFirmware_ST {
- u32 CheckSum;
- u32 Length;
- u32 StartAddress;
- u8 Payload[1];
+ u32 CheckSum;
+ u32 Length;
+ u32 StartAddress;
+ u8 Payload[1];
};
struct SMSHOSTLIB_STATISTICS_ST {
- u32 Reserved; /* Reserved */
+ u32 Reserved; /* Reserved */
/* Common parameters */
- u32 IsRfLocked; /* 0 - not locked, 1 - locked */
- u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
- u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
+ u32 IsRfLocked; /* 0 - not locked, 1 - locked */
+ u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
+ u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
/* Reception quality */
- s32 SNR; /* dB */
- u32 BER; /* Post Viterbi BER [1E-5] */
- u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */
- u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A,
- * valid only for DVB-T/H */
- u32 MFER; /* DVB-H frame error rate in percentage,
- * 0xFFFFFFFF indicate N/A, valid only for DVB-H */
- s32 RSSI; /* dBm */
- s32 InBandPwr; /* In band power in dBM */
- s32 CarrierOffset; /* Carrier Offset in bin/1024 */
+ s32 SNR; /* dB */
+ u32 BER; /* Post Viterbi BER [1E-5] */
+ u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */
+ u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF
+ * indicate N/A, valid only for DVB-T/H */
+ u32 MFER; /* DVB-H frame error rate in percentage,
+ * 0xFFFFFFFF indicate N/A, valid
+ * only for DVB-H */
+ s32 RSSI; /* dBm */
+ s32 InBandPwr; /* In band power in dBM */
+ s32 CarrierOffset; /* Carrier Offset in bin/1024 */
/* Transmission parameters, valid only for DVB-T/H */
- u32 Frequency; /* Frequency in Hz */
- u32 Bandwidth; /* Bandwidth in MHz */
- u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4,
- * for DVB-T/H FFT mode carriers in Kilos */
- u32 ModemState; /* from SMS_DvbModemState_ET */
- u32 GuardInterval; /* Guard Interval, 1 divided by value */
- u32 CodeRate; /* Code Rate from SMS_DvbModemState_ET */
- u32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET */
- u32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET */
- u32 Constellation; /* Constellation from SMS_Constellation_ET */
+ u32 Frequency; /* Frequency in Hz */
+ u32 Bandwidth; /* Bandwidth in MHz */
+ u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4,
+ * for DVB-T/H FFT mode carriers in Kilos */
+ u32 ModemState; /* from SMS_DvbModemState_ET */
+ u32 GuardInterval; /* Guard Interval, 1 divided by value */
+ u32 CodeRate; /* Code Rate from SMS_DvbModemState_ET */
+ u32 LPCodeRate; /* Low Priority Code Rate from
+ * SMS_DvbModemState_ET */
+ u32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET */
+ u32 Constellation; /* Constellation from SMS_Constellation_ET */
/* Burst parameters, valid only for DVB-H */
- u32 BurstSize; /* Current burst size in bytes */
- u32 BurstDuration; /* Current burst duration in mSec */
- u32 BurstCycleTime; /* Current burst cycle time in mSec */
- u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec,
- * as calculated by demodulator */
- u32 NumOfRows; /* Number of rows in MPE table */
- u32 NumOfPaddCols; /* Number of padding columns in MPE table */
- u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */
+ u32 BurstSize; /* Current burst size in bytes */
+ u32 BurstDuration; /* Current burst duration in mSec */
+ u32 BurstCycleTime; /* Current burst cycle time in mSec */
+ u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec,
+ * as calculated by demodulator */
+ u32 NumOfRows; /* Number of rows in MPE table */
+ u32 NumOfPaddCols; /* Number of padding columns in MPE table */
+ u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */
/* Burst parameters */
- u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
- u32 TotalTSPackets; /* Total number of transport-stream packets */
- u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
- * errors after MPE RS decoding */
- u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors
- * after MPE RS decoding */
+ u32 ErrorTSPackets; /* Number of erroneous transport-stream
+ * packets */
+ u32 TotalTSPackets; /* Total number of transport-stream packets */
+ u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
+ * errors after MPE RS decoding */
+ u32 NumOfInvalidMpeTlbs;/* Number of MPE tables which include errors
+ * after MPE RS decoding */
u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected
* by MPE RS decoding */
/* Common params */
- u32 BERErrorCount; /* Number of errornous SYNC bits. */
- u32 BERBitCount; /* Total number of SYNC bits. */
+ u32 BERErrorCount; /* Number of errornous SYNC bits. */
+ u32 BERBitCount; /* Total number of SYNC bits. */
/* Interface information */
- u32 SmsToHostTxErrors; /* Total number of transmission errors. */
+ u32 SmsToHostTxErrors; /* Total number of transmission errors. */
/* DAB/T-DMB */
- u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */
+ u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */
/* DVB-H TPS parameters */
- u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
- * if set to 0xFFFFFFFF cell_id not yet recovered */
+ u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
+ * if set to 0xFFFFFFFF cell_id not
+ * yet recovered */
};
@@ -336,197 +341,34 @@
struct SMSHOSTLIB_STATISTICS_ST Stat;
/* Split the calc of the SNR in DAB */
- u32 Signal; /* dB */
- u32 Noise; /* dB */
-
-};
-
-#if 0
-struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST {
- /* Per-layer information */
- u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
- * 255 means layer does not exist */
- u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET,
- * 255 means layer does not exist */
- u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
- u32 BERErrorCount; /* Post Viterbi Error Bits Count */
- u32 BERBitCount; /* Post Viterbi Total Bits Count */
- u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
- u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */
- u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
- u32 TotalTSPackets; /* Total number of transport-stream packets */
- u32 TILdepthI; /* Time interleaver depth I parameter,
- * 255 means layer does not exist */
- u32 NumberOfSegments; /* Number of segments in layer A,
- * 255 means layer does not exist */
- u32 TMCCErrors; /* TMCC errors */
-};
-
-struct SMSHOSTLIB_STATISTICS_ISDBT_ST {
- u32 StatisticsType; /* Enumerator identifying the type of the
- * structure. Values are the same as
- * SMSHOSTLIB_DEVICE_MODES_E
- *
- * This field MUST always be first in any
- * statistics structure */
-
- u32 FullSize; /* Total size of the structure returned by the modem.
- * If the size requested by the host is smaller than
- * FullSize, the struct will be truncated */
-
- /* Common parameters */
- u32 IsRfLocked; /* 0 - not locked, 1 - locked */
- u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
- u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
-
- /* Reception quality */
- s32 SNR; /* dB */
- s32 RSSI; /* dBm */
- s32 InBandPwr; /* In band power in dBM */
- s32 CarrierOffset; /* Carrier Offset in Hz */
-
- /* Transmission parameters */
- u32 Frequency; /* Frequency in Hz */
- u32 Bandwidth; /* Bandwidth in MHz */
- u32 TransmissionMode; /* ISDB-T transmission mode */
- u32 ModemState; /* 0 - Acquisition, 1 - Locked */
- u32 GuardInterval; /* Guard Interval, 1 divided by value */
- u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
- u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */
- u32 NumOfLayers; /* Number of ISDB-T layers in the network */
-
- /* Per-layer information */
- /* Layers A, B and C */
- struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3];
- /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */
-
- /* Interface information */
- u32 SmsToHostTxErrors; /* Total number of transmission errors. */
+ u32 Signal; /* dB */
+ u32 Noise; /* dB */
};
-struct SMSHOSTLIB_STATISTICS_DVB_ST {
- u32 StatisticsType; /* Enumerator identifying the type of the
- * structure. Values are the same as
- * SMSHOSTLIB_DEVICE_MODES_E
- * This field MUST always first in any
- * statistics structure */
-
- u32 FullSize; /* Total size of the structure returned by the modem.
- * If the size requested by the host is smaller than
- * FullSize, the struct will be truncated */
- /* Common parameters */
- u32 IsRfLocked; /* 0 - not locked, 1 - locked */
- u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
- u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
-
- /* Reception quality */
- s32 SNR; /* dB */
- u32 BER; /* Post Viterbi BER [1E-5] */
- u32 BERErrorCount; /* Number of errornous SYNC bits. */
- u32 BERBitCount; /* Total number of SYNC bits. */
- u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */
- u32 MFER; /* DVB-H frame error rate in percentage,
- * 0xFFFFFFFF indicate N/A, valid only for DVB-H */
- s32 RSSI; /* dBm */
- s32 InBandPwr; /* In band power in dBM */
- s32 CarrierOffset; /* Carrier Offset in bin/1024 */
-
- /* Transmission parameters */
- u32 Frequency; /* Frequency in Hz */
- u32 Bandwidth; /* Bandwidth in MHz */
- u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
- u32 TransmissionMode; /* FFT mode carriers in Kilos */
- u32 GuardInterval; /* Guard Interval, 1 divided by value */
- u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */
- u32 LPCodeRate; /* Low Priority Code Rate from
- * SMSHOSTLIB_CODE_RATE_ET */
- u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */
- u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */
-
- /* Burst parameters, valid only for DVB-H */
- u32 BurstSize; /* Current burst size in bytes */
- u32 BurstDuration; /* Current burst duration in mSec */
- u32 BurstCycleTime; /* Current burst cycle time in mSec */
- u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec,
- * as calculated by demodulator */
- u32 NumOfRows; /* Number of rows in MPE table */
- u32 NumOfPaddCols; /* Number of padding columns in MPE table */
- u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */
-
- u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
- u32 TotalTSPackets; /* Total number of transport-stream packets */
-
- u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
- * errors after MPE RS decoding */
- u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include
- * errors after MPE RS decoding */
- u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were
- * corrected by MPE RS decoding */
-
- u32 NumMPEReceived; /* DVB-H, Num MPE section received */
-
- /* DVB-H TPS parameters */
- u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
- * if set to 0xFFFFFFFF cell_id not yet recovered */
- u32 DvbhSrvIndHP; /* DVB-H service indication info,
- * bit 1 - Time Slicing indicator,
- * bit 0 - MPE-FEC indicator */
- u32 DvbhSrvIndLP; /* DVB-H service indication info,
- * bit 1 - Time Slicing indicator,
- * bit 0 - MPE-FEC indicator */
-
- /* Interface information */
- u32 SmsToHostTxErrors; /* Total number of transmission errors. */
-
-};
-
-struct SMSHOSTLIB_GPIO_CONFIG_ST {
- u8 Direction; /* GPIO direction: Input - 0, Output - 1 */
- u8 PullUpDown; /* PullUp/PullDown: None - 0,
- * PullDown - 1, PullUp - 2, Keeper - 3 */
- u8 InputCharacteristics; /* Input Characteristics: Normal - 0,
- * Schmitt trigger - 1 */
- u8 OutputSlewRate; /* Output Slew Rate:
- * Fast slew rate - 0, Slow slew rate - 1 */
- u8 OutputDriving; /* Output driving capability:
- * 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */
-};
-
-struct SMSHOSTLIB_I2C_REQ_ST {
- u32 DeviceAddress; /* I2c device address */
- u32 WriteCount; /* number of bytes to write */
- u32 ReadCount; /* number of bytes to read */
- u8 Data[1];
-};
-
-struct SMSHOSTLIB_I2C_RES_ST {
- u32 Status; /* non-zero value in case of failure */
- u32 ReadCount; /* number of bytes read */
- u8 Data[1];
-};
-#endif
+#ifdef SMS_DVB3_SUBSYS
struct smsdvb_client_t {
struct list_head entry;
- struct smscore_device_t *coredev;
- struct smscore_client_t *smsclient;
+ struct smscore_device_t *coredev;
+ struct smscore_client_t *smsclient;
- struct dvb_adapter adapter;
- struct dvb_demux demux;
- struct dmxdev dmxdev;
- struct dvb_frontend frontend;
+ struct dvb_adapter adapter;
+ struct dvb_demux demux;
+ struct dmxdev dmxdev;
+ struct dvb_frontend frontend;
- fe_status_t fe_status;
- int fe_ber, fe_snr, fe_signal_strength;
+ fe_status_t fe_status;
+ int fe_ber, fe_snr, fe_signal_strength;
- struct completion tune_done, stat_done;
+ struct completion tune_done, stat_done;
/* todo: save freq/band instead whole struct */
struct dvb_frontend_parameters fe_params;
};
+#endif /* SMS_DVB3_SUBSYS */
extern void smscore_registry_setmode(char *devpath, int mode);
extern int smscore_registry_getmode(char *devpath);
@@ -542,13 +384,17 @@
extern int smscore_load_firmware(struct smscore_device_t *coredev,
char *filename,
loadfirmware_t loadfirmware_handler);
-
extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
extern int smscore_get_device_mode(struct smscore_device_t *coredev);
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode,
+ char *filename);
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8 *ufwbuf,
+ int size);
+
extern int smscore_register_client(struct smscore_device_t *coredev,
- struct smsclient_params_t *params,
- struct smscore_client_t **client);
+ struct smsclient_params_t *params,
+ struct smscore_client_t **client);
extern void smscore_unregister_client(struct smscore_client_t *client);
extern int smsclient_sendrequest(struct smscore_client_t *client,
@@ -556,27 +402,47 @@
extern void smscore_onresponse(struct smscore_device_t *coredev,
struct smscore_buffer_t *cb);
-#if 0
extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
- struct vm_area_struct *vma);
-#endif
+ struct vm_area_struct *vma);
-extern
-struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
+extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t
+ *coredev);
extern void smscore_putbuffer(struct smscore_device_t *coredev,
struct smscore_buffer_t *cb);
void smscore_set_board_id(struct smscore_device_t *core, int id);
int smscore_get_board_id(struct smscore_device_t *core);
-/* smsdvb.c */
-int smsdvb_register(void);
-void smsdvb_unregister(void);
-
-/* smsusb.c */
-int smsusb_register(void);
-void smsusb_unregister(void);
+#ifdef SMS_HOSTLIB_SUBSYS
+extern int smschar_register(void);
+extern void smschar_unregister(void);
+#endif
+
+#ifdef SMS_NET_SUBSYS
+extern int smsnet_register(void);
+extern void smsnet_unregister(void);
+#endif
+
+#ifdef SMS_DVB3_SUBSYS
+extern int smsdvb_register(void);
+extern void smsdvb_unregister(void);
+#endif
+
+#ifdef SMS_USB_DRV
+extern int smsusb_register(void);
+extern void smsusb_unregister(void);
+#endif
+
+#ifdef SMS_SDIO_DRV
+extern int smssdio_register(void);
+extern void smssdio_unregister(void);
+#endif
+
+#ifdef SMS_SPI_PXA310_DRV
+extern int smsspi_register(void);
+extern void smsspi_unregister(void);
+#endif
/* ------------------------------------------------------------------------ */
@@ -601,5 +467,4 @@
#define sms_debug(fmt, arg...) \
dprintk(KERN_DEBUG, DBG_ADV, fmt, ##arg)
-
-#endif /* __smscoreapi_h__ */
+#endif /* __SMS_CORE_API_H__ */
[-- Attachment #3: Type: text/plain, Size: 150 bytes --]
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
next reply other threads:[~2008-11-19 9:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 9:03 Uri Shkolnik [this message]
2008-11-20 12:03 ` [linux-dvb] [PATCH 5/5] Siano's SMS core system upgrade BOUWSMA Barry
2008-11-20 12:21 ` Uri Shkolnik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=804196.56504.qm@web38803.mail.mud.yahoo.com \
--to=urishk@yahoo.com \
--cc=linux-dvb@linuxtv.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox