#ifndef __LINUX_DVB_CI_PHYS_H__
#define __LINUX_DVB_CI_PHYS_H__

#include <linux/dvb/ca.h>
#include "dvbdev.h"

typedef enum
{
    DVB_CI_BYPASS,      // ts go bypass ci
    DVB_CI_THROUGH      // ts go through ci
} dvb_ci_bypass;

typedef enum
{
    DVB_CI_P,           // ci card present
    DVB_CI_NP           // ci card not present
} dvb_ci_slot_state;

typedef enum
{
    DVB_CI_ATTR,        // attribute memory
    DVB_CI_IO           // io memory
} dvb_ci_space;

struct dvb_ci
{
    struct module * owner;

    int (*reset)(int slot);
    dvb_ci_slot_state (*detect)(int slot);
    int (*bypass)(int slot, dvb_ci_bypass bypass);
    int (*memory_switch)(int slot, dvb_ci_space space);

    u8 (*attr_read)(int slot, int offset);
    int (*attr_write)(int slot, int offset, u8 value);
    u8 (*io_read)(int slot, int offset);
    int (*io_write)(int slot, int offset, u8 value);
};

extern int dvb_ci_phys_init(struct dvb_adapter * adapter,
                            struct dvb_ci * ci,
                            int slot_count);

extern void dvb_ci_phys_release(void);

#endif // __LINUX_DVB_CI_PHYS_H__

