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

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

 



Hi,

attached is the newest version of my frontend.h patch that should bring us 
support for dvb-s2 frontends on api side.


From: Marcel Siegert <mws@xxxxxxxxxxx>

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

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.

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.
Remark: still the both backported v4 enums are kept, but should be replaced by according 
             v3 style enumerations.

finally added dvb_api_version struct and corresponding FE_GET_API_VERSION ioctl to query the
dvb api version. (needs more discussion - maybe move to dvb-core)

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

please provide comments.

best regards
marcel
--- 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-03 20:29:51.808326500 +0100
@@ -28,15 +28,22 @@
 
 #include <asm/types.h>
 
-
+/**
+ * Usage of fe_type_t enumerations:
+ * Don't use FE_QPSK, FE_QAM, FE_OFDM any longer in new applications.
+ * They are deprecated and just kept for compatibility issues.
+ */
 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 +69,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,6 +89,21 @@
 	fe_caps_t  caps;
 };
 
+/*! describes common supported frontend capabilities. */
+enum dvb_fe_common_cap {
+	DVB_FE_CAN_INVERSION_AUTO   = (1 << 0), /*!< frontend can handle spectral inversion automatically */
+	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), /*!< 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), /*!< (DVB-T specific) */
+	DVB_FE_CAN_BANDWIDTH_AUTO         = (1 << 1), /*!< (DVB-T specific) */
+	DVB_FE_CAN_GUARD_INTERVAL_AUTO    = (1 << 2), /*!< (DVB-T specific) */
+	DVB_FE_CAN_HIERARCHY_AUTO         = (1 << 31), /*!< (DVB-T specific) */
+};
 
 /**
  *  Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
@@ -126,9 +148,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,7 +169,9 @@
 	FEC_6_7,
 	FEC_7_8,
 	FEC_8_9,
-	FEC_AUTO
+	FEC_AUTO,
+	FEC_3_5,
+	FEC_9_10
 } fe_code_rate_t;
 
 
@@ -160,9 +184,20 @@
 	QAM_256,
 	QAM_AUTO,
 	VSB_8,
-	VSB_16
+	VSB_16,
+	VSB_2,
+	VSB_4,
+	BPSK,
+	APSK_16,
+	APSK_32
 } fe_modulation_t;
 
+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 +229,27 @@
 	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 {
+	fe_code_rate_t 		caps_fec;		/*!< supported fecs */
+	fe_modulation_t		caps_modulation;	/*!< supported modulations */
+	enum dvb_fe_common_cap	caps_common;		/*!< supported common capabilities */
+	enum dvb_fe_other_cap	caps_other;		/*!< supported other capabilities */
+	fe_type_t		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 +258,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,25 +268,75 @@
 	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 notice on dvb_frontend_event and FE_GET_EVENT
+ * 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;
 };
 
+/**
+ * Struct to keep the api version which can be queried
+ * via the FE_GET_API_VERSION ioctl.
+ * Need for having encapsulation libraries in userspace
+ * possible.
+ */
+struct dvb_api_version {
+	__u16	major;
+	__u16	minor;
+};
 
 /**
  * When set, this flag will disable any zigzagging or other "normal" tuning
@@ -267,9 +365,29 @@
 #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 */
+
+/**
+ * if called return the current frontend api version
+ */
+#define FE_GET_API_VERSION	   _IOR('o', 85, struct dvb_api_version)
+
+/**
+ * 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: pgpPs2uFxc1me.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