The DVBv3 statistics parameters are limited on several ways: - It doesn't provide any way to indicate the used measure, so userspace need to guess how to calculate/use it; - Only a limited set of stats are supported; - Can't be called in a way to require them to be filled all at once (atomic reads from the hardware), with may cause troubles on interpreting them on userspace; - On some OFDM delivery systems, the carriers can be independently modulated, having different properties. Currently, there's no way to report per-layer stats. To address the above issues, adding a new DVBv5-based stats API. While here, correct inner code nomenclature on a few places.
Showing the changes to include/uapi/linux (2 of 5 files). Show all
Unified · Split
| @@ -365,7 +365,17 @@ struct dvb_frontend_event { · 364 unmodified lines | ||
| 365 | 365 | #define DTV_INTERLEAVING 60 |
| 366 | 366 | #define DTV_LNA 61 |
| 367 | 367 | |
| 368 | −#define DTV_MAX_COMMAND DTV_LNA | |
| 368 | +/* Quality parameters */ | |
| 369 | +#define DTV_STAT_SIGNAL_STRENGTH 62 | |
| 370 | +#define DTV_STAT_CNR 63 | |
| 371 | +#define DTV_STAT_PRE_ERROR_BIT_COUNT 64 | |
| 372 | +#define DTV_STAT_PRE_TOTAL_BIT_COUNT 65 | |
| 373 | +#define DTV_STAT_POST_ERROR_BIT_COUNT 66 | |
| 374 | +#define DTV_STAT_POST_TOTAL_BIT_COUNT 67 | |
| 375 | +#define DTV_STAT_ERROR_BLOCK_COUNT 68 | |
| 376 | +#define DTV_STAT_TOTAL_BLOCK_COUNT 69 | |
| 377 | + | |
| 378 | +#define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT | |
| 369 | 379 | |
| 370 | 380 | typedef enum fe_pilot { |
| 371 | 381 | PILOT_ON, |
| @@ -452,11 +462,78 @@ struct dtv_cmds_h { · 80 unmodified lines | ||
| 452 | 462 | __u32 reserved:30; /* Align */ |
| 453 | 463 | }; |
| 454 | 464 | |
| 465 | +/** | |
| 466 | + * Scale types for the quality parameters. | |
| 467 | + * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That | |
| 468 | + * could indicate a temporary or a permanent | |
| 469 | + * condition. | |
| 470 | + * @FE_SCALE_DECIBEL: The scale is measured in 0.0001 dB steps, typically | |
| 471 | + * used on signal measures. | |
| 472 | + * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, | |
| 473 | + * ranging from 0 (0%) to 0xffff (100%). | |
| 474 | + * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like | |
| 475 | + * bit error, block error, lapsed time. | |
| 476 | + */ | |
| 477 | +enum fecap_scale_params { | |
| 478 | + FE_SCALE_NOT_AVAILABLE = 0, | |
| 479 | + FE_SCALE_DECIBEL, | |
| 480 | + FE_SCALE_RELATIVE, | |
| 481 | + FE_SCALE_COUNTER | |
| 482 | +}; | |
| 483 | + | |
| 484 | +/** | |
| 485 | + * struct dtv_stats - Used for reading a DTV status property | |
| 486 | + * | |
| 487 | + * @value: value of the measure. Should range from 0 to 0xffff; | |
| 488 | + * @scale: Filled with enum fecap_scale_params - the scale | |
| 489 | + * in usage for that parameter | |
| 490 | + * | |
| 491 | + * For most delivery systems, this will return a single value for each | |
| 492 | + * parameter. | |
| 493 | + * It should be noticed, however, that new OFDM delivery systems like | |
| 494 | + * ISDB can use different modulation types for each group of carriers. | |
| 495 | + * On such standards, up to 8 groups of statistics can be provided, one | |
| 496 | + * for each carrier group (called "layer" on ISDB). | |
| 497 | + * In order to be consistent with other delivery systems, the first | |
| 498 | + * value refers to the entire set of carriers ("global"). | |
| 499 | + * dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when | |
| 500 | + * the value for the entire group of carriers or from one specific layer | |
| 501 | + * is not provided by the hardware. | |
| 502 | + * st.len should be filled with the latest filled status + 1. | |
| 503 | + * | |
| 504 | + * In other words, for ISDB, those values should be filled like: | |
| 505 | + * u.st.stat.svalue[0] = global statistics; | |
| 506 | + * u.st.stat.scale[0] = FE_SCALE_DECIBELS; | |
| 507 | + * u.st.stat.value[1] = layer A statistics; | |
| 508 | + * u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available); | |
| 509 | + * u.st.stat.svalue[2] = layer B statistics; | |
| 510 | + * u.st.stat.scale[2] = FE_SCALE_DECIBELS; | |
| 511 | + * u.st.stat.svalue[3] = layer C statistics; | |
| 512 | + * u.st.stat.scale[3] = FE_SCALE_DECIBELS; | |
| 513 | + * u.st.len = 4; | |
| 514 | + */ | |
| 515 | +struct dtv_stats { | |
| 516 | + __u8 scale; /* enum fecap_scale_params type */ | |
| 517 | + union { | |
| 518 | + __u64 uvalue; /* for counters and relative scales */ | |
| 519 | + __s64 svalue; /* for 0.0001 dB measures */ | |
| 520 | + }; | |
| 521 | +} __attribute__ ((packed)); | |
| 522 | + | |
| 523 | + | |
| 524 | +#define MAX_DTV_STATS 4 | |
| 525 | + | |
| 526 | +struct dtv_fe_stats { | |
| 527 | + __u8 len; | |
| 528 | + struct dtv_stats stat[MAX_DTV_STATS]; | |
| 529 | +} __attribute__ ((packed)); | |
| 530 | + | |
| 455 | 531 | struct dtv_property { |
| 456 | 532 | __u32 cmd; |
| 457 | 533 | __u32 reserved[3]; |
| 458 | 534 | union { |
| 459 | 535 | __u32 data; |
| 536 | + struct dtv_fe_stats st; | |
| 460 | 537 | struct { |
| 461 | 538 | __u8 data[32]; |
| 462 | 539 | __u32 len; |
| @@ -24,6 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | #define _DVBVERSION_H_ |
| 25 | 25 | |
| 26 | 26 | #define DVB_API_VERSION 5 |
| 27 | −#define DVB_API_VERSION_MINOR 9 | |
| 27 | +#define DVB_API_VERSION_MINOR 10 | |
| 28 | 28 | |
| 29 | 29 | #endif /*_DVBVERSION_H_*/ |