#include "smscoreapi.h"
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <asm/div64.h>
#include <media/dmxdev.h>
#include <media/dvbdev.h>
#include <media/dvb_demux.h>
#include <media/dvb_frontend.h>
#include "sms-cards.h"
#include "smsdvb.h"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static LIST_HEAD(g_smsdvb_clients);
static DEFINE_MUTEX(g_smsdvb_clientslock);
static u32 sms_to_guard_interval_table[] = …;
static u32 sms_to_code_rate_table[] = …;
static u32 sms_to_hierarchy_table[] = …;
static u32 sms_to_modulation_table[] = …;
static void sms_board_dvb3_event(struct smsdvb_client_t *client,
enum SMS_DVB3_EVENTS event) { … }
static void smsdvb_stats_not_ready(struct dvb_frontend *fe)
{ … }
static inline int sms_to_mode(u32 mode)
{ … }
static inline int sms_to_isdbt_mode(u32 mode)
{ … }
static inline int sms_to_isdbt_guard_interval(u32 interval)
{ … }
static inline int sms_to_status(u32 is_demod_locked, u32 is_rf_locked)
{ … }
static inline u32 sms_to_bw(u32 value)
{ … }
#define convert_from_table(value, table, defval) …
#define sms_to_guard_interval(value) …
#define sms_to_code_rate(value) …
#define sms_to_hierarchy(value) …
#define sms_to_modulation(value) …
static void smsdvb_update_tx_params(struct smsdvb_client_t *client,
struct sms_tx_stats *p)
{ … }
static void smsdvb_update_per_slices(struct smsdvb_client_t *client,
struct RECEPTION_STATISTICS_PER_SLICES_S *p)
{ … }
static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client,
struct sms_stats *p)
{
struct dvb_frontend *fe = &client->frontend;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
if (client->prt_dvb_stats)
client->prt_dvb_stats(client->debug_data, p);
client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked);
c->frequency = p->frequency;
client->fe_status = sms_to_status(p->is_demod_locked, 0);
c->bandwidth_hz = sms_to_bw(p->bandwidth);
c->transmission_mode = sms_to_mode(p->transmission_mode);
c->guard_interval = sms_to_guard_interval(p->guard_interval);
c->code_rate_HP = sms_to_code_rate(p->code_rate);
c->code_rate_LP = sms_to_code_rate(p->lp_code_rate);
c->hierarchy = sms_to_hierarchy(p->hierarchy);
c->modulation = sms_to_modulation(p->constellation);
c->lna = p->is_external_lna_on ? 1 : 0;
c->cnr.stat[0].svalue = p->SNR * 1000;
c->strength.stat[0].uvalue = p->in_band_pwr * 1000;
if (!p->is_demod_locked)
return;
client->last_per = c->block_error.stat[0].uvalue;
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
c->block_count.stat[0].scale = FE_SCALE_COUNTER;
c->block_error.stat[0].uvalue += p->error_ts_packets;
c->block_count.stat[0].uvalue += p->total_ts_packets;
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
c->post_bit_error.stat[0].uvalue += p->ber_error_count;
c->post_bit_count.stat[0].uvalue += p->ber_bit_count;
client->legacy_ber = p->ber;
};
static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client,
struct sms_isdbt_stats *p)
{ … }
static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client,
struct sms_isdbt_stats_ex *p)
{ … }
static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
{ … }
static void smsdvb_media_device_unregister(struct smsdvb_client_t *client)
{ … }
static void smsdvb_unregister_client(struct smsdvb_client_t *client)
{ … }
static void smsdvb_onremove(void *context)
{ … }
static int smsdvb_start_feed(struct dvb_demux_feed *feed)
{ … }
static int smsdvb_stop_feed(struct dvb_demux_feed *feed)
{ … }
static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client,
void *buffer, size_t size,
struct completion *completion)
{ … }
static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
{ … }
static inline int led_feedback(struct smsdvb_client_t *client)
{ … }
static int smsdvb_read_status(struct dvb_frontend *fe, enum fe_status *stat)
{ … }
static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber)
{ … }
static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{ … }
static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr)
{ … }
static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{ … }
static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *tune)
{ … }
static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe)
{ … }
static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
{ … }
static int smsdvb_set_frontend(struct dvb_frontend *fe)
{ … }
static int smsdvb_init(struct dvb_frontend *fe)
{ … }
static int smsdvb_sleep(struct dvb_frontend *fe)
{ … }
static void smsdvb_release(struct dvb_frontend *fe)
{ … }
static const struct dvb_frontend_ops smsdvb_fe_ops = …;
static int smsdvb_hotplug(struct smscore_device_t *coredev,
struct device *device, int arrival)
{ … }
static int __init smsdvb_module_init(void)
{ … }
static void __exit smsdvb_module_exit(void)
{ … }
module_init(…) …;
module_exit(smsdvb_module_exit);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;