1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/*
* frontend.h
*
* Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
* & Ralph Metzler <ralph@convergence.de>
* for convergence integrated media GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _FRONTEND_H_
#define _FRONTEND_H_
#if defined(__sun)
#include <sys/ioccom.h>
#else
#include <asm/types.h>
#endif
#define ENOSIGNAL 768
#ifndef EBUFFEROVERFLOW
#define EBUFFEROVERFLOW 769
#endif
typedef uint32_t FrontendStatus;
/* bit definitions for FrontendStatus */
#define FE_HAS_POWER 1
#define FE_HAS_SIGNAL 2
#define FE_SPECTRUM_INV 4
#define FE_HAS_LOCK 8
#define FE_HAS_CARRIER 16
#define FE_HAS_VITERBI 32
#define FE_HAS_SYNC 64
#define FE_TUNER_HAS_LOCK 128
/* possible values for spectral inversion */
typedef enum {
INVERSION_OFF,
INVERSION_ON,
INVERSION_AUTO
} SpectralInversion;
/* possible values for FEC_inner/FEC_outer */
typedef enum {
FEC_AUTO,
FEC_1_2,
FEC_2_3,
FEC_3_4,
FEC_5_6,
FEC_7_8,
FEC_NONE
} CodeRate;
typedef enum {
QPSK,
QAM_16,
QAM_32,
QAM_64,
QAM_128,
QAM_256
} Modulation;
typedef enum {
TRANSMISSION_MODE_2K,
TRANSMISSION_MODE_8K
} TransmitMode;
typedef enum {
BANDWIDTH_8_MHZ,
BANDWIDTH_7_MHZ,
BANDWIDTH_6_MHZ
} BandWidth;
typedef enum {
GUARD_INTERVAL_1_32,
GUARD_INTERVAL_1_16,
GUARD_INTERVAL_1_8,
GUARD_INTERVAL_1_4
} GuardInterval;
typedef enum {
HIERARCHY_NONE,
HIERARCHY_1,
HIERARCHY_2,
HIERARCHY_4
} Hierarchy;
typedef struct {
uint32_t SymbolRate; /* symbol rate in Symbols per second */
CodeRate FEC_inner; /* forward error correction (see above) */
} QPSKParameters;
typedef struct {
uint32_t SymbolRate; /* symbol rate in Symbols per second */
CodeRate FEC_inner; /* forward error correction (see above) */
Modulation QAM; /* modulation type (see above) */
} QAMParameters;
typedef struct {
BandWidth bandWidth;
CodeRate HP_CodeRate; /* high priority stream code rate */
CodeRate LP_CodeRate; /* low priority stream code rate */
Modulation Constellation; /* modulation type (see above) */
TransmitMode TransmissionMode;
GuardInterval guardInterval;
Hierarchy HierarchyInformation;
} OFDMParameters;
typedef enum {
FE_QPSK,
FE_QAM,
FE_OFDM
} FrontendType;
typedef struct {
uint32_t Frequency; /* (absolute) frequency in Hz for QAM/OFDM */
/* intermediate frequency in kHz for QPSK */
SpectralInversion Inversion; /* spectral inversion */
union {
QPSKParameters qpsk;
QAMParameters qam;
OFDMParameters ofdm;
} u;
} FrontendParameters;
typedef enum {
FE_UNEXPECTED_EV, /* unexpected event (e.g. loss of lock) */
FE_COMPLETION_EV, /* completion event, tuning succeeded */
FE_FAILURE_EV /* failure event, we couldn't tune */
} EventType;
typedef struct {
EventType type; /* type of event, FE_UNEXPECTED_EV, ... */
long timestamp; /* time in seconds since 1970-01-01 */
union {
struct {
FrontendStatus previousStatus; /* status before event */
FrontendStatus currentStatus; /* status during event */
} unexpectedEvent;
FrontendParameters completionEvent; /* parameters for which the
tuning succeeded */
FrontendStatus failureEvent; /* status at failure (e.g. no lock) */
} u;
} FrontendEvent;
typedef struct {
FrontendType type;
uint32_t minFrequency;
uint32_t maxFrequency;
uint32_t maxSymbolRate;
uint32_t minSymbolRate;
uint32_t hwType;
uint32_t hwVersion;
} FrontendInfo;
typedef enum {
FE_POWER_ON,
FE_POWER_STANDBY,
FE_POWER_SUSPEND,
FE_POWER_OFF
} FrontendPowerState;
#define FE_SELFTEST _IO('o', 61)
#define FE_SET_POWER_STATE _IOW('o', 62, FrontendPowerState)
#define FE_GET_POWER_STATE _IOR('o', 63, FrontendPowerState*)
#define FE_READ_STATUS _IOR('o', 64, FrontendStatus*)
#define FE_READ_BER _IOW('o', 65, uint32_t*)
#define FE_READ_SIGNAL_STRENGTH _IOR('o', 66, __s32*)
#define FE_READ_SNR _IOR('o', 67, __s32*)
#define FE_READ_UNCORRECTED_BLOCKS _IOW('o', 68, uint32_t*)
#define FE_GET_NEXT_FREQUENCY _IOW('o', 69, uint32_t*)
#define FE_GET_NEXT_SYMBOL_RATE _IOW('o', 70, uint32_t*)
#define FE_SET_FRONTEND _IOW('o', 71, FrontendParameters*)
#define FE_GET_FRONTEND _IOR('o', 72, FrontendParameters*)
#define FE_GET_INFO _IOR('o', 73, FrontendInfo*)
#define FE_GET_EVENT _IOR('o', 74, FrontendEvent*)
#endif /*_FRONTEND_H_*/
|