Re: [PATCH] add DVB-S2 support to frontend.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcel Siegert wrote:
this patch is adding dvb-s2 support to frontend.h

From: Marcel Siegert <mws@xxxxxxxxxxx>

changes:
--------------------------------------------------------------------------------------------------
added FE_DVB_S2 as new frontend type;
renamed all other frontend types from modulation to system name;
provided backwards compatibility defines for old apps;
--------------------------------------------------------------------------------------------------
added FE_CAN_DVB_S2 to fe_caps;
added FE_HAS_EXTENDED_CAN_VALUES to fe_caps
- this flag set signals that new introduced ioctl FE_GET_EXTENDED_INFO is available,
        and fec / modulation / misc flags can be queried using it.

to provide this functionallity i did a backport of API V4 enumerations.
in detail these are
- dvb_fe_code_rate
- dvb_fe_modulation
- dvb_fe_common_cap
- dvb_fe_other_cap

they give us plenty room for further upcoming modulations and features that must be handled/queried.

they have been modified to have the topmost value kept at 1<<31 so it should be guaranteed, even if we add values, from start to end 32 bits will be used as internal representation for the enums.

they can be queried passing the FE_GET_EXTENDED_INFO a dvb_fe_caps_extended struct;
all 4 groups of enumerations are returned at once.
as they were split up, we still have room for more enumeration values.

there's still room to have e.g. FE_CAN_DVB_T2, FE_CAN_DVB_C2 within the normal and wellknown
fe_caps enumeration scheme.
-------------------------------------------------------------------------------------------------- added fe_rolloff_factor enumerations, they are needed by DVB-S2 tuning parameters --------------------------------------------------------------------------------------------------
renamed dvb_XXXX_parameters to match system not modulation type.
added/provided backwards compatible defines
renamed dvb_frontend_parameters struct names to match renamed dvb_XXXX_parameters --------------------------------------------------------------------------------------------------
added dvb_dvbs2_parameters struct to take dvb-s2 tuning parameters
--------------------------------------------------------------------------------------------------
added dvb_frontend_parameters_extended struct,
this one will be used for dvb-s2 and upcoming tuning structs merged in a union. --------------------------------------------------------------------------------------------------
renamed dvb_frontend_parameters to __dvb_frontend_parameters_old;
renamed ioctls: FE_SET_FRONTEND and FE_GET_FRONTEND to __FE_SET_FRONTEND_OLD and __FE_GET_FRONTEND_OLD;
this is done like in net.h to keep backwards binary compatibility.
--------------------------------------------------------------------------------------------------
added ioctls: FE_SET_FRONTEND and FE_GET_FRONTEND
added struct: dvb_frontend_parameters, that are slightly different from
the renamed old ones. there a two fields added, type and a pointer to the dvb_frontend_parameters_extended. though it stored as a pointer we won't have any conflicts, like we had with dvb-s2, in the future.

for backwards source compatibility old struct is integrated in the new one. --------------------------------------------------------------------------------------------------
renamed dvb_frontend_event to __dvb_frontend_event_old
as this keeps a struct with the __dvb_frontend_parameters_old
-------------------------------------------------------------------------------------------------- added dvb_frontend_event - binary compatibility through having same first members
as __dvb_frontend_event_old.
added type flag and dvb_frontend_parameters_extended as a pointer for the extended tuning data.
first use is dvb-s2 (dvb_dvbs2_parameters struct);
-------------------------------------------------------------------------------------------------- added dvb_api_version struct, holding a each 16-bit wide major and minor version. -------------------------------------------------------------------------------------------------- added FE_GET_APIVERSION ioctl - query the actual kernel api version using dvb_api_version struct. this is necessary to get the ability to write userspace applications/encapsulations/libraries
for different api versions that can handle changes and map between apis.
--------------------------------------------------------------------------------------------------
renamed FE_GET_EVENT ioctl to __FE_GET_EVENT_OLD
backwards binary compatibility reasons (see above)
--------------------------------------------------------------------------------------------------
added FE_EXTENDED_TP (0x80) as fe_status_t enumeration flag.
-------------------------------------------------------------------------------------------------- added FE_GET_EVENT ioctl to receive a dvb_frontend_event struct. as this one is source compatible to prior versions it signals via the FE_EXTENDED_TP flag in fe_status_t, that a
dvb_frontend_parameters_extended struct is also returned.
to determine type of the extended struct (e.g. dvb-s2) the type was also added as struct member. --------------------------------------------------------------------------------------------------

that's it a least. i do know that is it more than a "workaround for dvb-s2" and that it maybe seems
to be ugly.
i discussed long times on irc with felix, manu, andrew, and mike, how to keep source and binary
backwards compatibility. i hope i reached that.

please do not hesitate to send comments if i missed a case.

best regards
marcel


Signed-off-by: Marcel Siegert <mws@xxxxxxxxxxx>
------------------------------------------------------------------------

--- ../../../../../../v4l-dvb/linux/include/linux/dvb/frontend.h	2006-02-27 01:36:46.117934750 +0100
+++ frontend.h	2006-02-27 20:43:45.600403500 +0100
@@ -30,12 +30,16 @@
typedef enum fe_type {
-	FE_QPSK,
-	FE_QAM,
-	FE_OFDM,
-	FE_ATSC
+	FE_DVB_S,
+	FE_DVB_C,
+	FE_DVB_T,
+	FE_ATSC,
+	FE_DVB_S2
 } fe_type_t;
+#define FE_QPSK FE_DVB_S
+#define FE_QAM	FE_DVB_C
+#define FE_OFDM	FE_DVB_T
typedef enum fe_caps {
 	FE_IS_STUPID			= 0,
@@ -62,12 +66,13 @@
 	FE_CAN_HIERARCHY_AUTO		= 0x100000,
 	FE_CAN_8VSB			= 0x200000,
 	FE_CAN_16VSB			= 0x400000,
+	FE_CAN_DVB_S2			= 0x1000000,
+	FE_HAS_EXTENDED_CAN_VALUES	= 0x10000000,
 	FE_NEEDS_BENDING		= 0x20000000, // not supported anymore, don't use (frontend requires frequency bending)
 	FE_CAN_RECOVER			= 0x40000000, // frontend can recover from a cable unplug automatically
 	FE_CAN_MUTE_TS			= 0x80000000  // frontend can stop spurious TS data output
 } fe_caps_t;
-
 struct dvb_frontend_info {
 	char       name[128];
 	fe_type_t  type;
@@ -82,6 +87,69 @@
 	fe_caps_t  caps;
 };
+/* backport from dvb-api v4 - adapted a bit to have the last value at bit 31 so we */
+/* guarantee that the enum will normally have 32 bits size */
+/*! describes the available forward error correction code rates. */
+enum dvb_fe_code_rate {
+	DVB_FE_FEC_NONE = (1 << 0),
+	DVB_FE_FEC_1_2  = (1 << 1),
+	DVB_FE_FEC_2_3  = (1 << 2),
+	DVB_FE_FEC_3_4  = (1 << 3),
+	DVB_FE_FEC_4_5  = (1 << 4),
+	DVB_FE_FEC_5_6  = (1 << 5),
+	DVB_FE_FEC_6_7  = (1 << 6),
+	DVB_FE_FEC_7_8  = (1 << 7),
+	DVB_FE_FEC_8_9  = (1 << 8),
+	DVB_FE_FEC_3_5	= (1 << 9),
+	DVB_FE_FEC_9_10	= (1 << 10),
+	DVB_FE_FEC_AUTO = (1 << 31)
+};
+
+/*! describes the available modulation types. */
+enum dvb_fe_modulation {
+	DVB_FE_MOD_QPSK		= (1 << 0),
+	DVB_FE_MOD_QAM_16	= (1 << 1),
+	DVB_FE_MOD_QAM_32	= (1 << 2),
+	DVB_FE_MOD_QAM_64	= (1 << 3),
+	DVB_FE_MOD_QAM_128	= (1 << 4),
+	DVB_FE_MOD_QAM_256	= (1 << 5),
+	DVB_FE_MOD_QAM_AUTO	= (1 << 6),
+	DVB_FE_MOD_2_VSB	= (1 << 7),
+	DVB_FE_MOD_4_VSB	= (1 << 8),
+	DVB_FE_MOD_8_VSB	= (1 << 9),
+	DVB_FE_MOD_16_VSB	= (1 << 10),
+	DVB_FE_MOD_8_PSK	= (1 << 11),
+	DVB_FE_MOD_BPSK		= (1 << 12),
+	DVB_FE_MOD_MOD_UNKNOWN	= (1 << 31)
+};
+
+/*! describes common supported frontend capabilities. */
+enum dvb_fe_common_cap {
+	DVB_FE_CAN_INVERSION_AUTO   = (1 << 0), /*!< fixme */
+	DVB_FE_CAN_RECOVER          = (1 << 1), /*!< frontend can recover from a cable unplug automatically */
+	DVB_FE_CAN_MUTE_TS          = (1 << 2), /*!< frontend can stop spurious TS data output */
+	DVB_FE_SUP_HIGH_LNB_VOLTAGE = (1 << 31), /*!< fixme, frontend can deliver higher lnb voltages */
+};
+
+/*! describes other available, frontend type dependent capabilities. */
+enum dvb_fe_other_cap {
+	DVB_FE_CAN_TRANSMISSION_MODE_AUTO = (1 << 0), /*!< fixme (DVB-T specific) */
+	DVB_FE_CAN_BANDWIDTH_AUTO         = (1 << 1), /*!< fixme (DVB-T specific) */
+	DVB_FE_CAN_GUARD_INTERVAL_AUTO    = (1 << 2), /*!< fixme (DVB-T specific) */
+	DVB_FE_CAN_HIERARCHY_AUTO         = (1 << 31), /*!< fixme (DVB-T specific) */
+};
+
+/**
+ *  this struct will be filled by the FE_GET_EXTENDED_INFO ioctl.
+ *  it is a extension to the normal frontend capabilities and provided
+ *  if the dvb_fe_info.caps is having the FE_HAS_EXTENDED_CAN_VALUES bit set.
+ */
+struct dvb_fe_caps_extended {
+	enum dvb_fe_code_rate  caps_fec;        /*!< supported fecs */
+	enum dvb_fe_modulation caps_modulation; /*!< supported modulations */
+	enum dvb_fe_common_cap caps_common;     /*!< supported common capabilities */
+	enum dvb_fe_other_cap  caps_other;      /*!< supported other capabilities*/
+};
/**
  *  Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
@@ -126,7 +194,8 @@
 	FE_HAS_SYNC	= 0x08,   /*  found sync bytes  */
 	FE_HAS_LOCK	= 0x10,   /*  everything's working... */
 	FE_TIMEDOUT	= 0x20,   /*  no lock within the last ~2 seconds */
-	FE_REINIT	= 0x40    /*  frontend was reinitialized,  */
+	FE_REINIT	= 0x40,   /*  frontend was reinitialized,  */
+	FE_EXTENDED_TP  = 0x80    /*  providing new informations */
 } fe_status_t;			  /*  application is recommended to reset */
 				  /*  DiSEqC, tone and parameters */
@@ -163,6 +232,12 @@
 	VSB_16
 } fe_modulation_t;
+typedef enum fe_rolloff_factor {
+	ROLLOFF_ALPHA_0_35,
+	ROLLOFF_ALPHA_0_25,
+	ROLLOFF_ALPHA_0_20
+} fe_rolloff_factor_t;
+

According to 302 307, we will need to identify between TSI (Transport Stream Input) /GSI (Generic Stream Input)
so we need some more information like this ..

bb_params {
   // TS/GS (2 bits)   (TS / GS (packetized / continuous) )
   // Null packet deletion (active/not active)
   // Transmission Rollof Factor (Alpha) (2 bits)

   // User Packet Length (2 bytes) range = 0 - 65535
   // Data Field Length (2 bytes) range = 0 - 58112
// Sync Byte (1 byte) MPEG TS = 0x47/Generic packetized stream = 0x00/unknown for generic continuous streams // Sync Distance (2 bytes) distance from the beginning of the DATA FIELD and the first UP (User Packet)
}


If we use the packet/sync definitions separately, we can reuse them for other protocols , for eg: DSS


Comments .. ?


Manu



_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux