Skip to content

Commit 0034206

Browse files
committed
merge original code updates
2 parents 2d5efef + c5b8a21 commit 0034206

File tree

15 files changed

+1671
-3365
lines changed

15 files changed

+1671
-3365
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ endif()
4040
# Set the version information here
4141
set(VERSION_INFO_MAJOR_VERSION 0) # increment major on api compatibility changes
4242
set(VERSION_INFO_MINOR_VERSION 5) # increment minor on feature-level changes
43-
set(VERSION_INFO_PATCH_VERSION 1) # increment patch for bug fixes and docs
43+
set(VERSION_INFO_PATCH_VERSION git) # increment patch for bug fixes and docs
4444
include(Version) # setup version info
4545

4646
########################################################################
@@ -49,6 +49,7 @@ include(Version) # setup version info
4949
if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
5050
ADD_DEFINITIONS(-Wall)
5151
ADD_DEFINITIONS(-Wextra)
52+
ADD_DEFINITIONS(-Wno-unused-parameter)
5253
ADD_DEFINITIONS(-Wno-unused)
5354
ADD_DEFINITIONS(-Wsign-compare)
5455
#http://gcc.gnu.org/wiki/Visibility

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ AC_SUBST(SYMBOL_VISIBILITY)
6161

6262
AC_MSG_CHECKING(whether compiler understands -Wall)
6363
old_CFLAGS="$CFLAGS"
64-
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused -Wsign-compare"
64+
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wsign-compare"
6565
AC_TRY_COMPILE([],[],
6666
AC_MSG_RESULT(yes),
6767
AC_MSG_RESULT(no)

include/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
rtlsdr_HEADERS = rtl-sdr.h rtl-sdr_export.h
22

3-
noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r820t.h
3+
noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r82xx.h
44

55
rtlsdrdir = $(includedir)

include/rtl-sdr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
3-
* Copyright (C) 2012 by Steve Markgraf <[email protected]>
3+
* Copyright (C) 2012-2013 by Steve Markgraf <[email protected]>
44
* Copyright (C) 2012 by Dimitri Stolnikov <[email protected]>
55
*
66
* This program is free software: you can redistribute it and/or modify
@@ -175,7 +175,8 @@ enum rtlsdr_tuner {
175175
RTLSDR_TUNER_FC0012,
176176
RTLSDR_TUNER_FC0013,
177177
RTLSDR_TUNER_FC2580,
178-
RTLSDR_TUNER_R820T
178+
RTLSDR_TUNER_R820T,
179+
RTLSDR_TUNER_R828D
179180
};
180181

181182
/*!

include/tuner_e4k.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ int e4k_if_filter_bw_set(struct e4k_state *e4k, enum e4k_if_filter filter,
212212
int e4k_if_filter_chan_enable(struct e4k_state *e4k, int on);
213213
int e4k_rf_filter_set(struct e4k_state *e4k);
214214

215-
int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val);
216-
uint8_t e4k_reg_read(struct e4k_state *e4k, uint8_t reg);
217-
218215
int e4k_manual_dc_offset(struct e4k_state *e4k, int8_t iofs, int8_t irange, int8_t qofs, int8_t qrange);
219216
int e4k_dc_offset_calibrate(struct e4k_state *e4k);
220217
int e4k_dc_offset_gen_table(struct e4k_state *e4k);

include/tuner_r820t.h

Lines changed: 0 additions & 196 deletions
This file was deleted.

include/tuner_r82xx.h

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/*
2+
* Rafael Micro R820T/R828D driver
3+
*
4+
* Copyright (C) 2013 Mauro Carvalho Chehab <[email protected]>
5+
* Copyright (C) 2013 Steve Markgraf <[email protected]>
6+
*
7+
* This driver is a heavily modified version of the driver found in the
8+
* Linux kernel:
9+
* http://git.linuxtv.org/linux-2.6.git/history/HEAD:/drivers/media/tuners/r820t.c
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 2 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
25+
#ifndef R82XX_H
26+
#define R82XX_H
27+
28+
#define R820T_I2C_ADDR 0x34
29+
#define R828D_I2C_ADDR 0x74
30+
#define R828D_XTAL_FREQ 16000000
31+
32+
#define R82XX_CHECK_ADDR 0x00
33+
#define R82XX_CHECK_VAL 0x69
34+
35+
#define R82XX_IF_FREQ 3570000
36+
37+
#define REG_SHADOW_START 5
38+
#define NUM_REGS 30
39+
#define NUM_IMR 5
40+
#define IMR_TRIAL 9
41+
42+
#define VER_NUM 49
43+
44+
enum r82xx_chip {
45+
CHIP_R820T,
46+
CHIP_R620D,
47+
CHIP_R828D,
48+
CHIP_R828,
49+
CHIP_R828S,
50+
CHIP_R820C,
51+
};
52+
53+
enum r82xx_tuner_type {
54+
TUNER_RADIO = 1,
55+
TUNER_ANALOG_TV,
56+
TUNER_DIGITAL_TV
57+
};
58+
59+
enum r82xx_xtal_cap_value {
60+
XTAL_LOW_CAP_30P = 0,
61+
XTAL_LOW_CAP_20P,
62+
XTAL_LOW_CAP_10P,
63+
XTAL_LOW_CAP_0P,
64+
XTAL_HIGH_CAP_0P
65+
};
66+
67+
struct r82xx_config {
68+
uint8_t i2c_addr;
69+
uint32_t xtal;
70+
enum r82xx_chip rafael_chip;
71+
unsigned int max_i2c_msg_len;
72+
int use_predetect;
73+
};
74+
75+
struct r82xx_priv {
76+
struct r82xx_config *cfg;
77+
78+
uint8_t regs[NUM_REGS];
79+
uint8_t buf[NUM_REGS + 1];
80+
enum r82xx_xtal_cap_value xtal_cap_sel;
81+
uint16_t pll; /* kHz */
82+
uint32_t int_freq;
83+
uint8_t fil_cal_code;
84+
uint8_t input;
85+
int has_lock;
86+
int init_done;
87+
88+
/* Store current mode */
89+
uint32_t delsys;
90+
enum r82xx_tuner_type type;
91+
92+
uint32_t bw; /* in MHz */
93+
94+
void *rtl_dev;
95+
};
96+
97+
struct r82xx_freq_range {
98+
uint32_t freq;
99+
uint8_t open_d;
100+
uint8_t rf_mux_ploy;
101+
uint8_t tf_c;
102+
uint8_t xtal_cap20p;
103+
uint8_t xtal_cap10p;
104+
uint8_t xtal_cap0p;
105+
};
106+
107+
enum r82xx_delivery_system {
108+
SYS_UNDEFINED,
109+
SYS_DVBT,
110+
SYS_DVBT2,
111+
SYS_ISDBT,
112+
};
113+
114+
int r82xx_standby(struct r82xx_priv *priv);
115+
int r82xx_init(struct r82xx_priv *priv);
116+
int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq);
117+
int r82xx_set_gain(struct r82xx_priv *priv, int set_manual_gain, int gain);
118+
119+
#endif

rtl-sdr.rules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="066
4242
# PixelView PV-DT235U(RN) (FC0012)
4343
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666"
4444

45+
# Astrometa DVB-T/DVB-T2 (R828D)
46+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0131", MODE:="0666"
47+
4548
# Compro Videomate U620F (E4000)
4649
SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666"
4750

0 commit comments

Comments
 (0)