/*1* dvb_ca.h: generic DVB functions for EN50221 CA interfaces2*3* Copyright (C) 2004 Andrew de Quincey4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public License7* as published by the Free Software Foundation; either version 2.18* of the License, or (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*/1516#ifndef _DVB_CA_EN50221_H_17#define _DVB_CA_EN50221_H_1819#include <linux/list.h>20#include <linux/dvb/ca.h>2122#include <media/dvbdev.h>2324#define DVB_CA_EN50221_POLL_CAM_PRESENT 125#define DVB_CA_EN50221_POLL_CAM_CHANGED 226#define DVB_CA_EN50221_POLL_CAM_READY 42728#define DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE 129#define DVB_CA_EN50221_FLAG_IRQ_FR 230#define DVB_CA_EN50221_FLAG_IRQ_DA 43132#define DVB_CA_EN50221_CAMCHANGE_REMOVED 033#define DVB_CA_EN50221_CAMCHANGE_INSERTED 13435/**36* struct dvb_ca_en50221- Structure describing a CA interface37*38* @owner: the module owning this structure39* @read_attribute_mem: function for reading attribute memory on the CAM40* @write_attribute_mem: function for writing attribute memory on the CAM41* @read_cam_control: function for reading the control interface on the CAM42* @write_cam_control: function for reading the control interface on the CAM43* @read_data: function for reading data (block mode)44* @write_data: function for writing data (block mode)45* @slot_reset: function to reset the CAM slot46* @slot_shutdown: function to shutdown a CAM slot47* @slot_ts_enable: function to enable the Transport Stream on a CAM slot48* @poll_slot_status: function to poll slot status. Only necessary if49* DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set.50* @data: private data, used by caller.51* @private: Opaque data used by the dvb_ca core. Do not modify!52*53* NOTE: the read_*, write_* and poll_slot_status functions will be54* called for different slots concurrently and need to use locks where55* and if appropriate. There will be no concurrent access to one slot.56*/57struct dvb_ca_en50221 {58struct module *owner;5960int (*read_attribute_mem)(struct dvb_ca_en50221 *ca,61int slot, int address);62int (*write_attribute_mem)(struct dvb_ca_en50221 *ca,63int slot, int address, u8 value);6465int (*read_cam_control)(struct dvb_ca_en50221 *ca,66int slot, u8 address);67int (*write_cam_control)(struct dvb_ca_en50221 *ca,68int slot, u8 address, u8 value);6970int (*read_data)(struct dvb_ca_en50221 *ca,71int slot, u8 *ebuf, int ecount);72int (*write_data)(struct dvb_ca_en50221 *ca,73int slot, u8 *ebuf, int ecount);7475int (*slot_reset)(struct dvb_ca_en50221 *ca, int slot);76int (*slot_shutdown)(struct dvb_ca_en50221 *ca, int slot);77int (*slot_ts_enable)(struct dvb_ca_en50221 *ca, int slot);7879int (*poll_slot_status)(struct dvb_ca_en50221 *ca, int slot, int open);8081void *data;8283void *private;84};8586/*87* Functions for reporting IRQ events88*/8990/**91* dvb_ca_en50221_camchange_irq - A CAMCHANGE IRQ has occurred.92*93* @pubca: CA instance.94* @slot: Slot concerned.95* @change_type: One of the DVB_CA_CAMCHANGE_* values96*/97void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221 *pubca, int slot,98int change_type);99100/**101* dvb_ca_en50221_camready_irq - A CAMREADY IRQ has occurred.102*103* @pubca: CA instance.104* @slot: Slot concerned.105*/106void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221 *pubca, int slot);107108/**109* dvb_ca_en50221_frda_irq - An FR or a DA IRQ has occurred.110*111* @ca: CA instance.112* @slot: Slot concerned.113*/114void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *ca, int slot);115116/*117* Initialisation/shutdown functions118*/119120/**121* dvb_ca_en50221_init - Initialise a new DVB CA device.122*123* @dvb_adapter: DVB adapter to attach the new CA device to.124* @ca: The dvb_ca instance.125* @flags: Flags describing the CA device (DVB_CA_EN50221_FLAG_*).126* @slot_count: Number of slots supported.127*128* @return 0 on success, nonzero on failure129*/130int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,131struct dvb_ca_en50221 *ca, int flags,132int slot_count);133134/**135* dvb_ca_en50221_release - Release a DVB CA device.136*137* @ca: The associated dvb_ca instance.138*/139void dvb_ca_en50221_release(struct dvb_ca_en50221 *ca);140141#endif142143144