• 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  * Described at ETSI EN 300 468 V1.11.1 (2010-04)
20  */
21 
22 /**
23  * @file desc_cable_delivery.h
24  * @ingroup descriptors
25  * @brief Provides the descriptors for the cable delivery system descriptor
26  * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
27  * @author Mauro Carvalho Chehab
28  * @author Andre Roth
29  *
30  * @par Relevant specs
31  * The descriptor described herein is defined at:
32  * - ETSI EN 300 468 V1.11.1 (2010-04)
33  *
34  * @par Bug Report
35  * Please submit bug reports and patches to linux-media@vger.kernel.org
36  */
37 
38 #ifndef _CABLE_DELIVERY_H
39 #define _CABLE_DELIVERY_H
40 
41 #include <libdvbv5/descriptors.h>
42 
43 /**
44  * @struct dvb_desc_cable_delivery
45  * @ingroup descriptors
46  * @brief Structure containing the cable delivery system descriptor
47  *
48  * @param type			descriptor tag
49  * @param length		descriptor length
50  * @param next			pointer to struct dvb_desc
51  * @param frequency		frequency, converted to Hz.
52  * @param fec_outer		FEC outer (typically, Viterbi)
53  * @param modulation		modulation
54  * @param fec_inner		FEC inner (convolutional code)
55  * @param symbol_rate		symbol rate, converted to symbols/sec (bauds)
56  */
57 struct dvb_desc_cable_delivery {
58 	uint8_t type;
59 	uint8_t length;
60 	struct dvb_desc *next;
61 
62 	uint32_t frequency;
63 	union {
64 		uint16_t bitfield1;
65 		struct {
66 			uint16_t fec_outer:4;
67 			uint16_t reserved_future_use:12;
68 		} __attribute__((packed));
69 	} __attribute__((packed));
70 	uint8_t modulation;
71 	union {
72 		uint32_t bitfield2;
73 		struct {
74 			uint32_t fec_inner:4;
75 			uint32_t symbol_rate:28;
76 		} __attribute__((packed));
77 	} __attribute__((packed));
78 } __attribute__((packed));
79 
80 struct dvb_v5_fe_parms;
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 
86 /**
87  * @brief Initializes and parses the service location descriptor
88  * @ingroup descriptors
89  *
90  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
91  * @param buf	buffer containing the descriptor's raw data
92  * @param desc	pointer to struct dvb_desc to be allocated and filled
93  *
94  * This function initializes and makes sure that all fields will follow the CPU
95  * endianness. Due to that, the content of the buffer may change.
96  *
97  * Currently, no memory is allocated internally.
98  *
99  * @return On success, it returns the size of the allocated struct.
100  *	   A negative value indicates an error.
101  */
102 int dvb_desc_cable_delivery_init(struct dvb_v5_fe_parms *parms,
103 				 const uint8_t *buf, struct dvb_desc *desc);
104 
105 /**
106  * @brief Prints the content of the service location descriptor
107  * @ingroup descriptors
108  *
109  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
110  * @param desc	pointer to struct dvb_desc
111  */
112 void dvb_desc_cable_delivery_print(struct dvb_v5_fe_parms *parms,
113 				   const struct dvb_desc *desc);
114 
115 /**
116  * @brief converts from the descriptor's modulation into enum fe_modulation,
117  *	  as defined by DVBv5 API.
118  */
119 extern const unsigned dvbc_modulation_table[];
120 
121 /**
122  * @brief converts from the descriptor's FEC into enum fe_code_rate,
123  *	  as defined by DVBv5 API.
124  */
125 extern const unsigned dvbc_fec_table[];
126 
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif
133