blob: 5e06ade04f43dcb7f3afc51995e504f8c484cd4c [file] [log] [blame]
Steven Toth8d4f9d02008-05-22 18:05:26 -03001/*
2 * Driver for the Siano SMS10xx USB dongle
3 *
4 * Copyright (c) 2008 <TODO: INSERT ALL COPYRIGHT OWNERS and MAINT. NAMES HERE>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *
15 * GNU General Public License for more details.
16 *
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 Toth3dd243782008-05-22 18:01:02 -030025#include "dmxdev.h"
26#include "dvbdev.h"
27#include "dvb_demux.h"
28#include "dvb_frontend.h"
29
Steven Toth955e9ca2008-05-22 15:46:32 -030030/* From sysksyms.h */
31
32#include <linux/version.h>
33#include <linux/device.h>
34#include <linux/list.h>
35#include <linux/mm.h>
36#include <asm/scatterlist.h>
37#include <asm/page.h>
38
39#include <linux/mutex.h>
40
41typedef struct mutex kmutex_t;
42
43#define kmutex_init(_p_) mutex_init(_p_)
44#define kmutex_lock(_p_) mutex_lock(_p_)
45#define kmutex_trylock(_p_) mutex_trylock(_p_)
46#define kmutex_unlock(_p_) mutex_unlock(_p_)
47
48
49/* End sysksyms.h */
50
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030051#ifndef min
52#define min(a,b) (((a) < (b)) ? (a) : (b))
53#endif
54
55#define SMS_ALLOC_ALIGNMENT 128
56#define SMS_DMA_ALIGNMENT 16
57#define SMS_ALIGN_ADDRESS(addr) ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1))
58
59#define SMS_DEVICE_FAMILY2 1
60#define SMS_ROM_NO_RESPONSE 2
61#define SMS_DEVICE_NOT_READY 0x8000000
62
63typedef struct _smscore_device smscore_device_t;
64typedef struct _smscore_client smscore_client_t;
65typedef struct _smscore_buffer smscore_buffer_t;
66
67typedef int (*hotplug_t)(smscore_device_t *coredev, struct device *device, int arrival);
68
69typedef int (*setmode_t)(void *context, int mode);
70typedef void (*detectmode_t)(void *context, int *mode);
71typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
72typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
73typedef int (*preload_t)(void *context);
74typedef int (*postload_t)(void *context);
75
76typedef int (*onresponse_t)(void *context, smscore_buffer_t *cb);
77typedef void (*onremove_t)(void *context);
78
79typedef struct _smscore_buffer
80{
81 // public members, once passed to clients can be changed freely
82 struct list_head entry;
83 int size;
84 int offset;
85
86 // private members, read-only for clients
87 void *p;
88 dma_addr_t phys;
89 unsigned long offset_in_common;
90} *psmscore_buffer_t;
91
92typedef struct _smsdevice_params
93{
94 struct device *device;
95
96 int buffer_size;
97 int num_buffers;
98
99 char devpath[32];
100 unsigned long flags;
101
102 setmode_t setmode_handler;
103 detectmode_t detectmode_handler;
104 sendrequest_t sendrequest_handler;
105 preload_t preload_handler;
106 postload_t postload_handler;
107
108 void *context;
109} smsdevice_params_t;
110
111typedef struct _smsclient_params
112{
113 int initial_id;
114 int data_type;
115 onresponse_t onresponse_handler;
116 onremove_t onremove_handler;
117
118 void *context;
119} smsclient_params_t;
120
Steven Toth9e4fb5e2008-05-22 15:48:54 -0300121/* Begin types.h */
122
123// GPIO definitions for antenna frequency domain control (SMS8021)
124#define SMS_ANTENNA_GPIO_0 1
125#define SMS_ANTENNA_GPIO_1 0
126
127#define BW_8_MHZ 0
128#define BW_7_MHZ 1
129#define BW_6_MHZ 2
130#define BW_5_MHZ 3
131#define BW_ISDBT_1SEG 4
132#define BW_ISDBT_3SEG 5
133
134#define MSG_HDR_FLAG_SPLIT_MSG 4
135
136#define MAX_GPIO_PIN_NUMBER 31
137
138#define HIF_TASK 11
139#define SMS_HOST_LIB 150
140#define DVBT_BDA_CONTROL_MSG_ID 201
141
142#define SMS_MAX_PAYLOAD_SIZE 240
143#define SMS_TUNE_TIMEOUT 500
144
145#define MSG_SMS_GPIO_CONFIG_REQ 507
146#define MSG_SMS_GPIO_CONFIG_RES 508
147#define MSG_SMS_GPIO_SET_LEVEL_REQ 509
148#define MSG_SMS_GPIO_SET_LEVEL_RES 510
149#define MSG_SMS_GPIO_GET_LEVEL_REQ 511
150#define MSG_SMS_GPIO_GET_LEVEL_RES 512
151#define MSG_SMS_RF_TUNE_REQ 561
152#define MSG_SMS_RF_TUNE_RES 562
153#define MSG_SMS_INIT_DEVICE_REQ 578
154#define MSG_SMS_INIT_DEVICE_RES 579
155#define MSG_SMS_ADD_PID_FILTER_REQ 601
156#define MSG_SMS_ADD_PID_FILTER_RES 602
157#define MSG_SMS_REMOVE_PID_FILTER_REQ 603
158#define MSG_SMS_REMOVE_PID_FILTER_RES 604
159#define MSG_SMS_DAB_CHANNEL 607
160#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
161#define MSG_SMS_GET_PID_FILTER_LIST_RES 609
162#define MSG_SMS_GET_STATISTICS_REQ 615
163#define MSG_SMS_GET_STATISTICS_RES 616
164#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
165#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
166#define MSG_SMS_GET_STATISTICS_EX_REQ 653
167#define MSG_SMS_GET_STATISTICS_EX_RES 654
168#define MSG_SMS_SLEEP_RESUME_COMP_IND 655
169#define MSG_SMS_DATA_DOWNLOAD_REQ 660
170#define MSG_SMS_DATA_DOWNLOAD_RES 661
171#define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664
172#define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665
173#define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666
174#define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667
175#define MSG_SMS_GET_VERSION_EX_REQ 668
176#define MSG_SMS_GET_VERSION_EX_RES 669
177#define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670
178#define MSG_SMS_I2C_SET_FREQ_REQ 685
179#define MSG_SMS_GENERIC_I2C_REQ 687
180#define MSG_SMS_GENERIC_I2C_RES 688
181#define MSG_SMS_DVBT_BDA_DATA 693
182#define MSG_SW_RELOAD_REQ 697
183#define MSG_SMS_DATA_MSG 699
184#define MSG_SW_RELOAD_START_REQ 702
185#define MSG_SW_RELOAD_START_RES 703
186#define MSG_SW_RELOAD_EXEC_REQ 704
187#define MSG_SW_RELOAD_EXEC_RES 705
188#define MSG_SMS_SPI_INT_LINE_SET_REQ 710
189#define MSG_SMS_ISDBT_TUNE_REQ 776
190#define MSG_SMS_ISDBT_TUNE_RES 777
191
192#define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
193 (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \
194 (ptr)->msgLength = len; (ptr)->msgFlags = 0; \
195} while (0)
196#define SMS_INIT_MSG(ptr, type, len) SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
197
198typedef enum
199{
200 DEVICE_MODE_NONE = -1,
201 DEVICE_MODE_DVBT = 0,
202 DEVICE_MODE_DVBH,
203 DEVICE_MODE_DAB_TDMB,
204 DEVICE_MODE_DAB_TDMB_DABIP,
205 DEVICE_MODE_DVBT_BDA,
206 DEVICE_MODE_ISDBT,
207 DEVICE_MODE_ISDBT_BDA,
208 DEVICE_MODE_CMMB,
209 DEVICE_MODE_RAW_TUNER,
210 DEVICE_MODE_MAX,
211} SMS_DEVICE_MODE;
212
213typedef unsigned char UINT8;
214typedef unsigned short UINT16;
215typedef unsigned int UINT32;
216typedef int INT32;
217
218typedef struct SmsMsgHdr_S
219{
220 UINT16 msgType;
221 UINT8 msgSrcId;
222 UINT8 msgDstId;
223 UINT16 msgLength; // Length is of the entire message, including header
224 UINT16 msgFlags;
225} SmsMsgHdr_ST;
226
227typedef struct SmsMsgData_S
228{
229 SmsMsgHdr_ST xMsgHeader;
230 UINT32 msgData[1];
231} SmsMsgData_ST;
232
233typedef struct SmsDataDownload_S
234{
235 SmsMsgHdr_ST xMsgHeader;
236 UINT32 MemAddr;
237 UINT8 Payload[SMS_MAX_PAYLOAD_SIZE];
238} SmsDataDownload_ST;
239
240typedef struct SmsVersionRes_S
241{
242 SmsMsgHdr_ST xMsgHeader;
243
244 UINT16 ChipModel; // e.g. 0x1102 for SMS-1102 "Nova"
245 UINT8 Step; // 0 - Step A
246 UINT8 MetalFix; // 0 - Metal 0
247
248 UINT8 FirmwareId; // 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E
249 UINT8 SupportedProtocols; // Bitwise OR combination of supported protocols
250
251 UINT8 VersionMajor;
252 UINT8 VersionMinor;
253 UINT8 VersionPatch;
254 UINT8 VersionFieldPatch;
255
256 UINT8 RomVersionMajor;
257 UINT8 RomVersionMinor;
258 UINT8 RomVersionPatch;
259 UINT8 RomVersionFieldPatch;
260
261 UINT8 TextLabel[34];
262} SmsVersionRes_ST;
263
264typedef struct SmsFirmware_S
265{
266 UINT32 CheckSum;
267 UINT32 Length;
268 UINT32 StartAddress;
269 UINT8 Payload[1];
270} SmsFirmware_ST;
271
272typedef struct SMSHOSTLIB_STATISTICS_S
273{
274 UINT32 Reserved; //!< Reserved
275
276 /// Common parameters
277 UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked
278 UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked
279 UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on
280
281 /// Reception quality
282 INT32 SNR; //!< dB
283 UINT32 BER; //!< Post Viterbi BER [1E-5]
284 UINT32 FIB_CRC; //!< CRC errors percentage, valid only for DAB
285 UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H
286 UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H
287 INT32 RSSI; //!< dBm
288 INT32 InBandPwr; //!< In band power in dBM
289 INT32 CarrierOffset; //!< Carrier Offset in bin/1024
290
291 /// Transmission parameters
292 UINT32 Frequency; //!< Frequency in Hz
293 UINT32 Bandwidth; //!< Bandwidth in MHz, valid only for DVB-T/H
294 UINT32 TransmissionMode; //!< Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos
295 UINT32 ModemState; //!< from SMS_DvbModemState_ET , valid only for DVB-T/H
296 UINT32 GuardInterval; //!< Guard Interval, 1 divided by value , valid only for DVB-T/H
297 UINT32 CodeRate; //!< Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H
298 UINT32 LPCodeRate; //!< Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H
299 UINT32 Hierarchy; //!< Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H
300 UINT32 Constellation; //!< Constellation from SMS_Constellation_ET, valid only for DVB-T/H
301
302 /// Burst parameters, valid only for DVB-H
303 UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H
304 UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H
305 UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H
306 UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H
307 UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H
308 UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H
309 UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H
310 UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets
311 UINT32 TotalTSPackets; //!< Total number of transport-stream packets
312 UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding
313 UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding
314 UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding
315 /// Common params
316 UINT32 BERErrorCount; //!< Number of errornous SYNC bits.
317 UINT32 BERBitCount; //!< Total number of SYNC bits.
318
319 /// Interface information
320 UINT32 SmsToHostTxErrors; //!< Total number of transmission errors.
321
322 /// DAB/T-DMB
323 UINT32 PreBER; //!< DAB/T-DMB only: Pre Viterbi BER [1E-5]
324
325 /// DVB-H TPS parameters
326 UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered
327
328} SMSHOSTLIB_STATISTICS_ST;
329
330typedef struct
331{
332 UINT32 RequestResult;
333
334 SMSHOSTLIB_STATISTICS_ST Stat;
335
336 // Split the calc of the SNR in DAB
337 UINT32 Signal; //!< dB
338 UINT32 Noise; //!< dB
339
340} SmsMsgStatisticsInfo_ST;
341
342typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S
343{
344 // Per-layer information
345 UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist
346 UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist
347 UINT32 BER; //!< Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A
348 UINT32 BERErrorCount; //!< Post Viterbi Error Bits Count
349 UINT32 BERBitCount; //!< Post Viterbi Total Bits Count
350 UINT32 PreBER; //!< Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A
351 UINT32 TS_PER; //!< Transport stream PER [%], 0xFFFFFFFF indicate N/A
352 UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets
353 UINT32 TotalTSPackets; //!< Total number of transport-stream packets
354 UINT32 TILdepthI; //!< Time interleaver depth I parameter, 255 means layer does not exist
355 UINT32 NumberOfSegments; //!< Number of segments in layer A, 255 means layer does not exist
356 UINT32 TMCCErrors; //!< TMCC errors
357} SMSHOSTLIB_ISDBT_LAYER_STAT_ST;
358
359typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S
360{
361 UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E
362 //!< This fiels MUST always first in any statistics structure
363
364 UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by
365 //!< the host is smaller than FullSize, the struct will be truncated
366
367 // Common parameters
368 UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked
369 UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked
370 UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on
371
372 // Reception quality
373 INT32 SNR; //!< dB
374 INT32 RSSI; //!< dBm
375 INT32 InBandPwr; //!< In band power in dBM
376 INT32 CarrierOffset; //!< Carrier Offset in Hz
377
378 // Transmission parameters
379 UINT32 Frequency; //!< Frequency in Hz
380 UINT32 Bandwidth; //!< Bandwidth in MHz
381 UINT32 TransmissionMode; //!< ISDB-T transmission mode
382 UINT32 ModemState; //!< 0 - Acquisition, 1 - Locked
383 UINT32 GuardInterval; //!< Guard Interval, 1 divided by value
384 UINT32 SystemType; //!< ISDB-T system type (ISDB-T / ISDB-Tsb)
385 UINT32 PartialReception; //!< TRUE - partial reception, FALSE otherwise
386 UINT32 NumOfLayers; //!< Number of ISDB-T layers in the network
387
388 // Per-layer information
389 // Layers A, B and C
390 SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; //!< Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST
391
392 // Interface information
393 UINT32 SmsToHostTxErrors; //!< Total number of transmission errors.
394
395} SMSHOSTLIB_STATISTICS_ISDBT_ST;
396
397typedef struct SMSHOSTLIB_STATISTICS_DVB_S
398{
399 UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E
400 //!< This fiels MUST always first in any statistics structure
401
402 UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by
403 //!< the host is smaller than FullSize, the struct will be truncated
404 // Common parameters
405 UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked
406 UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked
407 UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on
408
409 // Reception quality
410 INT32 SNR; //!< dB
411 UINT32 BER; //!< Post Viterbi BER [1E-5]
412 UINT32 BERErrorCount; //!< Number of errornous SYNC bits.
413 UINT32 BERBitCount; //!< Total number of SYNC bits.
414 UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A
415 UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H
416 INT32 RSSI; //!< dBm
417 INT32 InBandPwr; //!< In band power in dBM
418 INT32 CarrierOffset; //!< Carrier Offset in bin/1024
419
420 // Transmission parameters
421 UINT32 Frequency; //!< Frequency in Hz
422 UINT32 Bandwidth; //!< Bandwidth in MHz
423 UINT32 ModemState; //!< from SMSHOSTLIB_DVB_MODEM_STATE_ET
424 UINT32 TransmissionMode; //!< FFT mode carriers in Kilos
425 UINT32 GuardInterval; //!< Guard Interval, 1 divided by value
426 UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET
427 UINT32 LPCodeRate; //!< Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET
428 UINT32 Hierarchy; //!< Hierarchy from SMSHOSTLIB_HIERARCHY_ET
429 UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET
430
431 // Burst parameters, valid only for DVB-H
432 UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H
433 UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H
434 UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H
435 UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H
436 UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H
437 UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H
438 UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H
439 UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets
440 UINT32 TotalTSPackets; //!< Total number of transport-stream packets
441 UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H
442 UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H
443 UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H
444 UINT32 NumMPEReceived; //!< DVB-H, Num MPE section received
445
446 // DVB-H TPS parameters
447 UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered
448 UINT32 DvbhSrvIndHP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator
449 UINT32 DvbhSrvIndLP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator
450
451 // Interface information
452 UINT32 SmsToHostTxErrors; //!< Total number of transmission errors.
453
454} SMSHOSTLIB_STATISTICS_DVB_ST;
455
456typedef struct SMSHOSTLIB_GPIO_CONFIG_S
457{
458 UINT8 Direction; //!< GPIO direction: Input - 0, Output - 1
459 UINT8 PullUpDown; //!< PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3
460 UINT8 InputCharacteristics; //!< Input Characteristics: Normal - 0, Schmitt trigger - 1
461 UINT8 OutputSlewRate; //!< Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1
462 UINT8 OutputDriving; //!< Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3
463} SMSHOSTLIB_GPIO_CONFIG_ST;
464
465typedef struct SMSHOSTLIB_I2C_REQ_S
466{
467 UINT32 DeviceAddress; // I2c device address
468 UINT32 WriteCount; // number of bytes to write
469 UINT32 ReadCount; // number of bytes to read
470 UINT8 Data[1];
471} SMSHOSTLIB_I2C_REQ_ST;
472
473typedef struct SMSHOSTLIB_I2C_RES_S
474{
475 UINT32 Status; // non-zero value in case of failure
476 UINT32 ReadCount; // number of bytes read
477 UINT8 Data[1];
478} SMSHOSTLIB_I2C_RES_ST;
479
480/* End types.h */
481
Steven Toth3dd243782008-05-22 18:01:02 -0300482typedef struct _smsdvb_client
483{
484 struct list_head entry;
485
486 smscore_device_t *coredev;
487 smscore_client_t *smsclient;
488
489 struct dvb_adapter adapter;
490 struct dvb_demux demux;
491 struct dmxdev dmxdev;
492 struct dvb_frontend frontend;
493
494 fe_status_t fe_status;
495 int fe_ber, fe_snr, fe_signal_strength;
496
497 struct completion tune_done, stat_done;
498
499 // todo: save freq/band instead whole struct
500 struct dvb_frontend_parameters fe_params;
501
502} smsdvb_client_t;
503
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300504extern void smscore_registry_setmode(char *devpath, int mode);
505extern int smscore_registry_getmode(char *devpath);
506
507extern int smscore_register_hotplug(hotplug_t hotplug);
508extern void smscore_unregister_hotplug(hotplug_t hotplug);
509
510extern int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev);
511extern void smscore_unregister_device(smscore_device_t *coredev);
512
513extern int smscore_start_device(smscore_device_t *coredev);
514extern int smscore_load_firmware(smscore_device_t *coredev, char* filename, loadfirmware_t loadfirmware_handler);
515
516extern int smscore_set_device_mode(smscore_device_t *coredev, int mode);
517extern int smscore_get_device_mode(smscore_device_t *coredev);
518
519extern int smscore_register_client(smscore_device_t *coredev, smsclient_params_t* params, smscore_client_t **client);
520extern void smscore_unregister_client(smscore_client_t *client);
521
522extern int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size);
523extern void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb);
524
525extern int smscore_get_common_buffer_size(smscore_device_t *coredev);
526extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma);
527
528extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev);
529extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb);
530
Steven Toth3dd243782008-05-22 18:01:02 -0300531/* smsdvb.c */
Steven Totheae55662008-05-22 18:04:36 -0300532int smsdvb_register(void);
533void smsdvb_unregister(void);
534
535/* smsusb.c */
536int smsusb_register(void);
537void smsusb_unregister(void);
Steven Toth3dd243782008-05-22 18:01:02 -0300538
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300539#endif // __smscoreapi_h__