Skip to content

Commit

Permalink
merge original code updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sysrun committed Nov 6, 2013
2 parents 2d5efef + c5b8a21 commit 0034206
Show file tree
Hide file tree
Showing 15 changed files with 1,671 additions and 3,365 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endif()
# Set the version information here
set(VERSION_INFO_MAJOR_VERSION 0) # increment major on api compatibility changes
set(VERSION_INFO_MINOR_VERSION 5) # increment minor on feature-level changes
set(VERSION_INFO_PATCH_VERSION 1) # increment patch for bug fixes and docs
set(VERSION_INFO_PATCH_VERSION git) # increment patch for bug fixes and docs
include(Version) # setup version info

########################################################################
Expand All @@ -49,6 +49,7 @@ include(Version) # setup version info
if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
ADD_DEFINITIONS(-Wall)
ADD_DEFINITIONS(-Wextra)
ADD_DEFINITIONS(-Wno-unused-parameter)
ADD_DEFINITIONS(-Wno-unused)
ADD_DEFINITIONS(-Wsign-compare)
#http://gcc.gnu.org/wiki/Visibility
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ AC_SUBST(SYMBOL_VISIBILITY)

AC_MSG_CHECKING(whether compiler understands -Wall)
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused -Wsign-compare"
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wsign-compare"
AC_TRY_COMPILE([],[],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
Expand Down
2 changes: 1 addition & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rtlsdr_HEADERS = rtl-sdr.h rtl-sdr_export.h

noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r820t.h
noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r82xx.h

rtlsdrdir = $(includedir)
5 changes: 3 additions & 2 deletions include/rtl-sdr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
* Copyright (C) 2012 by Steve Markgraf <[email protected]>
* Copyright (C) 2012-2013 by Steve Markgraf <[email protected]>
* Copyright (C) 2012 by Dimitri Stolnikov <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -175,7 +175,8 @@ enum rtlsdr_tuner {
RTLSDR_TUNER_FC0012,
RTLSDR_TUNER_FC0013,
RTLSDR_TUNER_FC2580,
RTLSDR_TUNER_R820T
RTLSDR_TUNER_R820T,
RTLSDR_TUNER_R828D
};

/*!
Expand Down
3 changes: 0 additions & 3 deletions include/tuner_e4k.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ int e4k_if_filter_bw_set(struct e4k_state *e4k, enum e4k_if_filter filter,
int e4k_if_filter_chan_enable(struct e4k_state *e4k, int on);
int e4k_rf_filter_set(struct e4k_state *e4k);

int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val);
uint8_t e4k_reg_read(struct e4k_state *e4k, uint8_t reg);

int e4k_manual_dc_offset(struct e4k_state *e4k, int8_t iofs, int8_t irange, int8_t qofs, int8_t qrange);
int e4k_dc_offset_calibrate(struct e4k_state *e4k);
int e4k_dc_offset_gen_table(struct e4k_state *e4k);
Expand Down
196 changes: 0 additions & 196 deletions include/tuner_r820t.h

This file was deleted.

119 changes: 119 additions & 0 deletions include/tuner_r82xx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* Rafael Micro R820T/R828D driver
*
* Copyright (C) 2013 Mauro Carvalho Chehab <[email protected]>
* Copyright (C) 2013 Steve Markgraf <[email protected]>
*
* This driver is a heavily modified version of the driver found in the
* Linux kernel:
* http://git.linuxtv.org/linux-2.6.git/history/HEAD:/drivers/media/tuners/r820t.c
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 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 General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef R82XX_H
#define R82XX_H

#define R820T_I2C_ADDR 0x34
#define R828D_I2C_ADDR 0x74
#define R828D_XTAL_FREQ 16000000

#define R82XX_CHECK_ADDR 0x00
#define R82XX_CHECK_VAL 0x69

#define R82XX_IF_FREQ 3570000

#define REG_SHADOW_START 5
#define NUM_REGS 30
#define NUM_IMR 5
#define IMR_TRIAL 9

#define VER_NUM 49

enum r82xx_chip {
CHIP_R820T,
CHIP_R620D,
CHIP_R828D,
CHIP_R828,
CHIP_R828S,
CHIP_R820C,
};

enum r82xx_tuner_type {
TUNER_RADIO = 1,
TUNER_ANALOG_TV,
TUNER_DIGITAL_TV
};

enum r82xx_xtal_cap_value {
XTAL_LOW_CAP_30P = 0,
XTAL_LOW_CAP_20P,
XTAL_LOW_CAP_10P,
XTAL_LOW_CAP_0P,
XTAL_HIGH_CAP_0P
};

struct r82xx_config {
uint8_t i2c_addr;
uint32_t xtal;
enum r82xx_chip rafael_chip;
unsigned int max_i2c_msg_len;
int use_predetect;
};

struct r82xx_priv {
struct r82xx_config *cfg;

uint8_t regs[NUM_REGS];
uint8_t buf[NUM_REGS + 1];
enum r82xx_xtal_cap_value xtal_cap_sel;
uint16_t pll; /* kHz */
uint32_t int_freq;
uint8_t fil_cal_code;
uint8_t input;
int has_lock;
int init_done;

/* Store current mode */
uint32_t delsys;
enum r82xx_tuner_type type;

uint32_t bw; /* in MHz */

void *rtl_dev;
};

struct r82xx_freq_range {
uint32_t freq;
uint8_t open_d;
uint8_t rf_mux_ploy;
uint8_t tf_c;
uint8_t xtal_cap20p;
uint8_t xtal_cap10p;
uint8_t xtal_cap0p;
};

enum r82xx_delivery_system {
SYS_UNDEFINED,
SYS_DVBT,
SYS_DVBT2,
SYS_ISDBT,
};

int r82xx_standby(struct r82xx_priv *priv);
int r82xx_init(struct r82xx_priv *priv);
int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq);
int r82xx_set_gain(struct r82xx_priv *priv, int set_manual_gain, int gain);

#endif
3 changes: 3 additions & 0 deletions rtl-sdr.rules
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="066
# PixelView PV-DT235U(RN) (FC0012)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666"

# Astrometa DVB-T/DVB-T2 (R828D)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0131", MODE:="0666"

# Compro Videomate U620F (E4000)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666"

Expand Down
Loading

0 comments on commit 0034206

Please sign in to comment.