/* * This driver needs external firmware. Please use the command * "<kerneldir>/scripts/get_dvb_firmware or51211" to * download/extract it, and then copy it to /usr/lib/hotplug/firmware * or /lib/firmware (depending on configuration of firmware hotplug).
*/ #define OR51211_DEFAULT_FIRMWARE "dvb-fe-or51211.fw"
/* Change only if we are actually changing the channel */ if (state->current_frequency != p->frequency) { if (fe->ops.tuner_ops.set_params) {
fe->ops.tuner_ops.set_params(fe); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
}
/* Set to ATSC mode */
or51211_setmode(fe,0);
/* Update current frequency */
state->current_frequency = p->frequency;
} return 0;
}
For 8-VSB: SNR[dB] = 10 * log10(219037.9454 / MSE^2 )
We re-write the snr equation as: SNR * 2^24 = 10*(c - 2*intlog10(MSE))
Where for 8-VSB, c = log10(219037.9454) * 2^24 */
static u32 calculate_snr(u32 mse, u32 c)
{ if (mse == 0) /* No signal */ return 0;
mse = 2*intlog10(mse); if (mse > c) { /* Negative SNR, which is possible, but realisticly the demod will lose lock before the signal gets this bad. The
API only allows for unsigned values, so just return 0 */ return 0;
} return 10*(c - mse);
}
staticint or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength)
{ /* Calculate Strength from SNR up to 35dB */ /* Even though the SNR can go higher than 35dB, there is some comfort */ /* factor in having a range of strong signals that can show at 100% */ struct or51211_state* state = (struct or51211_state*)fe->demodulator_priv;
u16 snr; int ret;
ret = fe->ops.read_snr(fe, &snr); if (ret != 0) return ret; /* Rather than use the 8.8 value snr, use state->snr which is 8.24 */ /* scale the range 0 - 35*2^24 into 0 - 65535 */ if (state->snr >= 8960 * 0x10000)
*strength = 0xffff; else
*strength = state->snr / 8960;
if (!state->initialized) { /* Request the firmware, this will block until it uploads */
pr_info("Waiting for firmware upload (%s)...\n",
OR51211_DEFAULT_FIRMWARE);
ret = config->request_firmware(fe, &fw,
OR51211_DEFAULT_FIRMWARE);
pr_info("Got Hotplug firmware\n"); if (ret) {
pr_warn("No firmware uploaded (timeout or file not found?)\n"); return ret;
}
ret = or51211_load_firmware(fe, fw);
release_firmware(fw); if (ret) {
pr_warn("Writing firmware to device failed!\n"); return ret;
}
pr_info("Firmware upload complete.\n");
/* Set operation mode in Receiver 1 register; * type 1: * data 0x50h Automatic sets receiver channel conditions * Automatic NTSC rejection filter * Enable MPEG serial data output * MPEG2tr * High tuner phase noise * normal +/-150kHz Carrier acquisition range
*/ if (i2c_writebytes(state,state->config->demod_address,
cmd_buf,3)) {
pr_warn("Load DVR Error 5\n"); return -1;
}
/* Read back ucode version to besure we loaded correctly */ /* and are really up and running */
rec_buf[0] = 0x04;
rec_buf[1] = 0x00;
rec_buf[2] = 0x03;
rec_buf[3] = 0x00;
msleep(30); if (i2c_writebytes(state,state->config->demod_address,
rec_buf,3)) {
pr_warn("Load DVR Error A\n"); return -1;
}
msleep(3); if (i2c_readbytes(state,state->config->demod_address,
&rec_buf[10],2)) {
pr_warn("Load DVR Error B\n"); return -1;
}
for (i = 0; i < 5; i++) {
msleep(30);
get_ver_buf[4] = i+1; if (i2c_writebytes(state,state->config->demod_address,
get_ver_buf,5)) {
pr_warn("Load DVR Error 6 - %d\n", i); return -1;
}
msleep(3);
if (i2c_readbytes(state,state->config->demod_address,
&rec_buf[i*2],2)) {
pr_warn("Load DVR Error 7 - %d\n", i); return -1;
} /* If we didn't receive the right index, try again */ if ((int)rec_buf[i*2+1]!=i+1){
i--;
}
}
dprintk("read_fwbits %10ph\n", rec_buf);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.