]> err.no Git - linux-2.6/blob - drivers/media/mdtv/smstypes.h
V4L/DVB (8258): add support for SMS1010 and SMS1150 based digital television devices
[linux-2.6] / drivers / media / mdtv / smstypes.h
1 #ifndef __smstypes_h__
2 #define __smstypes_h__
3
4 // GPIO definitions for antenna frequency domain control (SMS8021)
5 #define SMS_ANTENNA_GPIO_0                                      1
6 #define SMS_ANTENNA_GPIO_1                                      0
7
8 #define BW_8_MHZ                                                        0
9 #define BW_7_MHZ                                                        1
10 #define BW_6_MHZ                                                        2
11 #define BW_5_MHZ                                                        3
12 #define BW_ISDBT_1SEG                                           4
13 #define BW_ISDBT_3SEG                                           5
14
15 #define MSG_HDR_FLAG_SPLIT_MSG                          4
16
17 #define MAX_GPIO_PIN_NUMBER                                     31
18
19 #define HIF_TASK                                                        11
20 #define SMS_HOST_LIB                                            150
21 #define DVBT_BDA_CONTROL_MSG_ID                         201
22
23 #define SMS_MAX_PAYLOAD_SIZE                            240
24 #define SMS_TUNE_TIMEOUT                                        500
25
26 #define MSG_SMS_GPIO_CONFIG_REQ                         507
27 #define MSG_SMS_GPIO_CONFIG_RES                         508
28 #define MSG_SMS_GPIO_SET_LEVEL_REQ                      509
29 #define MSG_SMS_GPIO_SET_LEVEL_RES                      510
30 #define MSG_SMS_GPIO_GET_LEVEL_REQ                      511
31 #define MSG_SMS_GPIO_GET_LEVEL_RES                      512
32 #define MSG_SMS_RF_TUNE_REQ                                     561
33 #define MSG_SMS_RF_TUNE_RES                                     562
34 #define MSG_SMS_INIT_DEVICE_REQ                         578
35 #define MSG_SMS_INIT_DEVICE_RES                         579
36 #define MSG_SMS_ADD_PID_FILTER_REQ                      601
37 #define MSG_SMS_ADD_PID_FILTER_RES                      602
38 #define MSG_SMS_REMOVE_PID_FILTER_REQ           603
39 #define MSG_SMS_REMOVE_PID_FILTER_RES           604
40 #define MSG_SMS_DAB_CHANNEL                                     607
41 #define MSG_SMS_GET_PID_FILTER_LIST_REQ         608
42 #define MSG_SMS_GET_PID_FILTER_LIST_RES         609
43 #define MSG_SMS_GET_STATISTICS_REQ                      615
44 #define MSG_SMS_GET_STATISTICS_RES                      616
45 #define MSG_SMS_SET_ANTENNA_CONFIG_REQ          651
46 #define MSG_SMS_SET_ANTENNA_CONFIG_RES          652
47 #define MSG_SMS_GET_STATISTICS_EX_REQ           653
48 #define MSG_SMS_GET_STATISTICS_EX_RES           654
49 #define MSG_SMS_SLEEP_RESUME_COMP_IND           655
50 #define MSG_SMS_DATA_DOWNLOAD_REQ                       660
51 #define MSG_SMS_DATA_DOWNLOAD_RES                       661
52 #define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ          664
53 #define MSG_SMS_SWDOWNLOAD_TRIGGER_RES          665
54 #define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ         666
55 #define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES         667
56 #define MSG_SMS_GET_VERSION_EX_REQ                      668
57 #define MSG_SMS_GET_VERSION_EX_RES                      669
58 #define MSG_SMS_SET_CLOCK_OUTPUT_REQ            670
59 #define MSG_SMS_I2C_SET_FREQ_REQ                        685
60 #define MSG_SMS_GENERIC_I2C_REQ                         687
61 #define MSG_SMS_GENERIC_I2C_RES                         688
62 #define MSG_SMS_DVBT_BDA_DATA                           693
63 #define MSG_SW_RELOAD_REQ                                       697
64 #define MSG_SMS_DATA_MSG                                        699
65 #define MSG_SW_RELOAD_START_REQ                         702
66 #define MSG_SW_RELOAD_START_RES                         703
67 #define MSG_SW_RELOAD_EXEC_REQ                          704
68 #define MSG_SW_RELOAD_EXEC_RES                          705
69 #define MSG_SMS_SPI_INT_LINE_SET_REQ            710
70 #define MSG_SMS_ISDBT_TUNE_REQ                          776
71 #define MSG_SMS_ISDBT_TUNE_RES                          777
72
73 #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
74         (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \
75         (ptr)->msgLength = len; (ptr)->msgFlags = 0; \
76 } while (0)
77 #define SMS_INIT_MSG(ptr, type, len) SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
78
79 typedef enum
80 {
81         DEVICE_MODE_NONE = -1,
82         DEVICE_MODE_DVBT = 0,
83         DEVICE_MODE_DVBH,
84         DEVICE_MODE_DAB_TDMB,
85         DEVICE_MODE_DAB_TDMB_DABIP,
86         DEVICE_MODE_DVBT_BDA,
87         DEVICE_MODE_ISDBT,
88         DEVICE_MODE_ISDBT_BDA,
89         DEVICE_MODE_CMMB,
90         DEVICE_MODE_RAW_TUNER,
91         DEVICE_MODE_MAX,
92 } SMS_DEVICE_MODE;
93
94 typedef unsigned char UINT8;
95 typedef unsigned short UINT16;
96 typedef unsigned int UINT32;
97 typedef int INT32;
98
99 typedef struct SmsMsgHdr_S
100 {
101         UINT16  msgType;
102         UINT8   msgSrcId;
103         UINT8   msgDstId;
104         UINT16  msgLength;      // Length is of the entire message, including header
105         UINT16  msgFlags;
106 } SmsMsgHdr_ST;
107
108 typedef struct SmsMsgData_S
109 {
110         SmsMsgHdr_ST    xMsgHeader;
111         UINT32                  msgData[1];
112 } SmsMsgData_ST;
113
114 typedef struct SmsDataDownload_S
115 {
116         SmsMsgHdr_ST    xMsgHeader;
117         UINT32                  MemAddr;
118         UINT8                   Payload[SMS_MAX_PAYLOAD_SIZE];
119 } SmsDataDownload_ST;
120
121 typedef struct SmsVersionRes_S
122 {
123         SmsMsgHdr_ST    xMsgHeader;
124
125         UINT16                  ChipModel;                    // e.g. 0x1102 for SMS-1102 "Nova"
126         UINT8                   Step;                         // 0 - Step A
127         UINT8                   MetalFix;                     // 0 - Metal 0
128
129         UINT8                   FirmwareId;                   // 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E
130         UINT8                   SupportedProtocols;           // Bitwise OR combination of supported protocols
131
132         UINT8                   VersionMajor;
133         UINT8                   VersionMinor;
134         UINT8                   VersionPatch;
135         UINT8                   VersionFieldPatch;
136
137         UINT8                   RomVersionMajor;
138         UINT8                   RomVersionMinor;
139         UINT8                   RomVersionPatch;
140         UINT8                   RomVersionFieldPatch;
141
142         UINT8                   TextLabel[34];
143 } SmsVersionRes_ST;
144
145 typedef struct SmsFirmware_S
146 {
147         UINT32                  CheckSum;
148         UINT32                  Length;
149         UINT32                  StartAddress;
150         UINT8                   Payload[1];
151 } SmsFirmware_ST;
152
153 typedef struct SMSHOSTLIB_STATISTICS_S
154 {
155         UINT32 Reserved;                                //!< Reserved
156
157         /// Common parameters
158         UINT32 IsRfLocked;                              //!< 0 - not locked, 1 - locked
159         UINT32 IsDemodLocked;                   //!< 0 - not locked, 1 - locked
160         UINT32 IsExternalLNAOn;                 //!< 0 - external LNA off, 1 - external LNA on
161
162         /// Reception quality
163         INT32  SNR;                                             //!< dB
164         UINT32 BER;                                             //!< Post Viterbi BER [1E-5]
165         UINT32 FIB_CRC;                                 //!< CRC errors percentage, valid only for DAB
166         UINT32 TS_PER;                                  //!< Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H
167         UINT32 MFER;                                    //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H
168         INT32  RSSI;                                    //!< dBm
169         INT32  InBandPwr;                               //!< In band power in dBM
170         INT32  CarrierOffset;                   //!< Carrier Offset in bin/1024
171
172         /// Transmission parameters
173         UINT32 Frequency;                               //!< Frequency in Hz
174         UINT32 Bandwidth;                               //!< Bandwidth in MHz, valid only for DVB-T/H
175         UINT32 TransmissionMode;                //!< Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos
176         UINT32 ModemState;                              //!< from SMS_DvbModemState_ET , valid only for DVB-T/H
177         UINT32 GuardInterval;                   //!< Guard Interval, 1 divided by value , valid only for DVB-T/H
178         UINT32 CodeRate;                                //!< Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H
179         UINT32 LPCodeRate;                              //!< Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H
180         UINT32 Hierarchy;                               //!< Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H
181         UINT32 Constellation;                   //!< Constellation from SMS_Constellation_ET, valid only for DVB-T/H
182
183         /// Burst parameters, valid only for DVB-H
184         UINT32 BurstSize;                               //!< Current burst size in bytes, valid only for DVB-H
185         UINT32 BurstDuration;                   //!< Current burst duration in mSec, valid only for DVB-H
186         UINT32 BurstCycleTime;                  //!< Current burst cycle time in mSec, valid only for DVB-H
187         UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H
188         UINT32 NumOfRows;                               //!< Number of rows in MPE table, valid only for DVB-H
189         UINT32 NumOfPaddCols;                   //!< Number of padding columns in MPE table, valid only for DVB-H
190         UINT32 NumOfPunctCols;                  //!< Number of puncturing columns in MPE table, valid only for DVB-H
191         UINT32 ErrorTSPackets;                  //!< Number of erroneous transport-stream packets
192         UINT32 TotalTSPackets;                  //!< Total number of transport-stream packets
193         UINT32 NumOfValidMpeTlbs;               //!< Number of MPE tables which do not include errors after MPE RS decoding
194         UINT32 NumOfInvalidMpeTlbs;             //!< Number of MPE tables which include errors after MPE RS decoding
195         UINT32 NumOfCorrectedMpeTlbs;   //!< Number of MPE tables which were corrected by MPE RS decoding
196         /// Common params
197         UINT32 BERErrorCount;                   //!< Number of errornous SYNC bits.
198         UINT32 BERBitCount;                             //!< Total number of SYNC bits.
199
200         /// Interface information
201         UINT32 SmsToHostTxErrors;               //!< Total number of transmission errors.
202
203         /// DAB/T-DMB
204         UINT32 PreBER;                                  //!< DAB/T-DMB only: Pre Viterbi BER [1E-5]
205
206         /// DVB-H TPS parameters
207         UINT32 CellId;                                  //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered
208
209 } SMSHOSTLIB_STATISTICS_ST;
210
211 typedef struct
212 {
213         UINT32 RequestResult;
214
215         SMSHOSTLIB_STATISTICS_ST Stat;
216
217         // Split the calc of the SNR in DAB
218         UINT32 Signal;                          //!< dB
219         UINT32 Noise;                           //!< dB
220
221 } SmsMsgStatisticsInfo_ST;
222
223 typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S
224 {
225         // Per-layer information
226         UINT32 CodeRate;                        //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist
227         UINT32 Constellation;           //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist
228         UINT32 BER;                                     //!< Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A
229         UINT32 BERErrorCount;           //!< Post Viterbi Error Bits Count
230         UINT32 BERBitCount;                     //!< Post Viterbi Total Bits Count
231         UINT32 PreBER;                          //!< Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A
232         UINT32 TS_PER;                          //!< Transport stream PER [%], 0xFFFFFFFF indicate N/A
233         UINT32 ErrorTSPackets;          //!< Number of erroneous transport-stream packets
234         UINT32 TotalTSPackets;          //!< Total number of transport-stream packets
235         UINT32 TILdepthI;                       //!< Time interleaver depth I parameter, 255 means layer does not exist
236         UINT32 NumberOfSegments;        //!< Number of segments in layer A, 255 means layer does not exist
237         UINT32 TMCCErrors;                      //!< TMCC errors
238 } SMSHOSTLIB_ISDBT_LAYER_STAT_ST;
239
240 typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S
241 {
242         UINT32 StatisticsType;                  //!< Enumerator identifying the type of the structure.  Values are the same as SMSHOSTLIB_DEVICE_MODES_E
243                                                                         //!< This fiels MUST always first in any statistics structure
244
245         UINT32 FullSize;                                //!< Total size of the structure returned by the modem.  If the size requested by
246                                                                         //!< the host is smaller than FullSize, the struct will be truncated
247
248         // Common parameters
249         UINT32 IsRfLocked;                              //!< 0 - not locked, 1 - locked
250         UINT32 IsDemodLocked;                   //!< 0 - not locked, 1 - locked
251         UINT32 IsExternalLNAOn;                 //!< 0 - external LNA off, 1 - external LNA on
252
253         // Reception quality
254         INT32  SNR;                                             //!< dB
255         INT32  RSSI;                                    //!< dBm
256         INT32  InBandPwr;                               //!< In band power in dBM
257         INT32  CarrierOffset;                   //!< Carrier Offset in Hz
258
259         // Transmission parameters
260         UINT32 Frequency;                               //!< Frequency in Hz
261         UINT32 Bandwidth;                               //!< Bandwidth in MHz
262         UINT32 TransmissionMode;                //!< ISDB-T transmission mode
263         UINT32 ModemState;                              //!< 0 - Acquisition, 1 - Locked
264         UINT32 GuardInterval;                   //!< Guard Interval, 1 divided by value
265         UINT32 SystemType;                              //!< ISDB-T system type (ISDB-T / ISDB-Tsb)
266         UINT32 PartialReception;                //!< TRUE - partial reception, FALSE otherwise
267         UINT32 NumOfLayers;                             //!< Number of ISDB-T layers in the network
268
269         // Per-layer information
270         // Layers A, B and C
271         SMSHOSTLIB_ISDBT_LAYER_STAT_ST  LayerInfo[3];   //!< Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST
272
273         // Interface information
274         UINT32 SmsToHostTxErrors;               //!< Total number of transmission errors.
275
276 } SMSHOSTLIB_STATISTICS_ISDBT_ST;
277
278 typedef struct SMSHOSTLIB_STATISTICS_DVB_S
279 {
280         UINT32 StatisticsType;                  //!< Enumerator identifying the type of the structure.  Values are the same as SMSHOSTLIB_DEVICE_MODES_E
281                                                                 //!< This fiels MUST always first in any statistics structure
282
283         UINT32 FullSize;                                //!< Total size of the structure returned by the modem.  If the size requested by
284                                                                         //!< the host is smaller than FullSize, the struct will be truncated
285         // Common parameters
286         UINT32 IsRfLocked;                              //!< 0 - not locked, 1 - locked
287         UINT32 IsDemodLocked;                   //!< 0 - not locked, 1 - locked
288         UINT32 IsExternalLNAOn;                 //!< 0 - external LNA off, 1 - external LNA on
289
290         // Reception quality
291         INT32  SNR;                                             //!< dB
292         UINT32 BER;                                             //!< Post Viterbi BER [1E-5]
293         UINT32 BERErrorCount;                   //!< Number of errornous SYNC bits.
294         UINT32 BERBitCount;                             //!< Total number of SYNC bits.
295         UINT32 TS_PER;                                  //!< Transport stream PER, 0xFFFFFFFF indicate N/A
296         UINT32 MFER;                                    //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H
297         INT32  RSSI;                                    //!< dBm
298         INT32  InBandPwr;                               //!< In band power in dBM
299         INT32  CarrierOffset;                   //!< Carrier Offset in bin/1024
300
301         // Transmission parameters
302         UINT32 Frequency;                               //!< Frequency in Hz
303         UINT32 Bandwidth;                               //!< Bandwidth in MHz
304         UINT32 ModemState;                              //!< from SMSHOSTLIB_DVB_MODEM_STATE_ET
305         UINT32 TransmissionMode;                //!< FFT mode carriers in Kilos
306         UINT32 GuardInterval;                   //!< Guard Interval, 1 divided by value
307         UINT32 CodeRate;                                //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET
308         UINT32 LPCodeRate;                              //!< Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET
309         UINT32 Hierarchy;                               //!< Hierarchy from SMSHOSTLIB_HIERARCHY_ET
310         UINT32 Constellation;                   //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET
311
312         // Burst parameters, valid only for DVB-H
313         UINT32 BurstSize;                               //!< Current burst size in bytes, valid only for DVB-H
314         UINT32 BurstDuration;                   //!< Current burst duration in mSec, valid only for DVB-H
315         UINT32 BurstCycleTime;                  //!< Current burst cycle time in mSec, valid only for DVB-H
316         UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H
317         UINT32 NumOfRows;                               //!< Number of rows in MPE table, valid only for DVB-H
318         UINT32 NumOfPaddCols;                   //!< Number of padding columns in MPE table, valid only for DVB-H
319         UINT32 NumOfPunctCols;                  //!< Number of puncturing columns in MPE table, valid only for DVB-H
320         UINT32 ErrorTSPackets;                  //!< Number of erroneous transport-stream packets
321         UINT32 TotalTSPackets;                  //!< Total number of transport-stream packets
322         UINT32 NumOfValidMpeTlbs;               //!< Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H
323         UINT32 NumOfInvalidMpeTlbs;             //!< Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H
324         UINT32 NumOfCorrectedMpeTlbs;   //!< Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H
325         UINT32 NumMPEReceived;                  //!< DVB-H, Num MPE section received
326
327         // DVB-H TPS parameters
328         UINT32 CellId;                                  //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered
329         UINT32 DvbhSrvIndHP;                    //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator
330         UINT32 DvbhSrvIndLP;                    //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator
331
332         // Interface information
333         UINT32 SmsToHostTxErrors;               //!< Total number of transmission errors.
334
335 } SMSHOSTLIB_STATISTICS_DVB_ST;
336
337 typedef struct SMSHOSTLIB_GPIO_CONFIG_S
338 {
339         UINT8   Direction;                              //!< GPIO direction: Input - 0, Output - 1
340         UINT8   PullUpDown;                             //!< PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3
341         UINT8   InputCharacteristics;   //!< Input Characteristics: Normal - 0, Schmitt trigger - 1
342         UINT8   OutputSlewRate;                 //!< Output Slew Rate:  Fast slew rate - 0, Slow slew rate - 1
343         UINT8   OutputDriving;                  //!< Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3
344 } SMSHOSTLIB_GPIO_CONFIG_ST;
345
346 typedef struct SMSHOSTLIB_I2C_REQ_S
347 {
348         UINT32  DeviceAddress;                  // I2c device address
349         UINT32  WriteCount;                             // number of bytes to write
350         UINT32  ReadCount;                              // number of bytes to read
351         UINT8   Data[1];
352 } SMSHOSTLIB_I2C_REQ_ST;
353
354 typedef struct SMSHOSTLIB_I2C_RES_S
355 {
356         UINT32  Status;                                 // non-zero value in case of failure
357         UINT32  ReadCount;                              // number of bytes read
358         UINT8   Data[1];
359 } SMSHOSTLIB_I2C_RES_ST;
360
361 #endif // __smstypes_h__