/*
* 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 3 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.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/firmware.h>
#include "smscoreapi.h"
#include "sms-cards.h"
int sms_debug;
module_param_named(debug, sms_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
struct smscore_device_notifyee_t {
struct list_head entry;
hotplug_t hotplug;
};
struct smscore_idlist_t {
struct list_head entry;
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;
};
struct smscore_device_t {
struct list_head entry;
struct list_head clients;
struct list_head subclients;
spinlock_t clientslock;
struct list_head 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;
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;
};
void smscore_set_board_id(struct smscore_device_t *core, int id)
{
core->board_id = id;
}
int smscore_get_board_id(struct smscore_device_t *core)
{
return core->board_id;
}
struct smscore_registry_entry_t {
struct list_head entry;
char devpath[32];
int mode;
enum sms_device_type_st type;
};
static struct list_head g_smscore_notifyees;
static struct list_head g_smscore_devices;
static struct mutex g_smscore_deviceslock;
static struct list_head g_smscore_registry;
static struct mutex g_smscore_registrylock;
static int default_mode = 4;
module_param(default_mode, int, 0644);