• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3  * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation version 2.1 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18  *
19  */
20 
21 /**
22  * @file desc_sat.h
23  * @ingroup descriptors
24  * @brief Provides the descriptors for the satellite delivery system descriptor
25  * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
26  * @author Mauro Carvalho Chehab
27  * @author Andre Roth
28  *
29  * @par Relevant specs
30  * The descriptor described herein is defined at:
31  * - ETSI EN 300 468 V1.11.1
32  *
33  * @par Bug Report
34  * Please submit bug reports and patches to linux-media@vger.kernel.org
35  */
36 
37 #ifndef _SAT_H
38 #define _SAT_H
39 
40 #include <libdvbv5/descriptors.h>
41 
42 /**
43  * @struct dvb_desc_sat
44  * @ingroup descriptors
45  * @brief Structure containing the satellite delivery system descriptor
46  *
47  * @param type			descriptor tag
48  * @param length		descriptor length
49  * @param next			pointer to struct dvb_desc
50  * @param frequency		frequency in kHz
51  * @param orbit			orbital position in degrees (multiplied by 10)
52  * @param west_east		west east flag. 0 = west, 1 = east
53  * @param polarization		polarization. 0 = horizontal, 1 = vertical,
54  *				2 = left, 3 = right.
55  * @param roll_off		roll off alpha factor. 0 = 0.35, 1 = 0.25,
56  * 				2 = 0.20, 3 = reserved.
57  * @param modulation_system	modulation system. 0 = DVB-S, 1 = DVB-S2.
58  * @param modulation_type	modulation type. 0 = auto, 1 = QPSK, 2 = 8PSK,
59  *				3 = 16-QAM (only for DVB-S2).
60  * @param symbol_rate		symbol rate in Kbauds.
61  * @param fec			inner FEC (convolutional code)
62  */
63 struct dvb_desc_sat {
64 	uint8_t type;
65 	uint8_t length;
66 	struct dvb_desc *next;
67 
68 	uint32_t frequency;
69 	uint16_t orbit;
70 	uint8_t modulation_type:2;
71 	uint8_t modulation_system:1;
72 	uint8_t roll_off:2;
73 	uint8_t polarization:2;
74 	uint8_t west_east:1;
75 	union {
76 		uint32_t bitfield;
77 		struct {
78 			uint32_t fec:4;
79 			uint32_t symbol_rate:28;
80 		} __attribute__((packed));
81 	} __attribute__((packed));
82 } __attribute__((packed));
83 
84 struct dvb_v5_fe_parms;
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
90 /**
91  * @brief Initializes and parses the satellite delivery system descriptor
92  * @ingroup descriptors
93  *
94  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
95  * @param buf	buffer containing the descriptor's raw data
96  * @param desc	pointer to struct dvb_desc to be allocated and filled
97  *
98  * This function initializes and makes sure that all fields will follow the CPU
99  * endianness. Due to that, the content of the buffer may change.
100  *
101  * Currently, no memory is allocated internally.
102  *
103  * @return On success, it returns the size of the allocated struct.
104  *	   A negative value indicates an error.
105  */
106 int dvb_desc_sat_init(struct dvb_v5_fe_parms *parms,
107 		      const uint8_t *buf, struct dvb_desc *desc);
108 
109 /**
110  * @brief Prints the content of the satellite delivery system descriptor
111  * @ingroup descriptors
112  *
113  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
114  * @param desc	pointer to struct dvb_desc
115  */
116 void dvb_desc_sat_print(struct dvb_v5_fe_parms *parms,
117 			const struct dvb_desc *desc);
118 
119 /**
120  * @brief converts from the descriptor's FEC into enum fe_code_rate,
121  *	  as defined by DVBv5 API.
122  */
123 extern const unsigned dvbs_dvbc_dvbs_freq_inner[];
124 
125 /**
126  * @brief converts from the descriptor's polarization into
127  *	  enum dvb_sat_polarization, as defined at dvb-v5-std.h.
128  */
129 extern const unsigned dvbs_polarization[];
130 
131 /**
132  * @brief converts from the descriptor's rolloff into  enum fe_rolloff,
133  *	  as defined by DVBv5 API.
134  */
135 extern const unsigned dvbs_rolloff[];
136 
137 /**
138  * @brief converts from the descriptor's modulation into enum fe_modulation,
139  *	  as defined by DVBv5 API.
140  */
141 extern const unsigned dvbs_modulation[];
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif
148