Merge commit '9573e68' from 'osmocom/master'

development
Karl Semich 2018-10-03 17:45:43 +00:00
commit 3180dba9ff
16 changed files with 234 additions and 126 deletions

View File

@ -58,6 +58,9 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
ADD_DEFINITIONS(-Wdeclaration-after-statement)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden)
elseif(MSVC14 OR MSVC14)
#pthread-w32 issue, timespec is now part of time.h
ADD_DEFINITIONS(-D_TIMESPEC_DEFINED)
endif()
OPTION(RTL_STATIC_BUILD "Build rtl-tools static (except RTLSDR.DLL) on MinGW/Win32" ON)
@ -89,7 +92,9 @@ ENDIF()
########################################################################
find_package(PkgConfig)
find_package(LibUSB)
set(THREADS_USE_PTHREADS_WIN32 true)
if(WIN32 AND NOT MINGW)
set(THREADS_USE_PTHREADS_WIN32 true)
endif()
find_package(Threads)
if(NOT LIBUSB_FOUND)

View File

@ -19,7 +19,7 @@ install-udev-rules:
uninstall-udev-rules:
rm -rf /etc/udev/rules.d/rtl-sdr.rules
EXTRA_DIST = git-version-gen
EXTRA_DIST = git-version-gen .version
if HAVE_DOXYGEN
@ -40,7 +40,7 @@ install-data-hook:
cd $(DESTDIR)$(doc_htmldir) && tar xf html.tar --strip-components 1 && rm -f html.tar
uninstall-hook:
cd $(DESTDIR) && rm -rf $(doc_htmldir)
rm -rf $(DESTDIR)/$(doc_htmldir)
DX_CLEAN = doc/{html,latex}/* doc/html.tar

View File

@ -9,7 +9,7 @@ rtl-sdr turns your Realtek RTL2832 based DVB dongle into a SDR receiver
# For more information see:
http://sdr.osmocom.org/trac/wiki/Rtl-sdr
https://osmocom.org/projects/rtl-sdr/wiki
# Contributing

View File

@ -49,6 +49,33 @@ AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"])
dnl librealtime (for rtl_test)
AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
AC_ARG_ENABLE(sanitize,
[AS_HELP_STRING([--enable-sanitize], [Compile with address sanitizer enabled], )],
[sanitize=$enableval], [sanitize="no"])
if test x"$sanitize" = x"yes"
then
CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
fi
AC_ARG_ENABLE(werror,
[AS_HELP_STRING(
[--enable-werror],
[Turn all compiler warnings into errors, with exceptions:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
]
)],
[werror=$enableval], [werror="no"])
if test x"$werror" = x"yes"
then
WERROR_FLAGS="-Werror"
WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
CFLAGS="$CFLAGS $WERROR_FLAGS"
CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
fi
# The following test is taken from WebKit's webkit.m4
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden "

40
contrib/jenkins.sh 100755
View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# jenkins build helper script for openbsc. This is how we build on jenkins.osmocom.org
if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
exit 2
fi
set -ex
base="$PWD"
deps="$base/deps"
inst="$deps/install"
export deps inst
osmo-clean-workspace.sh
mkdir "$deps" || true
set +x
echo
echo
echo
echo " =============================== rtl-sdr ==============================="
echo
set -x
cd "$base"
autoreconf --install --force
./configure --enable-sanitize --enable-werror
$MAKE $PARALLEL_MAKE
LD_LIBRARY_PATH="$inst/lib" $MAKE check \
|| cat-testlogs.sh
LD_LIBRARY_PATH="$inst/lib" \
DISTCHECK_CONFIGURE_FLAGS="--enable-werror" \
$MAKE distcheck \
|| cat-testlogs.sh
osmo-clean-workspace.sh

View File

@ -445,7 +445,7 @@ RTLSDR_API int rtlsdr_ir_query(rtlsdr_dev_t *dev, uint8_t *buf, size_t buf_len);
*
* \param dev the device handle given by rtlsdr_open()
* \param on 1 for Bias T on. 0 for Bias T off.
* \return -1 if device is not initialized. 1 otherwise.
* \return -1 if device is not initialized. 0 otherwise.
*/
RTLSDR_API int rtlsdr_set_bias_tee(rtlsdr_dev_t *dev, int on);

View File

@ -41,10 +41,10 @@ enum RTL_TCP_COMMANDS {
SET_RTL_CRYSTAL = 0x0B,
SET_TUNER_CRYSTAL = 0x0C,
SET_TUNER_GAIN_BY_INDEX = 0x0D,
SET_TUNER_BANDWIDTH = 0x0E,
SET_BIAS_TEE = 0x0F,
UDP_ESTABLISH = 0x10,
UDP_TERMINATE = 0x11
SET_BIAS_TEE = 0x0E,
SET_TUNER_BANDWIDTH = 0x40,
UDP_ESTABLISH = 0x41,
UDP_TERMINATE = 0x42
};
#ifdef __cplusplus

View File

@ -53,9 +53,11 @@ double atofs(char *s)
case 'g':
case 'G':
suff *= 1e3;
/* fall-through */
case 'm':
case 'M':
suff *= 1e3;
/* fall-through */
case 'k':
case 'K':
suff *= 1e3;
@ -80,9 +82,11 @@ double atoft(char *s)
case 'h':
case 'H':
suff *= 60;
/* fall-through */
case 'm':
case 'M':
suff *= 60;
/* fall-through */
case 's':
case 'S':
suff *= atof(s);

View File

@ -105,6 +105,7 @@ struct rtlsdr_dev {
void *cb_ctx;
enum rtlsdr_async_status async_status;
int async_cancel;
int use_zerocopy;
/* rtl demod context */
uint32_t rate; /* Hz */
uint32_t rtl_xtal; /* Hz */
@ -640,7 +641,7 @@ void rtlsdr_set_gpio_output(rtlsdr_dev_t *dev, uint8_t gpio)
gpio = 1 << gpio;
r = rtlsdr_read_reg(dev, SYSB, GPD, 1);
rtlsdr_write_reg(dev, SYSB, GPD, r & ~gpio, 1); // CARL: Changed from rtlsdr_write_reg(dev, SYSB, GPO, r & ~gpio, 1); must be a bug in the old code
rtlsdr_write_reg(dev, SYSB, GPD, r & ~gpio, 1);
r = rtlsdr_read_reg(dev, SYSB, GPOE, 1);
rtlsdr_write_reg(dev, SYSB, GPOE, r | gpio, 1);
}
@ -1926,11 +1927,11 @@ int rtlsdr_open(rtlsdr_dev_t **out_dev, uint32_t index)
}
/* initialise GPIOs */
rtlsdr_set_gpio_output(dev, 5);
rtlsdr_set_gpio_output(dev, 4);
/* reset tuner before probing */
rtlsdr_set_gpio_bit(dev, 5, 1);
rtlsdr_set_gpio_bit(dev, 5, 0);
rtlsdr_set_gpio_bit(dev, 4, 1);
rtlsdr_set_gpio_bit(dev, 4, 0);
reg = rtlsdr_i2c_read_reg(dev, FC2580_I2C_ADDR, FC2580_CHECK_ADDR);
if ((reg & 0x7f) == FC2580_CHECK_VAL) {
@ -1955,6 +1956,7 @@ found:
switch (dev->tuner_type) {
case RTLSDR_TUNER_R828D:
dev->tun_xtal = R828D_XTAL_FREQ;
/* fall-through */
case RTLSDR_TUNER_R820T:
/* disable Zero-IF mode */
rtlsdr_demod_write_reg(dev, 1, 0xb1, 0x1a, 1);
@ -2132,12 +2134,49 @@ static int _rtlsdr_alloc_async_buffers(rtlsdr_dev_t *dev)
dev->xfer[i] = libusb_alloc_transfer(0);
}
if (!dev->xfer_buf) {
dev->xfer_buf = malloc(dev->xfer_buf_num *
sizeof(unsigned char *));
if (dev->xfer_buf)
return -2;
for(i = 0; i < dev->xfer_buf_num; ++i)
dev->xfer_buf = malloc(dev->xfer_buf_num * sizeof(unsigned char *));
memset(dev->xfer_buf, 0, dev->xfer_buf_num * sizeof(unsigned char *));
#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105
fprintf(stderr, "Allocating %d zero-copy buffers\n", dev->xfer_buf_num);
dev->use_zerocopy = 1;
for (i = 0; i < dev->xfer_buf_num; ++i) {
dev->xfer_buf[i] = libusb_dev_mem_alloc(dev->devh, dev->xfer_buf_len);
if (!dev->xfer_buf[i]) {
fprintf(stderr, "Failed to allocate zero-copy "
"buffer for transfer %d\nFalling "
"back to buffers in userspace\n", i);
dev->use_zerocopy = 0;
break;
}
}
/* zero-copy buffer allocation failed (partially or completely)
* we need to free the buffers again if already allocated */
if (!dev->use_zerocopy) {
for (i = 0; i < dev->xfer_buf_num; ++i) {
if (dev->xfer_buf[i])
libusb_dev_mem_free(dev->devh,
dev->xfer_buf[i],
dev->xfer_buf_len);
}
}
#endif
/* no zero-copy available, allocate buffers in userspace */
if (!dev->use_zerocopy) {
for (i = 0; i < dev->xfer_buf_num; ++i) {
dev->xfer_buf[i] = malloc(dev->xfer_buf_len);
if (!dev->xfer_buf[i])
return -ENOMEM;
}
}
return 0;
@ -2162,9 +2201,18 @@ static int _rtlsdr_free_async_buffers(rtlsdr_dev_t *dev)
}
if (dev->xfer_buf) {
for(i = 0; i < dev->xfer_buf_num; ++i) {
if (dev->xfer_buf[i])
free(dev->xfer_buf[i]);
for (i = 0; i < dev->xfer_buf_num; ++i) {
if (dev->xfer_buf[i]) {
if (dev->use_zerocopy) {
#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105
libusb_dev_mem_free(dev->devh,
dev->xfer_buf[i],
dev->xfer_buf_len);
#endif
} else {
free(dev->xfer_buf[i]);
}
}
}
free(dev->xfer_buf);
@ -2226,7 +2274,12 @@ int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx,
r = libusb_submit_transfer(dev->xfer[i]);
if (r < 0) {
fprintf(stderr, "Failed to submit transfer %i!\n", i);
fprintf(stderr, "Failed to submit transfer %i\n"
"Please increase your allowed "
"usbfs buffer size with the "
"following command:\n"
"echo 0 > /sys/module/usbcore"
"/parameters/usbfs_memory_mb\n", i);
dev->async_status = RTLSDR_CANCELING;
break;
}
@ -2344,7 +2397,6 @@ int rtlsdr_i2c_read_fn(void *dev, uint8_t addr, uint8_t *buf, int len)
return -1;
}
/* Infrared (IR) sensor support
* based on Linux dvb_usb_rtl28xxu drivers/media/usb/dvb-usb-v2/rtl28xxu.h
* Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
@ -2501,12 +2553,13 @@ err:
return ret;
}
int rtlsdr_set_bias_tee(rtlsdr_dev_t *dev, int on) {
int rtlsdr_set_bias_tee(rtlsdr_dev_t *dev, int on)
{
if (!dev)
return -1;
rtlsdr_set_gpio_output(dev, 0);
rtlsdr_set_gpio_bit(dev, 0, on);
return 1;
}
return 0;
}

View File

@ -495,6 +495,8 @@ int main(int argc, char **argv)
else {
fprintf(stderr, "\nLibrary error %d, exiting...\n", r);}
rtlsdr_cancel_async(dev);
pthread_cancel(demod_thread);
pthread_join(demod_thread, NULL);
pthread_cond_destroy(&ready);
pthread_mutex_destroy(&ready_m);

View File

@ -303,6 +303,7 @@ int main(int argc, char **argv)
case 'w':
flash_file = 1;
change = 1;
/* fall-through */
case 'r':
filename = optarg;
break;

View File

@ -1704,7 +1704,7 @@ int main(int argc, char **argv)
controller_init(&controller);
cmd_init(&cmd);
while ((opt = getopt(argc, argv, "d:f:C:B:m:g:s:b:l:L:o:t:r:p:E:q:F:A:M:c:h:w:W:D:Tnv")) != -1) {
while ((opt = getopt(argc, argv, "d:f:g:s:b:l:o:t:r:p:E:F:A:M:hTC:B:m:L:q:c:w:W:D:nv")) != -1) {
switch (opt) {
case 'd':
dongle.dev_index = verbose_device_search(optarg);
@ -1822,6 +1822,9 @@ int main(int argc, char **argv)
demod.deemph = 1;
demod.squelch_level = 0;}
break;
case 'T':
enable_biastee = 1;
break;
case 'c':
if (strcmp("us", optarg) == 0)
timeConstant = 75;
@ -1830,9 +1833,6 @@ int main(int argc, char **argv)
else
timeConstant = (int)atof(optarg);
break;
case 'T':
enable_biastee = 1;
break;
case 'D':
ds_temp = (uint32_t)( atofs(optarg) + 0.5 );
if (ds_temp <= RTLSDR_DS_Q_BELOW)

View File

@ -790,7 +790,7 @@ int main(int argc, char **argv)
double (*window_fn)(int, int) = rectangle;
freq_optarg = "";
while ((opt = getopt(argc, argv, "f:i:s:t:d:g:p:e:w:c:F:D:1POTh")) != -1) {
while ((opt = getopt(argc, argv, "f:i:s:t:d:g:p:e:w:c:F:1POhTD:")) != -1) {
switch (opt) {
case 'f': // lower:upper:bin_size
freq_optarg = strdup(optarg);

View File

@ -84,8 +84,9 @@ typedef struct { /* structure size must be multiple of 2 bytes */
static rtlsdr_dev_t *dev = NULL;
static int verbosity = 0;
static int enable_biastee = 0;
static uint32_t bandwidth = 0;
static int enable_biastee = 0;
static int global_numq = 0;
static struct llist *ll_buffers = 0;
static int llbuf_num = 500;
@ -109,6 +110,7 @@ void usage(void)
"\t[-d device index (default: 0)]\n"
"\t[-P ppm_error (default: 0)]\n"
"\t[-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]\n"
"\t[-D direct_sampling_mode (default: 0, 1 = I, 2 = Q, 3 = I below threshold, 4 = Q below threshold)]\n"
"\t[-D direct_sampling_threshold_frequency (default: 0 use tuner specific frequency threshold for 3 and 4)]\n"
"\t[-v increase verbosity (default: 0)]\n");
@ -377,15 +379,15 @@ static void *command_worker(void *arg)
printf("set tuner gain by index %d\n", ntohl(cmd.param));
set_gain_by_index(dev, ntohl(cmd.param));
break;
case SET_BIAS_TEE:
printf("set bias tee %d\n", ntohl(cmd.param));
rtlsdr_set_bias_tee(dev, (int)ntohl(cmd.param));
break;
case SET_TUNER_BANDWIDTH:
bandwidth = ntohl(cmd.param);
printf("set tuner bandwidth to %i Hz\n", bandwidth);
verbose_set_bandwidth(dev, bandwidth);
break;
case SET_BIAS_TEE:
printf("setting bias-t to %d\n", ntohl(cmd.param));
rtlsdr_set_bias_tee(dev, ntohl(cmd.param));
break;
default:
break;
}
@ -512,7 +514,7 @@ int main(int argc, char **argv)
struct sigaction sigact, sigign;
#endif
while ((opt = getopt(argc, argv, "a:p:I:W:f:g:s:b:l:n:d:P:w:D:vT")) != -1) {
while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:TI:W:l:w:D:v")) != -1) {
switch (opt) {
case 'd':
dev_index = verbose_device_search(optarg);
@ -551,15 +553,15 @@ int main(int argc, char **argv)
case 'P':
ppm_error = atoi(optarg);
break;
case 'T':
enable_biastee = 1;
break;
case 'w':
bandwidth = (uint32_t)atofs(optarg);
break;
case 'v':
++verbosity;
break;
case 'T':
enable_biastee = 1;
break;
case 'D':
ds_temp = (uint32_t)( atofs(optarg) + 0.5 );
if (ds_temp <= RTLSDR_DS_Q_BELOW)

View File

@ -53,6 +53,21 @@
#define PPM_DURATION 10
#define PPM_DUMP_TIME 5
struct time_generic
/* holds all the platform specific values */
{
#ifndef _WIN32
time_t tv_sec;
long tv_nsec;
#else
long tv_sec;
long tv_nsec;
int init;
LARGE_INTEGER frequency;
LARGE_INTEGER ticks;
#endif
};
static enum {
NO_BENCHMARK,
TUNER_BENCHMARK,
@ -134,21 +149,42 @@ static void underrun_test(unsigned char *buf, uint32_t len, int mute)
}
#ifndef _WIN32
static int ppm_gettime(struct timespec *ts)
static int ppm_gettime(struct time_generic *tg)
{
int rv = ENOSYS;
struct timespec ts;
#ifdef __unix__
rv = clock_gettime(CLOCK_MONOTONIC, ts);
rv = clock_gettime(CLOCK_MONOTONIC, &ts);
tg->tv_sec = ts.tv_sec;
tg->tv_nsec = ts.tv_nsec;
#elif __APPLE__
struct timeval tv;
rv = gettimeofday(&tv, NULL);
ts->tv_sec = tv.tv_sec;
ts->tv_nsec = tv.tv_usec * 1000;
tg->tv_sec = tv.tv_sec;
tg->tv_nsec = tv.tv_usec * 1000;
#endif
return rv;
}
#endif
#ifdef _WIN32
static int ppm_gettime(struct time_generic *tg)
{
int rv;
int64_t frac;
if (!tg->init) {
QueryPerformanceFrequency(&tg->frequency);
tg->init = 1;
}
rv = QueryPerformanceCounter(&tg->ticks);
tg->tv_sec = tg->ticks.QuadPart / tg->frequency.QuadPart;
frac = (int64_t)(tg->ticks.QuadPart - (tg->tv_sec * tg->frequency.QuadPart));
tg->tv_nsec = (long)(frac * 1000000000L / (int64_t)tg->frequency.QuadPart);
return !rv;
}
#endif
static int ppm_report(uint64_t nsamples, uint64_t interval)
{
@ -165,8 +201,8 @@ static void ppm_test(uint32_t len)
static uint64_t interval = 0;
static uint64_t nsamples_total = 0;
static uint64_t interval_total = 0;
struct timespec ppm_now;
static struct timespec ppm_recent;
struct time_generic ppm_now;
static struct time_generic ppm_recent;
static enum {
PPM_INIT_NO,
PPM_INIT_DUMP,
@ -174,6 +210,7 @@ static void ppm_test(uint32_t len)
} ppm_init = PPM_INIT_NO;
ppm_gettime(&ppm_now);
if (ppm_init != PPM_INIT_RUN) {
/*
* Kyle Keen wrote:
@ -189,11 +226,11 @@ static void ppm_test(uint32_t len)
}
if (ppm_init == PPM_INIT_DUMP && ppm_recent.tv_sec < ppm_now.tv_sec)
return;
ppm_recent.tv_sec = ppm_now.tv_sec;
ppm_recent.tv_nsec = ppm_now.tv_nsec;
ppm_recent = ppm_now;
ppm_init = PPM_INIT_RUN;
return;
}
nsamples += (uint64_t)(len / 2UL);
interval = (uint64_t)(ppm_now.tv_sec - ppm_recent.tv_sec);
if (interval < ppm_duration)
@ -206,19 +243,16 @@ static void ppm_test(uint32_t len)
(int)((1000000000UL * nsamples) / interval),
ppm_report(nsamples, interval),
ppm_report(nsamples_total, interval_total));
ppm_recent.tv_sec = ppm_now.tv_sec;
ppm_recent.tv_nsec = ppm_now.tv_nsec;
ppm_recent = ppm_now;
nsamples = 0;
}
#endif
static void rtlsdr_callback(unsigned char *buf, uint32_t len, void *ctx)
{
underrun_test(buf, len, 0);
#ifndef _WIN32
if (test_mode == PPM_BENCHMARK)
ppm_test(len);
#endif
}
void e4k_benchmark(void)
@ -375,7 +409,7 @@ int main(int argc, char **argv)
verbose_reset_buffer(dev);
if ((test_mode == PPM_BENCHMARK) && !sync_mode) {
fprintf(stderr, "Reporting PPM error measurement every %i seconds...\n", ppm_duration);
fprintf(stderr, "Reporting PPM error measurement every %u seconds...\n", ppm_duration);
fprintf(stderr, "Press ^C after a few minutes.\n");
}

View File

@ -770,78 +770,18 @@ static int r82xx_set_tv_standard(struct r82xx_priv *priv,
uint8_t lt_att, flt_ext_widest, polyfil_cur;
int need_calibration;
if (delsys == SYS_ISDBT) {
if_khz = 4063;
filt_cal_lo = 59000;
filt_gain = 0x10; /* +3db, 6mhz on */
img_r = 0x00; /* image negative */
filt_q = 0x10; /* r10[4]:low q(1'b1) */
hp_cor = 0x6a; /* 1.7m disable, +2cap, 1.25mhz */
ext_enable = 0x40; /* r30[6], ext enable; r30[5]:0 ext at lna max */
loop_through = 0x00; /* r5[7], lt on */
lt_att = 0x00; /* r31[7], lt att enable */
flt_ext_widest = 0x00; /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
} else {
if (bw <= 6) {
if_khz = 3570;
filt_cal_lo = 56000; /* 52000->56000 */
filt_gain = 0x10; /* +3db, 6mhz on */
img_r = 0x00; /* image negative */
filt_q = 0x10; /* r10[4]:low q(1'b1) */
hp_cor = 0x6b; /* 1.7m disable, +2cap, 1.0mhz */
ext_enable = 0x60; /* r30[6]=1 ext enable; r30[5]:1 ext at lna max-1 */
loop_through = 0x00; /* r5[7], lt on */
lt_att = 0x00; /* r31[7], lt att enable */
flt_ext_widest = 0x00; /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
} else if (bw == 7) {
#if 0
/*
* There are two 7 MHz tables defined on the original
* driver, but just the second one seems to be visible
* by rtl2832. Keep this one here commented, as it
* might be needed in the future
*/
if_khz = 4070;
filt_cal_lo = 60000;
filt_gain = 0x10; /* +3db, 6mhz on */
img_r = 0x00; /* image negative */
filt_q = 0x10; /* r10[4]:low q(1'b1) */
hp_cor = 0x2b; /* 1.7m disable, +1cap, 1.0mhz */
ext_enable = 0x60; /* r30[6]=1 ext enable; r30[5]:1 ext at lna max-1 */
loop_through = 0x00; /* r5[7], lt on */
lt_att = 0x00; /* r31[7], lt att enable */
flt_ext_widest = 0x00; /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
#endif
/* 7 MHz, second table */
if_khz = 4570;
filt_cal_lo = 63000;
filt_gain = 0x10; /* +3db, 6mhz on */
img_r = 0x00; /* image negative */
filt_q = 0x10; /* r10[4]:low q(1'b1) */
hp_cor = 0x2a; /* 1.7m disable, +1cap, 1.25mhz */
ext_enable = 0x60; /* r30[6]=1 ext enable; r30[5]:1 ext at lna max-1 */
loop_through = 0x00; /* r5[7], lt on */
lt_att = 0x00; /* r31[7], lt att enable */
flt_ext_widest = 0x00; /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
} else {
if_khz = 4570;
filt_cal_lo = 68500;
filt_gain = 0x10; /* +3db, 6mhz on */
img_r = 0x00; /* image negative */
filt_q = 0x10; /* r10[4]:low q(1'b1) */
hp_cor = 0x0b; /* 1.7m disable, +0cap, 1.0mhz */
ext_enable = 0x60; /* r30[6]=1 ext enable; r30[5]:1 ext at lna max-1 */
loop_through = 0x00; /* r5[7], lt on */
lt_att = 0x00; /* r31[7], lt att enable */
flt_ext_widest = 0x00; /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
}
}
/* BW < 6 MHz */
if_khz = 3570;
filt_cal_lo = 56000; /* 52000->56000 */
filt_gain = 0x10; /* +3db, 6mhz on */
img_r = 0x00; /* image negative */
filt_q = 0x10; /* r10[4]:low q(1'b1) */
hp_cor = 0x6b; /* 1.7m disable, +2cap, 1.0mhz */
ext_enable = 0x60; /* r30[6]=1 ext enable; r30[5]:1 ext at lna max-1 */
loop_through = 0x01; /* r5[7], lt off */
lt_att = 0x00; /* r31[7], lt att enable */
flt_ext_widest = 0x00; /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
/* Initialize the shadow registers */
memcpy(priv->regs, r82xx_init_array, sizeof(r82xx_init_array));
@ -1318,7 +1258,7 @@ int r82xx_standby(struct r82xx_priv *priv)
rc = r82xx_write_reg(priv, 0x06, 0xb1);
if (rc < 0)
return rc;
rc = r82xx_write_reg(priv, 0x05, 0x03);
rc = r82xx_write_reg(priv, 0x05, 0xa0);
if (rc < 0)
return rc;
rc = r82xx_write_reg(priv, 0x07, 0x3a);