[PATCH][RFC] dvb-s2 support added to frontend.h

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

 



hi all,

latest version of the dvb-s2 support patch is attached.

please comment.

best regards
marcel

From: Marcel Siegert <mws@xxxxxxxxxxx>

changes:
frontend types according to johannes suggestions.
fixed comment on FE_REINIT
added new fec_modes that dvb-s2 supports
added new modulations that dvb-s2 supports
added fe_rolloff_factor enums needed for dvb-s2

renamed modulation names. 
added backward #defines

added  dvb_fe_caps_extended struct
 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_INFO bit set.
 added fe_type_t member to this struct, thus now we are able to detect 
 combined frontends and their according types also

renamed dvb_[qpsk|quam|ofdm]_parameters to their system matching name 
dvb_[dvbs|dvbc|dvbt]_parameters
added dvb_dvbs2_parameters struct
provided backwards compatibility defines

adjusted dvb_frontend_parameters union members to match new 
dvb_[dvbs|dvbc|dvbt]_parameters names.
renamed dvb_frontend_parameters to __dvb_frontend_parameters_old
created new dvb_frontend_parameters struct also carrying the
dvb_frontend_parameters_extended struct that keeps (momentary only)
the dvb_dvbs2_parameters as a pointer.

added recommendation on dvb_frontend_event how this struct should be used via
the FE_GET_EVENT ioctl.
renamed member dvb_frontend_parameters to __dvb_frontend_parameters_old to 
gain backwards compatibility.

renamed ioctls FE_[GET|SET]_FRONTEND to __FE_[GET|SET]_FRONTEND_OLD
  adjusted ioctl params to match old structs name

added new FE_[GET|SET]_FRONTEND ioctls that use the new dvb_frontend_params struct.

*!IMPORTANT!*
chose to have ioctls numbered NOT with the __FE_[GET|SET]_FRONTEND_OLD numbers,
after discussion with andreas oberritter. (think this needs more investigation/discussion)

added FE_SET_STANDARD ioctl - used to set combined frontends to a specific mode.
drivers should report mode matching capabilities. other frontends more are determined via
the FE_GET_EXTENDED_INFO ioctl.

added FE_GET_EXTEND_INFO ioctl that reports more specific capabilities. we do get more 
enum values due to seperated struct members.

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


--- v4l-dvb/linux/include/linux/dvb/frontend.h	2006-02-27 01:36:46.117934750 +0100
+++ v4l-dvb-work/v4l-dvb/linux/include/linux/dvb/frontend.h	2006-03-22 18:48:33.291819500 +0100
@@ -28,15 +28,24 @@
 
 #include <asm/types.h>
 
-
+/**
+ * Usage of fe_type_t enumerations:
+ * Don't use FE_QPSK, FE_QAM, FE_OFDM any longer in new applications.
+ * If the FE_HAS_EXTENDED_INFO is set within the fe_caps,
+ * applications should ignore the fe_type_t returned by the FE_GET_INFO ioctl.
+ *
+ */
 typedef enum fe_type {
-	FE_QPSK,
-	FE_QAM,
-	FE_OFDM,
-	FE_ATSC
+	FE_QPSK = 0,
+	FE_QAM = 1,
+	FE_OFDM = 2,
+	FE_ATSC = 3,
+	FE_DVB_S = (1 << 2),
+	FE_DVB_C = (1 << 3),
+	FE_DVB_T = (1 << 4),
+	FE_DVB_S2 = (1 << 5),
 } fe_type_t;
 
-
 typedef enum fe_caps {
 	FE_IS_STUPID			= 0,
 	FE_CAN_INVERSION_AUTO		= 0x1,
@@ -62,12 +71,12 @@
 	FE_CAN_HIERARCHY_AUTO		= 0x100000,
 	FE_CAN_8VSB			= 0x200000,
 	FE_CAN_16VSB			= 0x400000,
+	FE_HAS_EXTENDED_INFO		= 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,7 +91,6 @@
 	fe_caps_t  caps;
 };
 
-
 /**
  *  Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
  *  the meaning of this struct...
@@ -126,9 +134,9 @@
 	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_status_t;			  /*  application is recommended to reset */
-				  /*  DiSEqC, tone and parameters */
+	FE_REINIT	= 0x40    /*  legacy cruft, do not use */
+} fe_status_t;
+
 
 typedef enum fe_spectral_inversion {
 	INVERSION_OFF,
@@ -147,22 +155,48 @@
 	FEC_6_7,
 	FEC_7_8,
 	FEC_8_9,
-	FEC_AUTO
+	FEC_AUTO,
+	FEC_3_5,
+	FEC_9_10
 } fe_code_rate_t;
 
 
 typedef enum fe_modulation {
-	QPSK,
-	QAM_16,
-	QAM_32,
-	QAM_64,
-	QAM_128,
-	QAM_256,
-	QAM_AUTO,
-	VSB_8,
-	VSB_16
+	MOD_QPSK,
+	MOD_QAM_16,
+	MOD_QAM_32,
+	MOD_QAM_64,
+	MOD_QAM_128,
+	MOD_QAM_256,
+	MOD_QAM_AUTO,
+	MOD_8VSB,
+	MOD_16VSB,
+	MOD_2VSB,
+	MOD_4VSB,
+	MOD_BPSK,
+	MOD_16APSK,
+	MOD_32APSK,
+	MOD_8PSK,
+	MOD_16PSK
 } fe_modulation_t;
 
+// backward defines
+#define	QPSK 		MOD_QPSK
+#define	QAM_16 		MOD_QAM_16
+#define	QAM_32 		MOD_QAM_32
+#define	QAM_64		MOD_QAM_64
+#define	QAM_128 	MOD_QAM_128
+#define	QAM_256 	MOD_QAM_256
+#define	QAM_AUTO 	MOD_QAM_AUTO
+#define	VSB_8		MOD_8VSB
+
+
+typedef enum fe_rolloff_factor {
+	ROLLOFF_ALPHA_0_35,
+	ROLLOFF_ALPHA_0_25,
+	ROLLOFF_ALPHA_0_20
+} fe_rolloff_factor_t;
+
 typedef enum fe_transmit_mode {
 	TRANSMISSION_MODE_2K,
 	TRANSMISSION_MODE_8K,
@@ -194,14 +228,25 @@
 	HIERARCHY_AUTO
 } fe_hierarchy_t;
 
+/**
+ *  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_INFO bit set.
+ */
+struct dvb_fe_caps_extended {
+	__u32	caps_fec;		/* supported fecs */
+	__u32	caps_modulation;	/* supported modulations */
+	__u32	caps_frontends_avail;	/* supported frontend_types */
+};
+
 
-struct dvb_qpsk_parameters {
-	__u32		symbol_rate;  /* symbol rate in Symbols per second */
+struct dvb_dvbs_parameters {
+	__u32		symbol_rate;  /* symbol rate in symbols per second */
 	fe_code_rate_t	fec_inner;    /* forward error correction (see above) */
 };
 
-struct dvb_qam_parameters {
-	__u32		symbol_rate; /* symbol rate in Symbols per second */
+struct dvb_dvbc_parameters {
+	__u32		symbol_rate; /* symbol rate in symbols per second */
 	fe_code_rate_t	fec_inner;   /* forward error correction (see above) */
 	fe_modulation_t	modulation;  /* modulation type (see above) */
 };
@@ -210,7 +255,7 @@
 	fe_modulation_t	modulation;  /* modulation type (see above) */
 };
 
-struct dvb_ofdm_parameters {
+struct dvb_dvbt_parameters {
 	fe_bandwidth_t      bandwidth;
 	fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
 	fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
@@ -220,26 +265,68 @@
 	fe_hierarchy_t      hierarchy_information;
 };
 
+struct dvb_dvbs2_parameters {
+	__u32			symbol_rate;    /* symbol rate in symbols per second */
+	fe_code_rate_t		fec_inner;      /* forward error correction (see above) */
+	fe_modulation_t		modulation;     /* modulation type (see above) */
+	fe_rolloff_factor_t	rolloff_factor; /* rolloff factor needed for dvb-s2 */
+};
+
+#define dvb_qpsk_parameters dvb_dvbs_parameters
+#define dvb_qam_parameters dvb_dvbc_parameters
+#define dvb_ofdm_parameters dvb_dvbt_parameters
+
+/* just kept for backwards binary compatibility */
+struct __dvb_frontend_parameters_old {
+	__u32 frequency;     /* (absolute) frequency in Hz for QAM/OFDM/ATSC */
+			     /* intermediate frequency in kHz for QPSK */
+	fe_spectral_inversion_t inversion;
+	union {
+		struct dvb_dvbs_parameters qpsk;
+		struct dvb_dvbc_parameters  qam;
+		struct dvb_dvbt_parameters ofdm;
+		struct dvb_vsb_parameters vsb;
+	} u;
+};
+
+struct dvb_frontend_parameters_extended {
+	union {
+		struct dvb_dvbs2_parameters qpsk2;
+	} u;
+};
 
 struct dvb_frontend_parameters {
 	__u32 frequency;     /* (absolute) frequency in Hz for QAM/OFDM/ATSC */
 			     /* intermediate frequency in kHz for QPSK */
 	fe_spectral_inversion_t inversion;
 	union {
-		struct dvb_qpsk_parameters qpsk;
-		struct dvb_qam_parameters  qam;
-		struct dvb_ofdm_parameters ofdm;
+		struct dvb_dvbs_parameters qpsk;
+		struct dvb_dvbc_parameters  qam;
+		struct dvb_dvbt_parameters ofdm;
 		struct dvb_vsb_parameters vsb;
 	} u;
+	/* next is new as previous union was just kept to gain source/binary backwards compatibility */
+	struct dvb_frontend_parameters_extended* extended_parameters;
 };
 
+/**
+ * Important:
+ * FE_GET_EVENT is a mis-designed ioctl
+ * informations within dvb_frontend_event will
+ * always return stale information.
+ * Applications should:
+ * - open the frontend device with O_NONBLOCK
+ * - poll() for events
+ * - FE_GET_EVENT all pending events to clear the POLLPRI status,
+ *   and throw them away
+ * - FE_READ_STATUS etc. to get current information
+ */
 
 struct dvb_frontend_event {
 	fe_status_t status;
-	struct dvb_frontend_parameters parameters;
+	struct __dvb_frontend_parameters_old parameters;
 };
 
-
 /**
  * When set, this flag will disable any zigzagging or other "normal" tuning
  * behaviour. Additionally, there will be no automatic monitoring of the lock
@@ -267,9 +354,24 @@
 #define FE_READ_SNR		   _IOR('o', 72, __u16)
 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
 
-#define FE_SET_FRONTEND		   _IOW('o', 76, struct dvb_frontend_parameters)
-#define FE_GET_FRONTEND		   _IOR('o', 77, struct dvb_frontend_parameters)
+#define FE_SET_FRONTEND   	   _IOW('o', 82, struct dvb_frontend_parameters)
+#define FE_GET_FRONTEND            _IOR('o', 83, struct dvb_frontend_parameters)
+#define __FE_SET_FRONTEND_OLD	   _IOW('o', 76, struct __dvb_frontend_parameters_old)
+#define __FE_GET_FRONTEND_OLD	   _IOR('o', 77, struct __dvb_frontend_parameters_old)
 #define FE_SET_FRONTEND_TUNE_MODE  _IO('o', 81) /* unsigned int */
+
+/**
+ * use to set the FE_STANDARD - if a tuner supports more than one type. e.g. DVB-C/T or DVB-S/S2 combi frontends
+ * after FE_SET_STANDARD was set, the drivers has to make sure still to reflect the standards available, but
+ * capabilities should be adjusted to the selected stanadard
+ */
+#define FE_SET_STANDARD		   _IO('o', 84) /* fe_type_t */
+
+/**
+ * used to query the api v4 backported capabilities (see above for details)
+ */
+#define FE_GET_EXTENDED_INFO	   _IOR('o', 86, struct dvb_fe_caps_extended)
+
 #define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
 
 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */

Attachment: pgpgK7RPkK0MN.pgp
Description: PGP signature

_______________________________________________

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