blob: ccc7e10129580c0b57f7861159b8c7addb59c14e [file] [log] [blame]
Steven Toth8d4f9d02008-05-22 18:05:26 -03001/*
Michael Krufky85447062008-05-22 18:29:20 -03002 * Driver for the Siano SMS1xxx USB dongle
Steven Toth8d4f9d02008-05-22 18:05:26 -03003 *
Michael Krufky85447062008-05-22 18:29:20 -03004 * author: Anatoly Greenblat
5 *
6 * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc.
Steven Toth8d4f9d02008-05-22 18:05:26 -03007 *
8 * This program is free software; you can redistribute it and/or modify
Michael Krufky85447062008-05-22 18:29:20 -03009 * it under the terms of the GNU General Public License version 3 as
10 * published by the Free Software Foundation;
Steven Toth8d4f9d02008-05-22 18:05:26 -030011 *
Michael Krufky85447062008-05-22 18:29:20 -030012 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
Steven Toth8d4f9d02008-05-22 18:05:26 -030014 *
Michael Krufky85447062008-05-22 18:29:20 -030015 * See the GNU General Public License for more details.
Steven Toth8d4f9d02008-05-22 18:05:26 -030016 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030022#ifndef __smscoreapi_h__
23#define __smscoreapi_h__
24
Steven Toth955e9ca2008-05-22 15:46:32 -030025#include <linux/version.h>
26#include <linux/device.h>
27#include <linux/list.h>
28#include <linux/mm.h>
29#include <asm/scatterlist.h>
30#include <asm/page.h>
31
Steven Toth19d703d2008-05-22 18:06:41 -030032#include "dmxdev.h"
33#include "dvbdev.h"
34#include "dvb_demux.h"
35#include "dvb_frontend.h"
36
Steven Toth955e9ca2008-05-22 15:46:32 -030037#include <linux/mutex.h>
38
39typedef struct mutex kmutex_t;
40
41#define kmutex_init(_p_) mutex_init(_p_)
42#define kmutex_lock(_p_) mutex_lock(_p_)
43#define kmutex_trylock(_p_) mutex_trylock(_p_)
44#define kmutex_unlock(_p_) mutex_unlock(_p_)
45
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030046#ifndef min
Michael Krufkyfa830e82008-06-15 15:52:43 -030047#define min(a, b) (((a) < (b)) ? (a) : (b))
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030048#endif
49
50#define SMS_ALLOC_ALIGNMENT 128
51#define SMS_DMA_ALIGNMENT 16
Michael Krufky59bf6b82008-06-15 16:50:11 -030052#define SMS_ALIGN_ADDRESS(addr) \
53 ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1))
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030054
55#define SMS_DEVICE_FAMILY2 1
56#define SMS_ROM_NO_RESPONSE 2
57#define SMS_DEVICE_NOT_READY 0x8000000
58
Michael Krufky18245e12008-06-15 17:52:24 -030059enum sms_device_type_st {
Michael Krufkyfa830e82008-06-15 15:52:43 -030060 SMS_STELLAR = 0,
Michael Krufkyf17407a2008-06-14 00:43:26 -030061 SMS_NOVA_A0,
62 SMS_NOVA_B0,
63 SMS_VEGA,
64 SMS_NUM_OF_DEVICE_TYPES
Michael Krufky18245e12008-06-15 17:52:24 -030065};
Michael Krufkyf17407a2008-06-14 00:43:26 -030066
Michael Krufky18245e12008-06-15 17:52:24 -030067struct smscore_device_t;
68struct smscore_client_t;
69struct smscore_buffer_t;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030070
Michael Krufky18245e12008-06-15 17:52:24 -030071typedef int (*hotplug_t)(struct smscore_device_t *coredev,
Michael Krufky59bf6b82008-06-15 16:50:11 -030072 struct device *device, int arrival);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030073
74typedef int (*setmode_t)(void *context, int mode);
75typedef void (*detectmode_t)(void *context, int *mode);
76typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
77typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
78typedef int (*preload_t)(void *context);
79typedef int (*postload_t)(void *context);
80
Michael Krufky18245e12008-06-15 17:52:24 -030081typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030082typedef void (*onremove_t)(void *context);
83
Michael Krufky18245e12008-06-15 17:52:24 -030084struct smscore_buffer_t {
Michael Krufky82237412008-06-15 15:14:13 -030085 /* public members, once passed to clients can be changed freely */
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030086 struct list_head entry;
87 int size;
88 int offset;
89
Michael Krufky82237412008-06-15 15:14:13 -030090 /* private members, read-only for clients */
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030091 void *p;
92 dma_addr_t phys;
93 unsigned long offset_in_common;
Michael Krufky18245e12008-06-15 17:52:24 -030094};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030095
Michael Krufky18245e12008-06-15 17:52:24 -030096struct smsdevice_params_t {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030097 struct device *device;
98
99 int buffer_size;
100 int num_buffers;
101
102 char devpath[32];
103 unsigned long flags;
104
105 setmode_t setmode_handler;
106 detectmode_t detectmode_handler;
107 sendrequest_t sendrequest_handler;
108 preload_t preload_handler;
109 postload_t postload_handler;
110
111 void *context;
Michael Krufky18245e12008-06-15 17:52:24 -0300112 enum sms_device_type_st device_type;
113};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300114
Michael Krufky18245e12008-06-15 17:52:24 -0300115struct smsclient_params_t {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300116 int initial_id;
117 int data_type;
118 onresponse_t onresponse_handler;
119 onremove_t onremove_handler;
120
121 void *context;
Michael Krufky18245e12008-06-15 17:52:24 -0300122};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300123
Michael Krufky82237412008-06-15 15:14:13 -0300124/* GPIO definitions for antenna frequency domain control (SMS8021) */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300125#define SMS_ANTENNA_GPIO_0 1
126#define SMS_ANTENNA_GPIO_1 0
127
128#define BW_8_MHZ 0
129#define BW_7_MHZ 1
130#define BW_6_MHZ 2
131#define BW_5_MHZ 3
132#define BW_ISDBT_1SEG 4
133#define BW_ISDBT_3SEG 5
134
135#define MSG_HDR_FLAG_SPLIT_MSG 4
136
137#define MAX_GPIO_PIN_NUMBER 31
138
139#define HIF_TASK 11
140#define SMS_HOST_LIB 150
141#define DVBT_BDA_CONTROL_MSG_ID 201
142
143#define SMS_MAX_PAYLOAD_SIZE 240
144#define SMS_TUNE_TIMEOUT 500
145
146#define MSG_SMS_GPIO_CONFIG_REQ 507
147#define MSG_SMS_GPIO_CONFIG_RES 508
148#define MSG_SMS_GPIO_SET_LEVEL_REQ 509
149#define MSG_SMS_GPIO_SET_LEVEL_RES 510
150#define MSG_SMS_GPIO_GET_LEVEL_REQ 511
151#define MSG_SMS_GPIO_GET_LEVEL_RES 512
152#define MSG_SMS_RF_TUNE_REQ 561
153#define MSG_SMS_RF_TUNE_RES 562
154#define MSG_SMS_INIT_DEVICE_REQ 578
155#define MSG_SMS_INIT_DEVICE_RES 579
156#define MSG_SMS_ADD_PID_FILTER_REQ 601
157#define MSG_SMS_ADD_PID_FILTER_RES 602
158#define MSG_SMS_REMOVE_PID_FILTER_REQ 603
159#define MSG_SMS_REMOVE_PID_FILTER_RES 604
160#define MSG_SMS_DAB_CHANNEL 607
161#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
162#define MSG_SMS_GET_PID_FILTER_LIST_RES 609
163#define MSG_SMS_GET_STATISTICS_REQ 615
164#define MSG_SMS_GET_STATISTICS_RES 616
165#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
166#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
167#define MSG_SMS_GET_STATISTICS_EX_REQ 653
168#define MSG_SMS_GET_STATISTICS_EX_RES 654
169#define MSG_SMS_SLEEP_RESUME_COMP_IND 655
170#define MSG_SMS_DATA_DOWNLOAD_REQ 660
171#define MSG_SMS_DATA_DOWNLOAD_RES 661
172#define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664
173#define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665
174#define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666
175#define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667
176#define MSG_SMS_GET_VERSION_EX_REQ 668
177#define MSG_SMS_GET_VERSION_EX_RES 669
178#define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670
179#define MSG_SMS_I2C_SET_FREQ_REQ 685
180#define MSG_SMS_GENERIC_I2C_REQ 687
181#define MSG_SMS_GENERIC_I2C_RES 688
182#define MSG_SMS_DVBT_BDA_DATA 693
183#define MSG_SW_RELOAD_REQ 697
184#define MSG_SMS_DATA_MSG 699
185#define MSG_SW_RELOAD_START_REQ 702
186#define MSG_SW_RELOAD_START_RES 703
187#define MSG_SW_RELOAD_EXEC_REQ 704
188#define MSG_SW_RELOAD_EXEC_RES 705
189#define MSG_SMS_SPI_INT_LINE_SET_REQ 710
190#define MSG_SMS_ISDBT_TUNE_REQ 776
191#define MSG_SMS_ISDBT_TUNE_RES 777
192
193#define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
194 (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \
195 (ptr)->msgLength = len; (ptr)->msgFlags = 0; \
196} while (0)
Michael Krufky59bf6b82008-06-15 16:50:11 -0300197#define SMS_INIT_MSG(ptr, type, len) \
198 SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300199
Michael Krufky18245e12008-06-15 17:52:24 -0300200enum SMS_DEVICE_MODE {
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300201 DEVICE_MODE_NONE = -1,
202 DEVICE_MODE_DVBT = 0,
203 DEVICE_MODE_DVBH,
204 DEVICE_MODE_DAB_TDMB,
205 DEVICE_MODE_DAB_TDMB_DABIP,
206 DEVICE_MODE_DVBT_BDA,
207 DEVICE_MODE_ISDBT,
208 DEVICE_MODE_ISDBT_BDA,
209 DEVICE_MODE_CMMB,
210 DEVICE_MODE_RAW_TUNER,
211 DEVICE_MODE_MAX,
Michael Krufky18245e12008-06-15 17:52:24 -0300212};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300213
Michael Krufky18245e12008-06-15 17:52:24 -0300214struct SmsMsgHdr_ST {
Michael Krufkyf0333e32008-06-15 15:32:00 -0300215 u16 msgType;
216 u8 msgSrcId;
217 u8 msgDstId;
218 u16 msgLength; /* Length of entire message, including header */
219 u16 msgFlags;
Michael Krufky18245e12008-06-15 17:52:24 -0300220};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300221
Michael Krufky18245e12008-06-15 17:52:24 -0300222struct SmsMsgData_ST {
223 struct SmsMsgHdr_ST xMsgHeader;
Michael Krufkyf0333e32008-06-15 15:32:00 -0300224 u32 msgData[1];
Michael Krufky18245e12008-06-15 17:52:24 -0300225};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300226
Michael Krufky18245e12008-06-15 17:52:24 -0300227struct SmsDataDownload_ST {
228 struct SmsMsgHdr_ST xMsgHeader;
Michael Krufkyf0333e32008-06-15 15:32:00 -0300229 u32 MemAddr;
230 u8 Payload[SMS_MAX_PAYLOAD_SIZE];
Michael Krufky18245e12008-06-15 17:52:24 -0300231};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300232
Michael Krufky18245e12008-06-15 17:52:24 -0300233struct SmsVersionRes_ST {
234 struct SmsMsgHdr_ST xMsgHeader;
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300235
Michael Krufkyf0333e32008-06-15 15:32:00 -0300236 u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */
237 u8 Step; /* 0 - Step A */
238 u8 MetalFix; /* 0 - Metal 0 */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300239
Michael Krufky59bf6b82008-06-15 16:50:11 -0300240 u8 FirmwareId; /* 0xFF � ROM, otherwise the
241 * value indicated by
242 * SMSHOSTLIB_DEVICE_MODES_E */
243 u8 SupportedProtocols; /* Bitwise OR combination of
244 * supported protocols */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300245
Michael Krufkyf0333e32008-06-15 15:32:00 -0300246 u8 VersionMajor;
247 u8 VersionMinor;
248 u8 VersionPatch;
249 u8 VersionFieldPatch;
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300250
Michael Krufkyf0333e32008-06-15 15:32:00 -0300251 u8 RomVersionMajor;
252 u8 RomVersionMinor;
253 u8 RomVersionPatch;
254 u8 RomVersionFieldPatch;
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300255
Michael Krufkyf0333e32008-06-15 15:32:00 -0300256 u8 TextLabel[34];
Michael Krufky18245e12008-06-15 17:52:24 -0300257};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300258
Michael Krufky18245e12008-06-15 17:52:24 -0300259struct SmsFirmware_ST {
Michael Krufkyf0333e32008-06-15 15:32:00 -0300260 u32 CheckSum;
261 u32 Length;
262 u32 StartAddress;
263 u8 Payload[1];
Michael Krufky18245e12008-06-15 17:52:24 -0300264};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300265
Michael Krufky18245e12008-06-15 17:52:24 -0300266struct SMSHOSTLIB_STATISTICS_ST {
Michael Krufkyf0333e32008-06-15 15:32:00 -0300267 u32 Reserved; /* Reserved */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300268
Michael Krufky82237412008-06-15 15:14:13 -0300269 /* Common parameters */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300270 u32 IsRfLocked; /* 0 - not locked, 1 - locked */
271 u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
272 u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300273
Michael Krufky82237412008-06-15 15:14:13 -0300274 /* Reception quality */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300275 s32 SNR; /* dB */
276 u32 BER; /* Post Viterbi BER [1E-5] */
277 u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */
Michael Krufky59bf6b82008-06-15 16:50:11 -0300278 u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A,
279 * valid only for DVB-T/H */
280 u32 MFER; /* DVB-H frame error rate in percentage,
281 * 0xFFFFFFFF indicate N/A, valid only for DVB-H */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300282 s32 RSSI; /* dBm */
283 s32 InBandPwr; /* In band power in dBM */
284 s32 CarrierOffset; /* Carrier Offset in bin/1024 */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300285
Michael Krufky59bf6b82008-06-15 16:50:11 -0300286 /* Transmission parameters, valid only for DVB-T/H */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300287 u32 Frequency; /* Frequency in Hz */
Michael Krufky59bf6b82008-06-15 16:50:11 -0300288 u32 Bandwidth; /* Bandwidth in MHz */
289 u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4,
290 * for DVB-T/H FFT mode carriers in Kilos */
291 u32 ModemState; /* from SMS_DvbModemState_ET */
292 u32 GuardInterval; /* Guard Interval, 1 divided by value */
293 u32 CodeRate; /* Code Rate from SMS_DvbModemState_ET */
294 u32 LPCodeRate; /* Low Priority Code Rate from SMS_DvbModemState_ET */
295 u32 Hierarchy; /* Hierarchy from SMS_Hierarchy_ET */
296 u32 Constellation; /* Constellation from SMS_Constellation_ET */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300297
Michael Krufky82237412008-06-15 15:14:13 -0300298 /* Burst parameters, valid only for DVB-H */
Michael Krufky59bf6b82008-06-15 16:50:11 -0300299 u32 BurstSize; /* Current burst size in bytes */
300 u32 BurstDuration; /* Current burst duration in mSec */
301 u32 BurstCycleTime; /* Current burst cycle time in mSec */
302 u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec,
303 * as calculated by demodulator */
304 u32 NumOfRows; /* Number of rows in MPE table */
305 u32 NumOfPaddCols; /* Number of padding columns in MPE table */
306 u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */
307 /* Burst parameters */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300308 u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
309 u32 TotalTSPackets; /* Total number of transport-stream packets */
Michael Krufky59bf6b82008-06-15 16:50:11 -0300310 u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
311 * errors after MPE RS decoding */
312 u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include errors
313 * after MPE RS decoding */
314 u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were corrected
315 * by MPE RS decoding */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300316
Michael Krufky82237412008-06-15 15:14:13 -0300317 /* Common params */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300318 u32 BERErrorCount; /* Number of errornous SYNC bits. */
319 u32 BERBitCount; /* Total number of SYNC bits. */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300320
Michael Krufky82237412008-06-15 15:14:13 -0300321 /* Interface information */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300322 u32 SmsToHostTxErrors; /* Total number of transmission errors. */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300323
Michael Krufky82237412008-06-15 15:14:13 -0300324 /* DAB/T-DMB */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300325 u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */
Michael Krufky82237412008-06-15 15:14:13 -0300326
327 /* DVB-H TPS parameters */
Michael Krufky59bf6b82008-06-15 16:50:11 -0300328 u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
329 * if set to 0xFFFFFFFF cell_id not yet recovered */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300330
Michael Krufky18245e12008-06-15 17:52:24 -0300331};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300332
Michael Krufky18245e12008-06-15 17:52:24 -0300333struct SmsMsgStatisticsInfo_ST {
Michael Krufkyf0333e32008-06-15 15:32:00 -0300334 u32 RequestResult;
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300335
Michael Krufky18245e12008-06-15 17:52:24 -0300336 struct SMSHOSTLIB_STATISTICS_ST Stat;
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300337
Michael Krufky82237412008-06-15 15:14:13 -0300338 /* Split the calc of the SNR in DAB */
Michael Krufkyf0333e32008-06-15 15:32:00 -0300339 u32 Signal; /* dB */
340 u32 Noise; /* dB */
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300341
Michael Krufky18245e12008-06-15 17:52:24 -0300342};
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300343
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300344
Michael Krufky18245e12008-06-15 17:52:24 -0300345struct smsdvb_client_t {
Steven Toth3dd243782008-05-22 18:01:02 -0300346 struct list_head entry;
347
Michael Krufky18245e12008-06-15 17:52:24 -0300348 struct smscore_device_t *coredev;
349 struct smscore_client_t *smsclient;
Steven Toth3dd243782008-05-22 18:01:02 -0300350
351 struct dvb_adapter adapter;
352 struct dvb_demux demux;
353 struct dmxdev dmxdev;
354 struct dvb_frontend frontend;
355
Michael Krufky82237412008-06-15 15:14:13 -0300356 fe_status_t fe_status;
357 int fe_ber, fe_snr, fe_signal_strength;
Steven Toth3dd243782008-05-22 18:01:02 -0300358
359 struct completion tune_done, stat_done;
360
Michael Krufky82237412008-06-15 15:14:13 -0300361 /* todo: save freq/band instead whole struct */
Steven Toth3dd243782008-05-22 18:01:02 -0300362 struct dvb_frontend_parameters fe_params;
363
Michael Krufky18245e12008-06-15 17:52:24 -0300364};
Steven Toth3dd243782008-05-22 18:01:02 -0300365
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300366extern void smscore_registry_setmode(char *devpath, int mode);
367extern int smscore_registry_getmode(char *devpath);
368
369extern int smscore_register_hotplug(hotplug_t hotplug);
370extern void smscore_unregister_hotplug(hotplug_t hotplug);
371
Michael Krufky18245e12008-06-15 17:52:24 -0300372extern int smscore_register_device(struct smsdevice_params_t *params,
373 struct smscore_device_t **coredev);
374extern void smscore_unregister_device(struct smscore_device_t *coredev);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300375
Michael Krufky18245e12008-06-15 17:52:24 -0300376extern int smscore_start_device(struct smscore_device_t *coredev);
377extern int smscore_load_firmware(struct smscore_device_t *coredev,
378 char *filename,
379 loadfirmware_t loadfirmware_handler);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300380
Michael Krufky18245e12008-06-15 17:52:24 -0300381extern int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev,
Michael Krufky82237412008-06-15 15:14:13 -0300382 u8 *buffer, int size,
383 int new_mode);
Michael Krufkyf17407a2008-06-14 00:43:26 -0300384
Michael Krufky18245e12008-06-15 17:52:24 -0300385extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
386extern int smscore_get_device_mode(struct smscore_device_t *coredev);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300387
Michael Krufky18245e12008-06-15 17:52:24 -0300388extern int smscore_register_client(struct smscore_device_t *coredev,
389 struct smsclient_params_t *params,
390 struct smscore_client_t **client);
391extern void smscore_unregister_client(struct smscore_client_t *client);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300392
Michael Krufky18245e12008-06-15 17:52:24 -0300393extern int smsclient_sendrequest(struct smscore_client_t *client,
Michael Krufky82237412008-06-15 15:14:13 -0300394 void *buffer, size_t size);
Michael Krufky18245e12008-06-15 17:52:24 -0300395extern void smscore_onresponse(struct smscore_device_t *coredev,
396 struct smscore_buffer_t *cb);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300397
Michael Krufky18245e12008-06-15 17:52:24 -0300398extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
399extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
Michael Krufkya83ccdd2008-05-06 03:11:51 -0300400 struct vm_area_struct *vma);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300401
Michael Krufky18245e12008-06-15 17:52:24 -0300402extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
403extern void smscore_putbuffer(struct smscore_device_t *coredev,
404 struct smscore_buffer_t *cb);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300405
Michael Krufky1c11d542008-06-18 22:09:55 -0300406void smscore_set_board_id(struct smscore_device_t *core, int id);
407int smscore_get_board_id(struct smscore_device_t *core);
408
Steven Toth3dd243782008-05-22 18:01:02 -0300409/* smsdvb.c */
Steven Totheae55662008-05-22 18:04:36 -0300410int smsdvb_register(void);
411void smsdvb_unregister(void);
412
413/* smsusb.c */
414int smsusb_register(void);
415void smsusb_unregister(void);
Steven Toth3dd243782008-05-22 18:01:02 -0300416
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300417#define sms_err(fmt, arg...) \
418 printk(KERN_ERR "%s " fmt "\n", __func__, ##arg)
419#define sms_info(fmt, arg...) \
420 printk(KERN_INFO "%s " fmt "\n", __func__, ##arg)
421#define sms_debug(fmt, arg...) \
422 printk(KERN_DEBUG "%s " fmt "\n", __func__, ##arg)
Michael Krufky068d6c02008-06-19 01:15:46 -0300423
424
Michael Krufky82237412008-06-15 15:14:13 -0300425#endif /* __smscoreapi_h__ */