dst_common.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. Frontend-driver for TwinHan DST Frontend
  3. Copyright (C) 2003 Jamie Honan
  4. Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #ifndef DST_COMMON_H
  18. #define DST_COMMON_H
  19. #include <linux/dvb/frontend.h>
  20. #include <linux/device.h>
  21. #include <linux/mutex.h>
  22. #include "bt878.h"
  23. #include "dst_ca.h"
  24. #define NO_DELAY 0
  25. #define LONG_DELAY 1
  26. #define DEVICE_INIT 2
  27. #define DELAY 1
  28. #define DST_TYPE_IS_SAT 0
  29. #define DST_TYPE_IS_TERR 1
  30. #define DST_TYPE_IS_CABLE 2
  31. #define DST_TYPE_IS_ATSC 3
  32. #define DST_TYPE_HAS_TS188 1
  33. #define DST_TYPE_HAS_TS204 2
  34. #define DST_TYPE_HAS_SYMDIV 4
  35. #define DST_TYPE_HAS_FW_1 8
  36. #define DST_TYPE_HAS_FW_2 16
  37. #define DST_TYPE_HAS_FW_3 32
  38. #define DST_TYPE_HAS_FW_BUILD 64
  39. #define DST_TYPE_HAS_OBS_REGS 128
  40. #define DST_TYPE_HAS_INC_COUNT 256
  41. #define DST_TYPE_HAS_MULTI_FE 512
  42. #define DST_TYPE_HAS_NEWTUNE_2 1024
  43. #define DST_TYPE_HAS_DBOARD 2048
  44. #define DST_TYPE_HAS_VLF 4096
  45. /* Card capability list */
  46. #define DST_TYPE_HAS_MAC 1
  47. #define DST_TYPE_HAS_DISEQC3 2
  48. #define DST_TYPE_HAS_DISEQC4 4
  49. #define DST_TYPE_HAS_DISEQC5 8
  50. #define DST_TYPE_HAS_MOTO 16
  51. #define DST_TYPE_HAS_CA 32
  52. #define DST_TYPE_HAS_ANALOG 64 /* Analog inputs */
  53. #define DST_TYPE_HAS_SESSION 128
  54. #define TUNER_TYPE_MULTI 1
  55. #define TUNER_TYPE_UNKNOWN 2
  56. /* DVB-S */
  57. #define TUNER_TYPE_L64724 4
  58. #define TUNER_TYPE_STV0299 8
  59. #define TUNER_TYPE_MB86A15 16
  60. /* DVB-T */
  61. #define TUNER_TYPE_TDA10046 32
  62. /* ATSC */
  63. #define TUNER_TYPE_NXT200x 64
  64. #define RDC_8820_PIO_0_DISABLE 0
  65. #define RDC_8820_PIO_0_ENABLE 1
  66. #define RDC_8820_INT 2
  67. #define RDC_8820_RESET 4
  68. /* DST Communication */
  69. #define GET_REPLY 1
  70. #define NO_REPLY 0
  71. #define GET_ACK 1
  72. #define FIXED_COMM 8
  73. #define ACK 0xff
  74. struct dst_state {
  75. struct i2c_adapter* i2c;
  76. struct bt878* bt;
  77. /* configuration settings */
  78. const struct dst_config* config;
  79. struct dvb_frontend frontend;
  80. /* private ASIC data */
  81. u8 tx_tuna[10];
  82. u8 rx_tuna[10];
  83. u8 rxbuffer[10];
  84. u8 diseq_flags;
  85. u8 dst_type;
  86. u32 type_flags;
  87. u32 frequency; /* intermediate frequency in kHz for QPSK */
  88. fe_spectral_inversion_t inversion;
  89. u32 symbol_rate; /* symbol rate in Symbols per second */
  90. fe_code_rate_t fec;
  91. fe_sec_voltage_t voltage;
  92. fe_sec_tone_mode_t tone;
  93. u32 decode_freq;
  94. u8 decode_lock;
  95. u16 decode_strength;
  96. u16 decode_snr;
  97. unsigned long cur_jiff;
  98. u8 k22;
  99. fe_bandwidth_t bandwidth;
  100. u32 dst_hw_cap;
  101. u8 dst_fw_version;
  102. fe_sec_mini_cmd_t minicmd;
  103. fe_modulation_t modulation;
  104. u8 messages[256];
  105. u8 mac_address[8];
  106. u8 fw_version[8];
  107. u8 card_info[8];
  108. u8 vendor[8];
  109. u8 board_info[8];
  110. u32 tuner_type;
  111. char *tuner_name;
  112. struct mutex dst_mutex;
  113. u8 fw_name[8];
  114. struct dvb_device *dst_ca;
  115. };
  116. struct tuner_types {
  117. u32 tuner_type;
  118. char *tuner_name;
  119. char *board_name;
  120. char *fw_name;
  121. };
  122. struct dst_types {
  123. char *device_id;
  124. int offset;
  125. u8 dst_type;
  126. u32 type_flags;
  127. u32 dst_feature;
  128. u32 tuner_type;
  129. };
  130. struct dst_config
  131. {
  132. /* the ASIC i2c address */
  133. u8 demod_address;
  134. };
  135. int rdc_reset_state(struct dst_state *state);
  136. int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode);
  137. int dst_pio_disable(struct dst_state *state);
  138. int dst_error_recovery(struct dst_state* state);
  139. int dst_error_bailout(struct dst_state *state);
  140. int dst_comm_init(struct dst_state* state);
  141. int write_dst(struct dst_state *state, u8 * data, u8 len);
  142. int read_dst(struct dst_state *state, u8 * ret, u8 len);
  143. u8 dst_check_sum(u8 * buf, u32 len);
  144. struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter);
  145. struct dvb_device *dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter);
  146. #endif // DST_COMMON_H