# Digital TV Conditional Access kABI

_Peios Kernel / Hardware and drivers / Driver development / Media devices_

> Reference for Digital TV Conditional Access kABI.

<a id="rst-digital-tv-conditional-access-kabi"></a>

<!-- SPDX-License-Identifier: GPL-2.0 -->


#### <a id="c-struct-dvb_ca_en50221"></a>`struct dvb_ca_en50221`

Structure describing a CA interface

**Definition**

```c
struct dvb_ca_en50221 {
    struct module *owner;
    int (*read_attribute_mem)(struct dvb_ca_en50221 *ca, int slot, int address);
    int (*write_attribute_mem)(struct dvb_ca_en50221 *ca, int slot, int address, u8 value);
    int (*read_cam_control)(struct dvb_ca_en50221 *ca, int slot, u8 address);
    int (*write_cam_control)(struct dvb_ca_en50221 *ca, int slot, u8 address, u8 value);
    int (*read_data)(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount);
    int (*write_data)(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount);
    int (*slot_reset)(struct dvb_ca_en50221 *ca, int slot);
    int (*slot_shutdown)(struct dvb_ca_en50221 *ca, int slot);
    int (*slot_ts_enable)(struct dvb_ca_en50221 *ca, int slot);
    int (*poll_slot_status)(struct dvb_ca_en50221 *ca, int slot, int open);
    void *data;
    void *private;
};
```

**Members**

- `owner`: the module owning this structure
- `read_attribute_mem`: function for reading attribute memory on the CAM
- `write_attribute_mem`: function for writing attribute memory on the CAM
- `read_cam_control`: function for reading the control interface on the CAM
- `write_cam_control`: function for reading the control interface on the CAM
- `read_data`: function for reading data (block mode)
- `write_data`: function for writing data (block mode)
- `slot_reset`: function to reset the CAM slot
- `slot_shutdown`: function to shutdown a CAM slot
- `slot_ts_enable`: function to enable the Transport Stream on a CAM slot
- `poll_slot_status`: function to poll slot status. Only necessary if
  DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set.
- `data`: private data, used by caller.
- `private`: Opaque data used by the dvb_ca core. Do not modify!

**NOTE**

the read_*, write_* and poll_slot_status functions will be
called for different slots concurrently and need to use locks where
and if appropriate. There will be no concurrent access to one slot.

#### <a id="c-dvb_ca_en50221_camchange_irq"></a>`dvb_ca_en50221_camchange_irq()`

```c
void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221 *pubca, int slot, int change_type)
```

A CAMCHANGE IRQ has occurred.

**Parameters**

- `struct dvb_ca_en50221 *pubca`: CA instance.
- `int slot`: Slot concerned.
- `int change_type`: One of the DVB_CA_CAMCHANGE_* values

#### <a id="c-dvb_ca_en50221_camready_irq"></a>`dvb_ca_en50221_camready_irq()`

```c
void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221 *pubca, int slot)
```

A CAMREADY IRQ has occurred.

**Parameters**

- `struct dvb_ca_en50221 *pubca`: CA instance.
- `int slot`: Slot concerned.

#### <a id="c-dvb_ca_en50221_frda_irq"></a>`dvb_ca_en50221_frda_irq()`

```c
void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *ca, int slot)
```

An FR or a DA IRQ has occurred.

**Parameters**

- `struct dvb_ca_en50221 *ca`: CA instance.
- `int slot`: Slot concerned.

#### <a id="c-dvb_ca_en50221_init"></a>`dvb_ca_en50221_init()`

```c
int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, struct dvb_ca_en50221 *ca, int flags, int slot_count)
```

Initialise a new DVB CA device.

**Parameters**

- `struct dvb_adapter *dvb_adapter`: DVB adapter to attach the new CA device to.
- `struct dvb_ca_en50221 *ca`: The dvb_ca instance.
- `int flags`: Flags describing the CA device (DVB_CA_EN50221_FLAG_*).
- `int slot_count`: Number of slots supported.

**Description**

**return** 0 on success, nonzero on failure

#### <a id="c-dvb_ca_en50221_release"></a>`dvb_ca_en50221_release()`

```c
void dvb_ca_en50221_release(struct dvb_ca_en50221 *ca)
```

Release a DVB CA device.

**Parameters**

- `struct dvb_ca_en50221 *ca`: The associated dvb_ca instance.
