Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: refactoring



Andrew de Quincey wrote:

If you keep going on this line of thought, you end up with:

-----------
struct dvb_frontend_api {

struct dvb_frontend_info info;
struct dvb_adapter *dvb_adapter;
void* data;

int (*fe_init)(void* data);
int (*fe_sleep)(void* data);

int (*fe_get_tune_settings)(void* data, struct dvb_frontend_tune_settings* settings);

int (*fe_set_frontend)(void* data, struct dvb_frontend_parameters* params);
int (*fe_get_frontend)(void* data, struct dvb_frontend_parameters* params);

int (*fe_read_status)(void* data, fe_status_t* status);
int (*fe_read_ber)(void* data, __u32 ber);
int (*fe_read_signal_strength)(void* data, __u16 strength);
int (*fe_read_snr)(void* data, __u16 snr);
int (*fe_read_ucblocks)(void* data, __u32 ucblocks);

int (*fe_diseqc_reset_overload)(void* data);
int (*fe_diseqc_send_master_cmd)(void* data, struct dvb_diseqc_master_cmd* cmd);
int (*fe_diseqc_slave_reply)(void* data, struct dvb_diseqc_slave_reply* reply);
int (*fe_diseqc_send_burst)(void* data, fe_sec_mini_cmd_t minicmd);
int (*fe_set_tone)(void* data, fe_sec_tone_mode_t tone);
int (*fe_get_voltage)(void* data, fe_sec_voltage_t voltage);
int (*fe_enable_high_lnb_voltage)(void* data, int arg);
int (*fe_dishnetwork_send_legacy_command)(void* data, unsigned int cmd);

void (*fe_notifier_callback)(void* data, fe_status_t s);
};

extern int
dvb_register_frontend(struct dvb_frontend_api* api,
struct module *module);

extern int
dvb_unregister_frontend(struct dvb_frontend_api* api);

sounds good.

Frontends just define a template dvb_frontend_api with pointers to their functions. Card drivers simply memcpy this and adjust as necessary before attaching the frontend. This also means card drivers are free to adjust the dvb_frontend_info structure as necessary for their hardware - something which I've had to add special support in for otherwise.

What is fe_enable_high_lnb_voltage() BTW?
Some STBs, e.g. the dbox2 allow to add about 0.5V to the LNB voltage in order to compensate the loss of long cables.

Holger





Home | Main Index | Thread Index