Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * dvb_ca.h: generic DVB functions for EN50221 CA interfaces
0003  *
0004  * Copyright (C) 2004 Andrew de Quincey
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public License
0008  * as published by the Free Software Foundation; either version 2.1
0009  * of the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  */
0016 
0017 #ifndef _DVB_CA_EN50221_H_
0018 #define _DVB_CA_EN50221_H_
0019 
0020 #include <linux/list.h>
0021 #include <linux/dvb/ca.h>
0022 
0023 #include <media/dvbdev.h>
0024 
0025 #define DVB_CA_EN50221_POLL_CAM_PRESENT 1
0026 #define DVB_CA_EN50221_POLL_CAM_CHANGED 2
0027 #define DVB_CA_EN50221_POLL_CAM_READY       4
0028 
0029 #define DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE   1
0030 #define DVB_CA_EN50221_FLAG_IRQ_FR      2
0031 #define DVB_CA_EN50221_FLAG_IRQ_DA      4
0032 
0033 #define DVB_CA_EN50221_CAMCHANGE_REMOVED        0
0034 #define DVB_CA_EN50221_CAMCHANGE_INSERTED       1
0035 
0036 /**
0037  * struct dvb_ca_en50221- Structure describing a CA interface
0038  *
0039  * @owner:      the module owning this structure
0040  * @read_attribute_mem: function for reading attribute memory on the CAM
0041  * @write_attribute_mem: function for writing attribute memory on the CAM
0042  * @read_cam_control:   function for reading the control interface on the CAM
0043  * @write_cam_control:  function for reading the control interface on the CAM
0044  * @read_data:      function for reading data (block mode)
0045  * @write_data:     function for writing data (block mode)
0046  * @slot_reset:     function to reset the CAM slot
0047  * @slot_shutdown:  function to shutdown a CAM slot
0048  * @slot_ts_enable: function to enable the Transport Stream on a CAM slot
0049  * @poll_slot_status:   function to poll slot status. Only necessary if
0050  *          DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set.
0051  * @data:       private data, used by caller.
0052  * @private:        Opaque data used by the dvb_ca core. Do not modify!
0053  *
0054  * NOTE: the read_*, write_* and poll_slot_status functions will be
0055  * called for different slots concurrently and need to use locks where
0056  * and if appropriate. There will be no concurrent access to one slot.
0057  */
0058 struct dvb_ca_en50221 {
0059     struct module *owner;
0060 
0061     int (*read_attribute_mem)(struct dvb_ca_en50221 *ca,
0062                   int slot, int address);
0063     int (*write_attribute_mem)(struct dvb_ca_en50221 *ca,
0064                    int slot, int address, u8 value);
0065 
0066     int (*read_cam_control)(struct dvb_ca_en50221 *ca,
0067                 int slot, u8 address);
0068     int (*write_cam_control)(struct dvb_ca_en50221 *ca,
0069                  int slot, u8 address, u8 value);
0070 
0071     int (*read_data)(struct dvb_ca_en50221 *ca,
0072              int slot, u8 *ebuf, int ecount);
0073     int (*write_data)(struct dvb_ca_en50221 *ca,
0074               int slot, u8 *ebuf, int ecount);
0075 
0076     int (*slot_reset)(struct dvb_ca_en50221 *ca, int slot);
0077     int (*slot_shutdown)(struct dvb_ca_en50221 *ca, int slot);
0078     int (*slot_ts_enable)(struct dvb_ca_en50221 *ca, int slot);
0079 
0080     int (*poll_slot_status)(struct dvb_ca_en50221 *ca, int slot, int open);
0081 
0082     void *data;
0083 
0084     void *private;
0085 };
0086 
0087 /*
0088  * Functions for reporting IRQ events
0089  */
0090 
0091 /**
0092  * dvb_ca_en50221_camchange_irq - A CAMCHANGE IRQ has occurred.
0093  *
0094  * @pubca: CA instance.
0095  * @slot: Slot concerned.
0096  * @change_type: One of the DVB_CA_CAMCHANGE_* values
0097  */
0098 void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221 *pubca, int slot,
0099                   int change_type);
0100 
0101 /**
0102  * dvb_ca_en50221_camready_irq - A CAMREADY IRQ has occurred.
0103  *
0104  * @pubca: CA instance.
0105  * @slot: Slot concerned.
0106  */
0107 void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221 *pubca, int slot);
0108 
0109 /**
0110  * dvb_ca_en50221_frda_irq - An FR or a DA IRQ has occurred.
0111  *
0112  * @ca: CA instance.
0113  * @slot: Slot concerned.
0114  */
0115 void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *ca, int slot);
0116 
0117 /*
0118  * Initialisation/shutdown functions
0119  */
0120 
0121 /**
0122  * dvb_ca_en50221_init - Initialise a new DVB CA device.
0123  *
0124  * @dvb_adapter: DVB adapter to attach the new CA device to.
0125  * @ca: The dvb_ca instance.
0126  * @flags: Flags describing the CA device (DVB_CA_EN50221_FLAG_*).
0127  * @slot_count: Number of slots supported.
0128  *
0129  * @return 0 on success, nonzero on failure
0130  */
0131 int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
0132             struct dvb_ca_en50221 *ca, int flags,
0133                    int slot_count);
0134 
0135 /**
0136  * dvb_ca_en50221_release - Release a DVB CA device.
0137  *
0138  * @ca: The associated dvb_ca instance.
0139  */
0140 void dvb_ca_en50221_release(struct dvb_ca_en50221 *ca);
0141 
0142 #endif