aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano/smscoreapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/siano/smscoreapi.h')
-rw-r--r--drivers/media/dvb/siano/smscoreapi.h299
1 files changed, 60 insertions, 239 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h
index f0675cf4cef3..be98baf3085e 100644
--- a/drivers/media/dvb/siano/smscoreapi.h
+++ b/drivers/media/dvb/siano/smscoreapi.h
@@ -57,19 +57,19 @@ typedef struct mutex kmutex_t;
57#define SMS_ROM_NO_RESPONSE 2 57#define SMS_ROM_NO_RESPONSE 2
58#define SMS_DEVICE_NOT_READY 0x8000000 58#define SMS_DEVICE_NOT_READY 0x8000000
59 59
60typedef enum { 60enum sms_device_type_st {
61 SMS_STELLAR = 0, 61 SMS_STELLAR = 0,
62 SMS_NOVA_A0, 62 SMS_NOVA_A0,
63 SMS_NOVA_B0, 63 SMS_NOVA_B0,
64 SMS_VEGA, 64 SMS_VEGA,
65 SMS_NUM_OF_DEVICE_TYPES 65 SMS_NUM_OF_DEVICE_TYPES
66} sms_device_type_st; 66};
67 67
68typedef struct _smscore_device smscore_device_t; 68struct smscore_device_t;
69typedef struct _smscore_client smscore_client_t; 69struct smscore_client_t;
70typedef struct _smscore_buffer smscore_buffer_t; 70struct smscore_buffer_t;
71 71
72typedef int (*hotplug_t)(smscore_device_t *coredev, 72typedef int (*hotplug_t)(struct smscore_device_t *coredev,
73 struct device *device, int arrival); 73 struct device *device, int arrival);
74 74
75typedef int (*setmode_t)(void *context, int mode); 75typedef int (*setmode_t)(void *context, int mode);
@@ -79,11 +79,10 @@ typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
79typedef int (*preload_t)(void *context); 79typedef int (*preload_t)(void *context);
80typedef int (*postload_t)(void *context); 80typedef int (*postload_t)(void *context);
81 81
82typedef int (*onresponse_t)(void *context, smscore_buffer_t *cb); 82typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb);
83typedef void (*onremove_t)(void *context); 83typedef void (*onremove_t)(void *context);
84 84
85typedef struct _smscore_buffer 85struct smscore_buffer_t {
86{
87 /* public members, once passed to clients can be changed freely */ 86 /* public members, once passed to clients can be changed freely */
88 struct list_head entry; 87 struct list_head entry;
89 int size; 88 int size;
@@ -93,10 +92,9 @@ typedef struct _smscore_buffer
93 void *p; 92 void *p;
94 dma_addr_t phys; 93 dma_addr_t phys;
95 unsigned long offset_in_common; 94 unsigned long offset_in_common;
96} *psmscore_buffer_t; 95};
97 96
98typedef struct _smsdevice_params 97struct smsdevice_params_t {
99{
100 struct device *device; 98 struct device *device;
101 99
102 int buffer_size; 100 int buffer_size;
@@ -112,18 +110,17 @@ typedef struct _smsdevice_params
112 postload_t postload_handler; 110 postload_t postload_handler;
113 111
114 void *context; 112 void *context;
115 sms_device_type_st device_type; 113 enum sms_device_type_st device_type;
116} smsdevice_params_t; 114};
117 115
118typedef struct _smsclient_params 116struct smsclient_params_t {
119{
120 int initial_id; 117 int initial_id;
121 int data_type; 118 int data_type;
122 onresponse_t onresponse_handler; 119 onresponse_t onresponse_handler;
123 onremove_t onremove_handler; 120 onremove_t onremove_handler;
124 121
125 void *context; 122 void *context;
126} smsclient_params_t; 123};
127 124
128/* GPIO definitions for antenna frequency domain control (SMS8021) */ 125/* GPIO definitions for antenna frequency domain control (SMS8021) */
129#define SMS_ANTENNA_GPIO_0 1 126#define SMS_ANTENNA_GPIO_0 1
@@ -201,8 +198,7 @@ typedef struct _smsclient_params
201#define SMS_INIT_MSG(ptr, type, len) \ 198#define SMS_INIT_MSG(ptr, type, len) \
202 SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len) 199 SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
203 200
204typedef enum 201enum SMS_DEVICE_MODE {
205{
206 DEVICE_MODE_NONE = -1, 202 DEVICE_MODE_NONE = -1,
207 DEVICE_MODE_DVBT = 0, 203 DEVICE_MODE_DVBT = 0,
208 DEVICE_MODE_DVBH, 204 DEVICE_MODE_DVBH,
@@ -214,33 +210,29 @@ typedef enum
214 DEVICE_MODE_CMMB, 210 DEVICE_MODE_CMMB,
215 DEVICE_MODE_RAW_TUNER, 211 DEVICE_MODE_RAW_TUNER,
216 DEVICE_MODE_MAX, 212 DEVICE_MODE_MAX,
217} SMS_DEVICE_MODE; 213};
218 214
219typedef struct SmsMsgHdr_S 215struct SmsMsgHdr_ST {
220{
221 u16 msgType; 216 u16 msgType;
222 u8 msgSrcId; 217 u8 msgSrcId;
223 u8 msgDstId; 218 u8 msgDstId;
224 u16 msgLength; /* Length of entire message, including header */ 219 u16 msgLength; /* Length of entire message, including header */
225 u16 msgFlags; 220 u16 msgFlags;
226} SmsMsgHdr_ST; 221};
227 222
228typedef struct SmsMsgData_S 223struct SmsMsgData_ST {
229{ 224 struct SmsMsgHdr_ST xMsgHeader;
230 SmsMsgHdr_ST xMsgHeader;
231 u32 msgData[1]; 225 u32 msgData[1];
232} SmsMsgData_ST; 226};
233 227
234typedef struct SmsDataDownload_S 228struct SmsDataDownload_ST {
235{ 229 struct SmsMsgHdr_ST xMsgHeader;
236 SmsMsgHdr_ST xMsgHeader;
237 u32 MemAddr; 230 u32 MemAddr;
238 u8 Payload[SMS_MAX_PAYLOAD_SIZE]; 231 u8 Payload[SMS_MAX_PAYLOAD_SIZE];
239} SmsDataDownload_ST; 232};
240 233
241typedef struct SmsVersionRes_S 234struct SmsVersionRes_ST {
242{ 235 struct SmsMsgHdr_ST xMsgHeader;
243 SmsMsgHdr_ST xMsgHeader;
244 236
245 u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */ 237 u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */
246 u8 Step; /* 0 - Step A */ 238 u8 Step; /* 0 - Step A */
@@ -263,18 +255,16 @@ typedef struct SmsVersionRes_S
263 u8 RomVersionFieldPatch; 255 u8 RomVersionFieldPatch;
264 256
265 u8 TextLabel[34]; 257 u8 TextLabel[34];
266} SmsVersionRes_ST; 258};
267 259
268typedef struct SmsFirmware_S 260struct SmsFirmware_ST {
269{
270 u32 CheckSum; 261 u32 CheckSum;
271 u32 Length; 262 u32 Length;
272 u32 StartAddress; 263 u32 StartAddress;
273 u8 Payload[1]; 264 u8 Payload[1];
274} SmsFirmware_ST; 265};
275 266
276typedef struct SMSHOSTLIB_STATISTICS_S 267struct SMSHOSTLIB_STATISTICS_ST {
277{
278 u32 Reserved; /* Reserved */ 268 u32 Reserved; /* Reserved */
279 269
280 /* Common parameters */ 270 /* Common parameters */
@@ -339,196 +329,25 @@ typedef struct SMSHOSTLIB_STATISTICS_S
339 u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; 329 u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
340 * if set to 0xFFFFFFFF cell_id not yet recovered */ 330 * if set to 0xFFFFFFFF cell_id not yet recovered */
341 331
342} SMSHOSTLIB_STATISTICS_ST; 332};
343 333
344typedef struct 334struct SmsMsgStatisticsInfo_ST {
345{
346 u32 RequestResult; 335 u32 RequestResult;
347 336
348 SMSHOSTLIB_STATISTICS_ST Stat; 337 struct SMSHOSTLIB_STATISTICS_ST Stat;
349 338
350 /* Split the calc of the SNR in DAB */ 339 /* Split the calc of the SNR in DAB */
351 u32 Signal; /* dB */ 340 u32 Signal; /* dB */
352 u32 Noise; /* dB */ 341 u32 Noise; /* dB */
353 342
354} SmsMsgStatisticsInfo_ST; 343};
355
356typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S
357{
358 /* Per-layer information */
359 u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
360 * 255 means layer does not exist */
361 u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET,
362 * 255 means layer does not exist */
363 u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
364 u32 BERErrorCount; /* Post Viterbi Error Bits Count */
365 u32 BERBitCount; /* Post Viterbi Total Bits Count */
366 u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
367 u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */
368 u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
369 u32 TotalTSPackets; /* Total number of transport-stream packets */
370 u32 TILdepthI; /* Time interleaver depth I parameter,
371 * 255 means layer does not exist */
372 u32 NumberOfSegments; /* Number of segments in layer A,
373 * 255 means layer does not exist */
374 u32 TMCCErrors; /* TMCC errors */
375} SMSHOSTLIB_ISDBT_LAYER_STAT_ST;
376
377typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S
378{
379 u32 StatisticsType; /* Enumerator identifying the type of the
380 * structure. Values are the same as
381 * SMSHOSTLIB_DEVICE_MODES_E
382 *
383 * This field MUST always be first in any
384 * statistics structure */
385
386 u32 FullSize; /* Total size of the structure returned by the modem.
387 * If the size requested by the host is smaller than
388 * FullSize, the struct will be truncated */
389
390 /* Common parameters */
391 u32 IsRfLocked; /* 0 - not locked, 1 - locked */
392 u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
393 u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
394
395 /* Reception quality */
396 s32 SNR; /* dB */
397 s32 RSSI; /* dBm */
398 s32 InBandPwr; /* In band power in dBM */
399 s32 CarrierOffset; /* Carrier Offset in Hz */
400
401 /* Transmission parameters */
402 u32 Frequency; /* Frequency in Hz */
403 u32 Bandwidth; /* Bandwidth in MHz */
404 u32 TransmissionMode; /* ISDB-T transmission mode */
405 u32 ModemState; /* 0 - Acquisition, 1 - Locked */
406 u32 GuardInterval; /* Guard Interval, 1 divided by value */
407 u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
408 u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */
409 u32 NumOfLayers; /* Number of ISDB-T layers in the network */
410
411 /* Per-layer information */
412 /* Layers A, B and C */
413 SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; /* Per-layer statistics,
414 see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */
415 344
416 /* Interface information */
417 u32 SmsToHostTxErrors; /* Total number of transmission errors. */
418
419} SMSHOSTLIB_STATISTICS_ISDBT_ST;
420
421typedef struct SMSHOSTLIB_STATISTICS_DVB_S
422{
423 u32 StatisticsType; /* Enumerator identifying the type of the
424 * structure. Values are the same as
425 * SMSHOSTLIB_DEVICE_MODES_E
426 * This field MUST always first in any
427 * statistics structure */
428
429 u32 FullSize; /* Total size of the structure returned by the modem.
430 * If the size requested by the host is smaller than
431 * FullSize, the struct will be truncated */
432 /* Common parameters */
433 u32 IsRfLocked; /* 0 - not locked, 1 - locked */
434 u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
435 u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
436
437 /* Reception quality */
438 s32 SNR; /* dB */
439 u32 BER; /* Post Viterbi BER [1E-5] */
440 u32 BERErrorCount; /* Number of errornous SYNC bits. */
441 u32 BERBitCount; /* Total number of SYNC bits. */
442 u32 TS_PER; /* Transport stream PER, 0xFFFFFFFF indicate N/A */
443 u32 MFER; /* DVB-H frame error rate in percentage,
444 * 0xFFFFFFFF indicate N/A, valid only for DVB-H */
445 s32 RSSI; /* dBm */
446 s32 InBandPwr; /* In band power in dBM */
447 s32 CarrierOffset; /* Carrier Offset in bin/1024 */
448
449 /* Transmission parameters */
450 u32 Frequency; /* Frequency in Hz */
451 u32 Bandwidth; /* Bandwidth in MHz */
452 u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
453 u32 TransmissionMode; /* FFT mode carriers in Kilos */
454 u32 GuardInterval; /* Guard Interval, 1 divided by value */
455 u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */
456 u32 LPCodeRate; /* Low Priority Code Rate from
457 * SMSHOSTLIB_CODE_RATE_ET */
458 u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */
459 u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET */
460
461 /* Burst parameters, valid only for DVB-H */
462 u32 BurstSize; /* Current burst size in bytes */
463 u32 BurstDuration; /* Current burst duration in mSec */
464 u32 BurstCycleTime; /* Current burst cycle time in mSec */
465 u32 CalculatedBurstCycleTime; /* Current burst cycle time in mSec,
466 * as calculated by demodulator */
467 u32 NumOfRows; /* Number of rows in MPE table */
468 u32 NumOfPaddCols; /* Number of padding columns in MPE table */
469 u32 NumOfPunctCols; /* Number of puncturing columns in MPE table */
470
471 u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
472 u32 TotalTSPackets; /* Total number of transport-stream packets */
473
474 u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
475 * errors after MPE RS decoding */
476 u32 NumOfInvalidMpeTlbs; /* Number of MPE tables which include
477 * errors after MPE RS decoding */
478 u32 NumOfCorrectedMpeTlbs; /* Number of MPE tables which were
479 * corrected by MPE RS decoding */
480
481 u32 NumMPEReceived; /* DVB-H, Num MPE section received */
482
483 /* DVB-H TPS parameters */
484 u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
485 * if set to 0xFFFFFFFF cell_id not yet recovered */
486 u32 DvbhSrvIndHP; /* DVB-H service indication info,
487 * bit 1 - Time Slicing indicator,
488 * bit 0 - MPE-FEC indicator */
489 u32 DvbhSrvIndLP; /* DVB-H service indication info,
490 * bit 1 - Time Slicing indicator,
491 * bit 0 - MPE-FEC indicator */
492
493 /* Interface information */
494 u32 SmsToHostTxErrors; /* Total number of transmission errors. */
495 345
496} SMSHOSTLIB_STATISTICS_DVB_ST; 346struct smsdvb_client_t {
497
498typedef struct SMSHOSTLIB_GPIO_CONFIG_S
499{
500 u8 Direction; /* GPIO direction: Input - 0, Output - 1 */
501 u8 PullUpDown; /* PullUp/PullDown: None - 0,
502 * PullDown - 1, PullUp - 2, Keeper - 3 */
503 u8 InputCharacteristics; /* Input Characteristics: Normal - 0,
504 * Schmitt trigger - 1 */
505 u8 OutputSlewRate; /* Output Slew Rate:
506 * Fast slew rate - 0, Slow slew rate - 1 */
507 u8 OutputDriving; /* Output driving capability:
508 * 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 */
509} SMSHOSTLIB_GPIO_CONFIG_ST;
510
511typedef struct SMSHOSTLIB_I2C_REQ_S
512{
513 u32 DeviceAddress; /* I2c device address */
514 u32 WriteCount; /* number of bytes to write */
515 u32 ReadCount; /* number of bytes to read */
516 u8 Data[1];
517} SMSHOSTLIB_I2C_REQ_ST;
518
519typedef struct SMSHOSTLIB_I2C_RES_S
520{
521 u32 Status; /* non-zero value in case of failure */
522 u32 ReadCount; /* number of bytes read */
523 u8 Data[1];
524} SMSHOSTLIB_I2C_RES_ST;
525
526typedef struct _smsdvb_client
527{
528 struct list_head entry; 347 struct list_head entry;
529 348
530 smscore_device_t *coredev; 349 struct smscore_device_t *coredev;
531 smscore_client_t *smsclient; 350 struct smscore_client_t *smsclient;
532 351
533 struct dvb_adapter adapter; 352 struct dvb_adapter adapter;
534 struct dvb_demux demux; 353 struct dvb_demux demux;
@@ -543,7 +362,7 @@ typedef struct _smsdvb_client
543 /* todo: save freq/band instead whole struct */ 362 /* todo: save freq/band instead whole struct */
544 struct dvb_frontend_parameters fe_params; 363 struct dvb_frontend_parameters fe_params;
545 364
546} smsdvb_client_t; 365};
547 366
548extern void smscore_registry_setmode(char *devpath, int mode); 367extern void smscore_registry_setmode(char *devpath, int mode);
549extern int smscore_registry_getmode(char *devpath); 368extern int smscore_registry_getmode(char *devpath);
@@ -551,37 +370,39 @@ extern int smscore_registry_getmode(char *devpath);
551extern int smscore_register_hotplug(hotplug_t hotplug); 370extern int smscore_register_hotplug(hotplug_t hotplug);
552extern void smscore_unregister_hotplug(hotplug_t hotplug); 371extern void smscore_unregister_hotplug(hotplug_t hotplug);
553 372
554extern int smscore_register_device(smsdevice_params_t *params, 373extern int smscore_register_device(struct smsdevice_params_t *params,
555 smscore_device_t **coredev); 374 struct smscore_device_t **coredev);
556extern void smscore_unregister_device(smscore_device_t *coredev); 375extern void smscore_unregister_device(struct smscore_device_t *coredev);
557 376
558extern int smscore_start_device(smscore_device_t *coredev); 377extern int smscore_start_device(struct smscore_device_t *coredev);
559extern int smscore_load_firmware(smscore_device_t *coredev, char *filename, 378extern int smscore_load_firmware(struct smscore_device_t *coredev,
560 loadfirmware_t loadfirmware_handler); 379 char *filename,
380 loadfirmware_t loadfirmware_handler);
561 381
562extern int smscore_load_firmware_from_buffer(smscore_device_t *coredev, 382extern int smscore_load_firmware_from_buffer(struct smscore_device_t *coredev,
563 u8 *buffer, int size, 383 u8 *buffer, int size,
564 int new_mode); 384 int new_mode);
565 385
566extern int smscore_set_device_mode(smscore_device_t *coredev, int mode); 386extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
567extern int smscore_get_device_mode(smscore_device_t *coredev); 387extern int smscore_get_device_mode(struct smscore_device_t *coredev);
568 388
569extern int smscore_register_client(smscore_device_t *coredev, 389extern int smscore_register_client(struct smscore_device_t *coredev,
570 smsclient_params_t *params, 390 struct smsclient_params_t *params,
571 smscore_client_t **client); 391 struct smscore_client_t **client);
572extern void smscore_unregister_client(smscore_client_t *client); 392extern void smscore_unregister_client(struct smscore_client_t *client);
573 393
574extern int smsclient_sendrequest(smscore_client_t *client, 394extern int smsclient_sendrequest(struct smscore_client_t *client,
575 void *buffer, size_t size); 395 void *buffer, size_t size);
576extern void smscore_onresponse(smscore_device_t *coredev, 396extern void smscore_onresponse(struct smscore_device_t *coredev,
577 smscore_buffer_t *cb); 397 struct smscore_buffer_t *cb);
578 398
579extern int smscore_get_common_buffer_size(smscore_device_t *coredev); 399extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
580extern int smscore_map_common_buffer(smscore_device_t *coredev, 400extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
581 struct vm_area_struct *vma); 401 struct vm_area_struct *vma);
582 402
583extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); 403extern struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
584extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); 404extern void smscore_putbuffer(struct smscore_device_t *coredev,
405 struct smscore_buffer_t *cb);
585 406
586/* smsdvb.c */ 407/* smsdvb.c */
587int smsdvb_register(void); 408int smsdvb_register(void);