diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-07 19:58:47 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 06:44:31 -0400 |
commit | b4059095ab281b940b52a6a0e826de25eb50e3c7 (patch) | |
tree | ae1ea2de937bd003348e0ba3d2a9e473a13e5a4f | |
parent | 0c189fa69ed3d9c08d6f1db845c6fd174c92c429 (diff) |
[media] siano: use the newer stats message for recent firmwares
The old statistics request don't work with newer firmwares.
Add a logic to use the newer stats if firmware major is 8.
Note that I have only 2 devices here, one with firmware 2.1
(Hauppauge model 55009 Rev B1F7) and another one with
firmware 8.1. We may need to adjust the firmware minimal
version for the *_EX message variants, as we start finding
firmware versions between 2.x and 8.x.
This patch was based on Doron Cohen patch:
http://patchwork.linuxtv.org/patch/7886/
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/common/siano/smscoreapi.h | 103 | ||||
-rw-r--r-- | drivers/media/common/siano/smsdvb.c | 177 |
2 files changed, 260 insertions, 20 deletions
diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h index 8af94c434352..7925c04e3edc 100644 --- a/drivers/media/common/siano/smscoreapi.h +++ b/drivers/media/common/siano/smscoreapi.h | |||
@@ -800,6 +800,66 @@ struct SMSHOSTLIB_STATISTICS_ISDBT_ST { | |||
800 | u32 SmsToHostTxErrors; /* Total number of transmission errors. */ | 800 | u32 SmsToHostTxErrors; /* Total number of transmission errors. */ |
801 | }; | 801 | }; |
802 | 802 | ||
803 | struct SMSHOSTLIB_STATISTICS_ISDBT_EX_ST { | ||
804 | u32 StatisticsType; /* Enumerator identifying the type of the | ||
805 | * structure. Values are the same as | ||
806 | * SMSHOSTLIB_DEVICE_MODES_E | ||
807 | * | ||
808 | * This field MUST always be first in any | ||
809 | * statistics structure */ | ||
810 | |||
811 | u32 FullSize; /* Total size of the structure returned by the modem. | ||
812 | * If the size requested by the host is smaller than | ||
813 | * FullSize, the struct will be truncated */ | ||
814 | |||
815 | /* Common parameters */ | ||
816 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ | ||
817 | u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ | ||
818 | u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ | ||
819 | |||
820 | /* Reception quality */ | ||
821 | s32 SNR; /* dB */ | ||
822 | s32 RSSI; /* dBm */ | ||
823 | s32 InBandPwr; /* In band power in dBM */ | ||
824 | s32 CarrierOffset; /* Carrier Offset in Hz */ | ||
825 | |||
826 | /* Transmission parameters */ | ||
827 | u32 Frequency; /* Frequency in Hz */ | ||
828 | u32 Bandwidth; /* Bandwidth in MHz */ | ||
829 | u32 TransmissionMode; /* ISDB-T transmission mode */ | ||
830 | u32 ModemState; /* 0 - Acquisition, 1 - Locked */ | ||
831 | u32 GuardInterval; /* Guard Interval, 1 divided by value */ | ||
832 | u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ | ||
833 | u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */ | ||
834 | u32 NumOfLayers; /* Number of ISDB-T layers in the network */ | ||
835 | |||
836 | u32 SegmentNumber; /* Segment number for ISDB-Tsb */ | ||
837 | u32 TuneBW; /* Tuned bandwidth - BW_ISDBT_1SEG / BW_ISDBT_3SEG */ | ||
838 | |||
839 | /* Per-layer information */ | ||
840 | /* Layers A, B and C */ | ||
841 | struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; | ||
842 | /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ | ||
843 | |||
844 | /* Interface information */ | ||
845 | u32 Reserved1; /* Was SmsToHostTxErrors - obsolete . */ | ||
846 | /* Proprietary information */ | ||
847 | u32 ExtAntenna; /* Obsolete field. */ | ||
848 | u32 ReceptionQuality; | ||
849 | u32 EwsAlertActive; /* Signals if EWS alert is currently on */ | ||
850 | u32 LNAOnOff; /* Internal LNA state: 0: OFF, 1: ON */ | ||
851 | |||
852 | u32 RfAgcLevel; /* RF AGC Level [linear units], full gain = 65535 (20dB) */ | ||
853 | u32 BbAgcLevel; /* Baseband AGC level [linear units], full gain = 65535 (71.5dB) */ | ||
854 | u32 FwErrorsCounter; /* Application errors - should be always zero */ | ||
855 | u8 FwErrorsHistoryArr[8]; /* Last FW errors IDs - first is most recent, last is oldest */ | ||
856 | |||
857 | s32 MRC_SNR; /* dB */ | ||
858 | u32 SNRFullRes; /* dB x 65536 */ | ||
859 | u32 Reserved4[4]; | ||
860 | }; | ||
861 | |||
862 | |||
803 | struct PID_STATISTICS_DATA_S { | 863 | struct PID_STATISTICS_DATA_S { |
804 | struct PID_BURST_S { | 864 | struct PID_BURST_S { |
805 | u32 size; | 865 | u32 size; |
@@ -880,6 +940,35 @@ struct RECEPTION_STATISTICS_S { | |||
880 | s32 MRC_InBandPwr; /* In band power in dBM */ | 940 | s32 MRC_InBandPwr; /* In band power in dBM */ |
881 | }; | 941 | }; |
882 | 942 | ||
943 | struct RECEPTION_STATISTICS_EX_S { | ||
944 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ | ||
945 | u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ | ||
946 | u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ | ||
947 | |||
948 | u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ | ||
949 | s32 SNR; /* dB */ | ||
950 | u32 BER; /* Post Viterbi BER [1E-5] */ | ||
951 | u32 BERErrorCount; /* Number of erronous SYNC bits. */ | ||
952 | u32 BERBitCount; /* Total number of SYNC bits. */ | ||
953 | u32 TS_PER; /* Transport stream PER, | ||
954 | 0xFFFFFFFF indicate N/A */ | ||
955 | u32 MFER; /* DVB-H frame error rate in percentage, | ||
956 | 0xFFFFFFFF indicate N/A, valid only for DVB-H */ | ||
957 | s32 RSSI; /* dBm */ | ||
958 | s32 InBandPwr; /* In band power in dBM */ | ||
959 | s32 CarrierOffset; /* Carrier Offset in bin/1024 */ | ||
960 | u32 ErrorTSPackets; /* Number of erroneous | ||
961 | transport-stream packets */ | ||
962 | u32 TotalTSPackets; /* Total number of transport-stream packets */ | ||
963 | |||
964 | s32 RefDevPPM; | ||
965 | s32 FreqDevHz; | ||
966 | |||
967 | s32 MRC_SNR; /* dB */ | ||
968 | s32 MRC_RSSI; /* dBm */ | ||
969 | s32 MRC_InBandPwr; /* In band power in dBM */ | ||
970 | }; | ||
971 | |||
883 | 972 | ||
884 | /* Statistics information returned as response for | 973 | /* Statistics information returned as response for |
885 | * SmsHostApiGetStatisticsEx_Req for DVB applications, SMS1100 and up */ | 974 | * SmsHostApiGetStatisticsEx_Req for DVB applications, SMS1100 and up */ |
@@ -895,6 +984,20 @@ struct SMSHOSTLIB_STATISTICS_DVB_S { | |||
895 | struct PID_DATA_S PidData[SRVM_MAX_PID_FILTERS]; | 984 | struct PID_DATA_S PidData[SRVM_MAX_PID_FILTERS]; |
896 | }; | 985 | }; |
897 | 986 | ||
987 | /* Statistics information returned as response for | ||
988 | * SmsHostApiGetStatisticsEx_Req for DVB applications, SMS1100 and up */ | ||
989 | struct SMSHOSTLIB_STATISTICS_DVB_EX_S { | ||
990 | /* Reception */ | ||
991 | struct RECEPTION_STATISTICS_EX_S ReceptionData; | ||
992 | |||
993 | /* Transmission parameters */ | ||
994 | struct TRANSMISSION_STATISTICS_S TransmissionData; | ||
995 | |||
996 | /* Burst parameters, valid only for DVB-H */ | ||
997 | #define SRVM_MAX_PID_FILTERS 8 | ||
998 | struct PID_DATA_S PidData[SRVM_MAX_PID_FILTERS]; | ||
999 | }; | ||
1000 | |||
898 | struct SRVM_SIGNAL_STATUS_S { | 1001 | struct SRVM_SIGNAL_STATUS_S { |
899 | u32 result; | 1002 | u32 result; |
900 | u32 snr; | 1003 | u32 snr; |
diff --git a/drivers/media/common/siano/smsdvb.c b/drivers/media/common/siano/smsdvb.c index 864f53e7ca63..dbb807e3a212 100644 --- a/drivers/media/common/siano/smsdvb.c +++ b/drivers/media/common/siano/smsdvb.c | |||
@@ -50,7 +50,7 @@ struct smsdvb_client_t { | |||
50 | struct completion tune_done; | 50 | struct completion tune_done; |
51 | struct completion stats_done; | 51 | struct completion stats_done; |
52 | 52 | ||
53 | struct SMSHOSTLIB_STATISTICS_DVB_S sms_stat_dvb; | 53 | struct SMSHOSTLIB_STATISTICS_DVB_EX_S sms_stat_dvb; |
54 | int event_fe_state; | 54 | int event_fe_state; |
55 | int event_unc_state; | 55 | int event_unc_state; |
56 | }; | 56 | }; |
@@ -115,12 +115,10 @@ static void sms_board_dvb3_event(struct smsdvb_client_t *client, | |||
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_EX_S *pReceptionData, | |
119 | static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_S *pReceptionData, | ||
120 | struct SMSHOSTLIB_STATISTICS_ST *p) | 119 | struct SMSHOSTLIB_STATISTICS_ST *p) |
121 | { | 120 | { |
122 | if (sms_dbg & 2) { | 121 | if (sms_dbg & 2) { |
123 | printk(KERN_DEBUG "Reserved = %d", p->Reserved); | ||
124 | printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked); | 122 | printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked); |
125 | printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked); | 123 | printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked); |
126 | printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn); | 124 | printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn); |
@@ -132,6 +130,7 @@ static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_S *pReceptionDat | |||
132 | printk(KERN_DEBUG "RSSI = %d", p->RSSI); | 130 | printk(KERN_DEBUG "RSSI = %d", p->RSSI); |
133 | printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr); | 131 | printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr); |
134 | printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset); | 132 | printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset); |
133 | printk(KERN_DEBUG "ModemState = %d", p->ModemState); | ||
135 | printk(KERN_DEBUG "Frequency = %d", p->Frequency); | 134 | printk(KERN_DEBUG "Frequency = %d", p->Frequency); |
136 | printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth); | 135 | printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth); |
137 | printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode); | 136 | printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode); |
@@ -163,17 +162,24 @@ static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_S *pReceptionDat | |||
163 | printk(KERN_DEBUG "NumMPEReceived = %d", p->NumMPEReceived); | 162 | printk(KERN_DEBUG "NumMPEReceived = %d", p->NumMPEReceived); |
164 | } | 163 | } |
165 | 164 | ||
165 | /* update reception data */ | ||
166 | pReceptionData->IsRfLocked = p->IsRfLocked; | ||
166 | pReceptionData->IsDemodLocked = p->IsDemodLocked; | 167 | pReceptionData->IsDemodLocked = p->IsDemodLocked; |
167 | 168 | pReceptionData->IsExternalLNAOn = p->IsExternalLNAOn; | |
169 | pReceptionData->ModemState = p->ModemState; | ||
168 | pReceptionData->SNR = p->SNR; | 170 | pReceptionData->SNR = p->SNR; |
169 | pReceptionData->BER = p->BER; | 171 | pReceptionData->BER = p->BER; |
170 | pReceptionData->BERErrorCount = p->BERErrorCount; | 172 | pReceptionData->BERErrorCount = p->BERErrorCount; |
173 | pReceptionData->BERBitCount = p->BERBitCount; | ||
174 | pReceptionData->RSSI = p->RSSI; | ||
175 | CORRECT_STAT_RSSI(*pReceptionData); | ||
171 | pReceptionData->InBandPwr = p->InBandPwr; | 176 | pReceptionData->InBandPwr = p->InBandPwr; |
177 | pReceptionData->CarrierOffset = p->CarrierOffset; | ||
172 | pReceptionData->ErrorTSPackets = p->ErrorTSPackets; | 178 | pReceptionData->ErrorTSPackets = p->ErrorTSPackets; |
179 | pReceptionData->TotalTSPackets = p->TotalTSPackets; | ||
173 | }; | 180 | }; |
174 | 181 | ||
175 | 182 | static void smsdvb_update_isdbt_stats(struct RECEPTION_STATISTICS_EX_S *pReceptionData, | |
176 | static void smsdvb_update_isdbt_stats(struct RECEPTION_STATISTICS_S *pReceptionData, | ||
177 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST *p) | 183 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST *p) |
178 | { | 184 | { |
179 | int i; | 185 | int i; |
@@ -212,18 +218,100 @@ static void smsdvb_update_isdbt_stats(struct RECEPTION_STATISTICS_S *pReceptionD | |||
212 | } | 218 | } |
213 | } | 219 | } |
214 | 220 | ||
221 | /* update reception data */ | ||
222 | pReceptionData->IsRfLocked = p->IsRfLocked; | ||
215 | pReceptionData->IsDemodLocked = p->IsDemodLocked; | 223 | pReceptionData->IsDemodLocked = p->IsDemodLocked; |
224 | pReceptionData->IsExternalLNAOn = p->IsExternalLNAOn; | ||
225 | pReceptionData->ModemState = p->ModemState; | ||
226 | pReceptionData->SNR = p->SNR; | ||
227 | pReceptionData->BER = p->LayerInfo[0].BER; | ||
228 | pReceptionData->BERErrorCount = p->LayerInfo[0].BERErrorCount; | ||
229 | pReceptionData->BERBitCount = p->LayerInfo[0].BERBitCount; | ||
230 | pReceptionData->RSSI = p->RSSI; | ||
231 | CORRECT_STAT_RSSI(*pReceptionData); | ||
232 | pReceptionData->InBandPwr = p->InBandPwr; | ||
216 | 233 | ||
234 | pReceptionData->CarrierOffset = p->CarrierOffset; | ||
235 | pReceptionData->ErrorTSPackets = p->LayerInfo[0].ErrorTSPackets; | ||
236 | pReceptionData->TotalTSPackets = p->LayerInfo[0].TotalTSPackets; | ||
237 | pReceptionData->MFER = 0; | ||
238 | |||
239 | /* TS PER */ | ||
240 | if ((p->LayerInfo[0].TotalTSPackets + | ||
241 | p->LayerInfo[0].ErrorTSPackets) > 0) { | ||
242 | pReceptionData->TS_PER = (p->LayerInfo[0].ErrorTSPackets | ||
243 | * 100) / (p->LayerInfo[0].TotalTSPackets | ||
244 | + p->LayerInfo[0].ErrorTSPackets); | ||
245 | } else { | ||
246 | pReceptionData->TS_PER = 0; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | static void smsdvb_update_isdbt_stats_ex(struct RECEPTION_STATISTICS_EX_S *pReceptionData, | ||
251 | struct SMSHOSTLIB_STATISTICS_ISDBT_EX_ST *p) | ||
252 | { | ||
253 | int i; | ||
254 | |||
255 | if (sms_dbg & 2) { | ||
256 | printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked); | ||
257 | printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked); | ||
258 | printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn); | ||
259 | printk(KERN_DEBUG "SNR = %d", p->SNR); | ||
260 | printk(KERN_DEBUG "RSSI = %d", p->RSSI); | ||
261 | printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr); | ||
262 | printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset); | ||
263 | printk(KERN_DEBUG "Frequency = %d", p->Frequency); | ||
264 | printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth); | ||
265 | printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode); | ||
266 | printk(KERN_DEBUG "ModemState = %d", p->ModemState); | ||
267 | printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval); | ||
268 | printk(KERN_DEBUG "SystemType = %d", p->SystemType); | ||
269 | printk(KERN_DEBUG "PartialReception = %d", p->PartialReception); | ||
270 | printk(KERN_DEBUG "NumOfLayers = %d", p->NumOfLayers); | ||
271 | printk(KERN_DEBUG "SegmentNumber = %d", p->SegmentNumber); | ||
272 | printk(KERN_DEBUG "TuneBW = %d", p->TuneBW); | ||
273 | for (i = 0; i < 3; i++) { | ||
274 | printk(KERN_DEBUG "%d: CodeRate = %d", i, p->LayerInfo[i].CodeRate); | ||
275 | printk(KERN_DEBUG "%d: Constellation = %d", i, p->LayerInfo[i].Constellation); | ||
276 | printk(KERN_DEBUG "%d: BER = %d", i, p->LayerInfo[i].BER); | ||
277 | printk(KERN_DEBUG "%d: BERErrorCount = %d", i, p->LayerInfo[i].BERErrorCount); | ||
278 | printk(KERN_DEBUG "%d: BERBitCount = %d", i, p->LayerInfo[i].BERBitCount); | ||
279 | printk(KERN_DEBUG "%d: PreBER = %d", i, p->LayerInfo[i].PreBER); | ||
280 | printk(KERN_DEBUG "%d: TS_PER = %d", i, p->LayerInfo[i].TS_PER); | ||
281 | printk(KERN_DEBUG "%d: ErrorTSPackets = %d", i, p->LayerInfo[i].ErrorTSPackets); | ||
282 | printk(KERN_DEBUG "%d: TotalTSPackets = %d", i, p->LayerInfo[i].TotalTSPackets); | ||
283 | printk(KERN_DEBUG "%d: TILdepthI = %d", i, p->LayerInfo[i].TILdepthI); | ||
284 | printk(KERN_DEBUG "%d: NumberOfSegments = %d", i, p->LayerInfo[i].NumberOfSegments); | ||
285 | printk(KERN_DEBUG "%d: TMCCErrors = %d", i, p->LayerInfo[i].TMCCErrors); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | /* update reception data */ | ||
290 | pReceptionData->IsRfLocked = p->IsRfLocked; | ||
291 | pReceptionData->IsDemodLocked = p->IsDemodLocked; | ||
292 | pReceptionData->IsExternalLNAOn = p->IsExternalLNAOn; | ||
293 | pReceptionData->ModemState = p->ModemState; | ||
217 | pReceptionData->SNR = p->SNR; | 294 | pReceptionData->SNR = p->SNR; |
295 | pReceptionData->BER = p->LayerInfo[0].BER; | ||
296 | pReceptionData->BERErrorCount = p->LayerInfo[0].BERErrorCount; | ||
297 | pReceptionData->BERBitCount = p->LayerInfo[0].BERBitCount; | ||
298 | pReceptionData->RSSI = p->RSSI; | ||
299 | CORRECT_STAT_RSSI(*pReceptionData); | ||
218 | pReceptionData->InBandPwr = p->InBandPwr; | 300 | pReceptionData->InBandPwr = p->InBandPwr; |
219 | 301 | ||
220 | pReceptionData->ErrorTSPackets = 0; | 302 | pReceptionData->CarrierOffset = p->CarrierOffset; |
221 | pReceptionData->BER = 0; | 303 | pReceptionData->ErrorTSPackets = p->LayerInfo[0].ErrorTSPackets; |
222 | pReceptionData->BERErrorCount = 0; | 304 | pReceptionData->TotalTSPackets = p->LayerInfo[0].TotalTSPackets; |
223 | for (i = 0; i < 3; i++) { | 305 | pReceptionData->MFER = 0; |
224 | pReceptionData->BER += p->LayerInfo[i].BER; | 306 | |
225 | pReceptionData->BERErrorCount += p->LayerInfo[i].BERErrorCount; | 307 | /* TS PER */ |
226 | pReceptionData->ErrorTSPackets += p->LayerInfo[i].ErrorTSPackets; | 308 | if ((p->LayerInfo[0].TotalTSPackets + |
309 | p->LayerInfo[0].ErrorTSPackets) > 0) { | ||
310 | pReceptionData->TS_PER = (p->LayerInfo[0].ErrorTSPackets | ||
311 | * 100) / (p->LayerInfo[0].TotalTSPackets | ||
312 | + p->LayerInfo[0].ErrorTSPackets); | ||
313 | } else { | ||
314 | pReceptionData->TS_PER = 0; | ||
227 | } | 315 | } |
228 | } | 316 | } |
229 | 317 | ||
@@ -260,21 +348,29 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) | |||
260 | break; | 348 | break; |
261 | 349 | ||
262 | case MSG_SMS_TRANSMISSION_IND: { | 350 | case MSG_SMS_TRANSMISSION_IND: { |
351 | |||
263 | pMsgData++; | 352 | pMsgData++; |
264 | memcpy(&client->sms_stat_dvb.TransmissionData, pMsgData, | 353 | memcpy(&client->sms_stat_dvb.TransmissionData, pMsgData, |
265 | sizeof(struct TRANSMISSION_STATISTICS_S)); | 354 | sizeof(struct TRANSMISSION_STATISTICS_S)); |
266 | 355 | ||
356 | #if 1 | ||
357 | /* | ||
358 | * FIXME: newer driver doesn't have those fixes | ||
359 | * Are those firmware-specific stuff? | ||
360 | */ | ||
361 | |||
267 | /* Mo need to correct guard interval | 362 | /* Mo need to correct guard interval |
268 | * (as opposed to old statistics message). | 363 | * (as opposed to old statistics message). |
269 | */ | 364 | */ |
270 | CORRECT_STAT_BANDWIDTH(client->sms_stat_dvb.TransmissionData); | 365 | CORRECT_STAT_BANDWIDTH(client->sms_stat_dvb.TransmissionData); |
271 | CORRECT_STAT_TRANSMISSON_MODE( | 366 | CORRECT_STAT_TRANSMISSON_MODE( |
272 | client->sms_stat_dvb.TransmissionData); | 367 | client->sms_stat_dvb.TransmissionData); |
368 | #endif | ||
273 | is_status_update = true; | 369 | is_status_update = true; |
274 | break; | 370 | break; |
275 | } | 371 | } |
276 | case MSG_SMS_HO_PER_SLICES_IND: { | 372 | case MSG_SMS_HO_PER_SLICES_IND: { |
277 | struct RECEPTION_STATISTICS_S *pReceptionData = | 373 | struct RECEPTION_STATISTICS_EX_S *pReceptionData = |
278 | &client->sms_stat_dvb.ReceptionData; | 374 | &client->sms_stat_dvb.ReceptionData; |
279 | struct SRVM_SIGNAL_STATUS_S SignalStatusData; | 375 | struct SRVM_SIGNAL_STATUS_S SignalStatusData; |
280 | 376 | ||
@@ -329,7 +425,7 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) | |||
329 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST isdbt; | 425 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST isdbt; |
330 | struct SmsMsgStatisticsInfo_ST dvb; | 426 | struct SmsMsgStatisticsInfo_ST dvb; |
331 | } *p = (void *) (phdr + 1); | 427 | } *p = (void *) (phdr + 1); |
332 | struct RECEPTION_STATISTICS_S *pReceptionData = | 428 | struct RECEPTION_STATISTICS_EX_S *pReceptionData = |
333 | &client->sms_stat_dvb.ReceptionData; | 429 | &client->sms_stat_dvb.ReceptionData; |
334 | 430 | ||
335 | is_status_update = true; | 431 | is_status_update = true; |
@@ -352,6 +448,34 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) | |||
352 | 448 | ||
353 | break; | 449 | break; |
354 | } | 450 | } |
451 | case MSG_SMS_GET_STATISTICS_EX_RES: { | ||
452 | union { | ||
453 | struct SMSHOSTLIB_STATISTICS_ISDBT_EX_ST isdbt; | ||
454 | struct SMSHOSTLIB_STATISTICS_ST dvb; | ||
455 | } *p = (void *) (phdr + 1); | ||
456 | struct RECEPTION_STATISTICS_EX_S *pReceptionData = | ||
457 | &client->sms_stat_dvb.ReceptionData; | ||
458 | |||
459 | is_status_update = true; | ||
460 | |||
461 | switch (smscore_get_device_mode(client->coredev)) { | ||
462 | case DEVICE_MODE_ISDBT: | ||
463 | case DEVICE_MODE_ISDBT_BDA: | ||
464 | smsdvb_update_isdbt_stats_ex(pReceptionData, &p->isdbt); | ||
465 | break; | ||
466 | default: | ||
467 | smsdvb_update_dvb_stats(pReceptionData, &p->dvb); | ||
468 | } | ||
469 | if (!pReceptionData->IsDemodLocked) { | ||
470 | pReceptionData->SNR = 0; | ||
471 | pReceptionData->BER = 0; | ||
472 | pReceptionData->BERErrorCount = 0; | ||
473 | pReceptionData->InBandPwr = 0; | ||
474 | pReceptionData->ErrorTSPackets = 0; | ||
475 | } | ||
476 | |||
477 | break; | ||
478 | } | ||
355 | default: | 479 | default: |
356 | sms_info("message not handled"); | 480 | sms_info("message not handled"); |
357 | } | 481 | } |
@@ -466,10 +590,23 @@ static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, | |||
466 | static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) | 590 | static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) |
467 | { | 591 | { |
468 | int rc; | 592 | int rc; |
469 | struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, | 593 | struct SmsMsgHdr_ST Msg; |
470 | DVBT_BDA_CONTROL_MSG_ID, | 594 | |
471 | HIF_TASK, | 595 | |
472 | sizeof(struct SmsMsgHdr_ST), 0 }; | 596 | Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; |
597 | Msg.msgDstId = HIF_TASK; | ||
598 | Msg.msgFlags = 0; | ||
599 | Msg.msgLength = sizeof(Msg); | ||
600 | |||
601 | /* | ||
602 | * Check for firmware version, to avoid breaking for old cards | ||
603 | */ | ||
604 | if (client->coredev->fw_version >= 0x800) | ||
605 | Msg.msgType = MSG_SMS_GET_STATISTICS_EX_REQ; | ||
606 | else | ||
607 | Msg.msgType = MSG_SMS_GET_STATISTICS_REQ; | ||
608 | |||
609 | smsendian_handle_tx_message((struct SmsMsgHdr_S *)&Msg); | ||
473 | 610 | ||
474 | rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | 611 | rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), |
475 | &client->stats_done); | 612 | &client->stats_done); |