dvb_ca_en50221.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * dvb_ca.h: generic DVB functions for EN50221 CA interfaces
  3. *
  4. * Copyright (C) 2004 Andrew de Quincey
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 2.1
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. */
  20. #ifndef _DVB_CA_EN50221_H_
  21. #define _DVB_CA_EN50221_H_
  22. #include <linux/list.h>
  23. #include <linux/dvb/ca.h>
  24. #include "dvbdev.h"
  25. #define DVB_CA_EN50221_POLL_CAM_PRESENT 1
  26. #define DVB_CA_EN50221_POLL_CAM_CHANGED 2
  27. #define DVB_CA_EN50221_POLL_CAM_READY 4
  28. #define DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE 1
  29. #define DVB_CA_EN50221_FLAG_IRQ_FR 2
  30. #define DVB_CA_EN50221_FLAG_IRQ_DA 4
  31. #define DVB_CA_EN50221_CAMCHANGE_REMOVED 0
  32. #define DVB_CA_EN50221_CAMCHANGE_INSERTED 1
  33. /* Structure describing a CA interface */
  34. struct dvb_ca_en50221 {
  35. /* the module owning this structure */
  36. struct module* owner;
  37. /* NOTE: the read_*, write_* and poll_slot_status functions will be
  38. * called for different slots concurrently and need to use locks where
  39. * and if appropriate. There will be no concurrent access to one slot.
  40. */
  41. /* functions for accessing attribute memory on the CAM */
  42. int (*read_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address);
  43. int (*write_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address, u8 value);
  44. /* functions for accessing the control interface on the CAM */
  45. int (*read_cam_control)(struct dvb_ca_en50221* ca, int slot, u8 address);
  46. int (*write_cam_control)(struct dvb_ca_en50221* ca, int slot, u8 address, u8 value);
  47. /* Functions for controlling slots */
  48. int (*slot_reset)(struct dvb_ca_en50221* ca, int slot);
  49. int (*slot_shutdown)(struct dvb_ca_en50221* ca, int slot);
  50. int (*slot_ts_enable)(struct dvb_ca_en50221* ca, int slot);
  51. /*
  52. * Poll slot status.
  53. * Only necessary if DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set
  54. */
  55. int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot, int open);
  56. /* private data, used by caller */
  57. void* data;
  58. /* Opaque data used by the dvb_ca core. Do not modify! */
  59. void* private;
  60. };
  61. /* ******************************************************************************** */
  62. /* Functions for reporting IRQ events */
  63. /**
  64. * A CAMCHANGE IRQ has occurred.
  65. *
  66. * @param ca CA instance.
  67. * @param slot Slot concerned.
  68. * @param change_type One of the DVB_CA_CAMCHANGE_* values
  69. */
  70. void dvb_ca_en50221_camchange_irq(struct dvb_ca_en50221* pubca, int slot, int change_type);
  71. /**
  72. * A CAMREADY IRQ has occurred.
  73. *
  74. * @param ca CA instance.
  75. * @param slot Slot concerned.
  76. */
  77. void dvb_ca_en50221_camready_irq(struct dvb_ca_en50221* pubca, int slot);
  78. /**
  79. * An FR or a DA IRQ has occurred.
  80. *
  81. * @param ca CA instance.
  82. * @param slot Slot concerned.
  83. */
  84. void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221* ca, int slot);
  85. /* ******************************************************************************** */
  86. /* Initialisation/shutdown functions */
  87. /**
  88. * Initialise a new DVB CA device.
  89. *
  90. * @param dvb_adapter DVB adapter to attach the new CA device to.
  91. * @param ca The dvb_ca instance.
  92. * @param flags Flags describing the CA device (DVB_CA_EN50221_FLAG_*).
  93. * @param slot_count Number of slots supported.
  94. *
  95. * @return 0 on success, nonzero on failure
  96. */
  97. extern int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, struct dvb_ca_en50221* ca, int flags, int slot_count);
  98. /**
  99. * Release a DVB CA device.
  100. *
  101. * @param ca The associated dvb_ca instance.
  102. */
  103. extern void dvb_ca_en50221_release(struct dvb_ca_en50221* ca);
  104. #endif