drxj.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /*
  2. Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc.
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright notice,
  9. this list of conditions and the following disclaimer in the documentation
  10. and/or other materials provided with the distribution.
  11. * Neither the name of Trident Microsystems nor Hauppauge Computer Works
  12. nor the names of its contributors may be used to endorse or promote
  13. products derived from this software without specific prior written
  14. permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  19. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. DRXJ specific header file
  27. Authors: Dragan Savic, Milos Nikolic, Mihajlo Katona, Tao Ding, Paul Janssen
  28. */
  29. #ifndef __DRXJ_H__
  30. #define __DRXJ_H__
  31. /*-------------------------------------------------------------------------
  32. INCLUDES
  33. -------------------------------------------------------------------------*/
  34. #include "drx_driver.h"
  35. #include "drx_dap_fasi.h"
  36. /* Check DRX-J specific dap condition */
  37. /* Multi master mode and short addr format only will not work.
  38. RMW, CRC reset, broadcast and switching back to single master mode
  39. cannot be done with short addr only in multi master mode. */
  40. #if ((DRXDAP_SINGLE_MASTER == 0) && (DRXDAPFASI_LONG_ADDR_ALLOWED == 0))
  41. #error "Multi master mode and short addressing only is an illegal combination"
  42. *; /* Generate a fatal compiler error to make sure it stops here,
  43. this is necesarry because not all compilers stop after a #error. */
  44. #endif
  45. /*-------------------------------------------------------------------------
  46. TYPEDEFS
  47. -------------------------------------------------------------------------*/
  48. /*============================================================================*/
  49. /*============================================================================*/
  50. /*== code support ============================================================*/
  51. /*============================================================================*/
  52. /*============================================================================*/
  53. /*============================================================================*/
  54. /*============================================================================*/
  55. /*== SCU cmd if =============================================================*/
  56. /*============================================================================*/
  57. /*============================================================================*/
  58. struct drxjscu_cmd {
  59. u16 command;
  60. /**< Command number */
  61. u16 parameter_len;
  62. /**< Data length in byte */
  63. u16 result_len;
  64. /**< result length in byte */
  65. u16 *parameter;
  66. /**< General purpous param */
  67. u16 *result;
  68. /**< General purpous param */};
  69. /*============================================================================*/
  70. /*============================================================================*/
  71. /*== CTRL CFG related data structures ========================================*/
  72. /*============================================================================*/
  73. /*============================================================================*/
  74. /* extra intermediate lock state for VSB,QAM,NTSC */
  75. #define DRXJ_DEMOD_LOCK (DRX_LOCK_STATE_1)
  76. /* OOB lock states */
  77. #define DRXJ_OOB_AGC_LOCK (DRX_LOCK_STATE_1) /* analog gain control lock */
  78. #define DRXJ_OOB_SYNC_LOCK (DRX_LOCK_STATE_2) /* digital gain control lock */
  79. /* Intermediate powermodes for DRXJ */
  80. #define DRXJ_POWER_DOWN_MAIN_PATH DRX_POWER_MODE_8
  81. #define DRXJ_POWER_DOWN_CORE DRX_POWER_MODE_9
  82. #define DRXJ_POWER_DOWN_PLL DRX_POWER_MODE_10
  83. /* supstition for GPIO FNC mux */
  84. #define APP_O (0x0000)
  85. /*#define DRX_CTRL_BASE (0x0000)*/
  86. #define DRXJ_CTRL_CFG_BASE (0x1000)
  87. enum drxj_cfg_type {
  88. DRXJ_CFG_AGC_RF = DRXJ_CTRL_CFG_BASE,
  89. DRXJ_CFG_AGC_IF,
  90. DRXJ_CFG_AGC_INTERNAL,
  91. DRXJ_CFG_PRE_SAW,
  92. DRXJ_CFG_AFE_GAIN,
  93. DRXJ_CFG_SYMBOL_CLK_OFFSET,
  94. DRXJ_CFG_ACCUM_CR_RS_CW_ERR,
  95. DRXJ_CFG_FEC_MERS_SEQ_COUNT,
  96. DRXJ_CFG_OOB_MISC,
  97. DRXJ_CFG_SMART_ANT,
  98. DRXJ_CFG_OOB_PRE_SAW,
  99. DRXJ_CFG_VSB_MISC,
  100. DRXJ_CFG_RESET_PACKET_ERR,
  101. /* ATV (FM) */
  102. DRXJ_CFG_ATV_OUTPUT, /* also for FM (SIF control) but not likely */
  103. DRXJ_CFG_ATV_MISC,
  104. DRXJ_CFG_ATV_EQU_COEF,
  105. DRXJ_CFG_ATV_AGC_STATUS, /* also for FM ( IF,RF, audioAGC ) */
  106. DRXJ_CFG_MPEG_OUTPUT_MISC,
  107. DRXJ_CFG_HW_CFG,
  108. DRXJ_CFG_OOB_LO_POW,
  109. DRXJ_CFG_MAX /* dummy, never to be used */};
  110. /**
  111. * /struct enum drxj_cfg_smart_ant_io * smart antenna i/o.
  112. */
  113. enum drxj_cfg_smart_ant_io {
  114. DRXJ_SMT_ANT_OUTPUT = 0,
  115. DRXJ_SMT_ANT_INPUT
  116. };
  117. /**
  118. * /struct struct drxj_cfg_smart_ant * Set smart antenna.
  119. */
  120. struct drxj_cfg_smart_ant {
  121. enum drxj_cfg_smart_ant_io io;
  122. u16 ctrl_data;
  123. };
  124. /**
  125. * /struct DRXJAGCSTATUS_t
  126. * AGC status information from the DRXJ-IQM-AF.
  127. */
  128. struct drxj_agc_status {
  129. u16 IFAGC;
  130. u16 RFAGC;
  131. u16 digital_agc;
  132. };
  133. /* DRXJ_CFG_AGC_RF, DRXJ_CFG_AGC_IF */
  134. /**
  135. * /struct enum drxj_agc_ctrl_mode * Available AGCs modes in the DRXJ.
  136. */
  137. enum drxj_agc_ctrl_mode {
  138. DRX_AGC_CTRL_AUTO = 0,
  139. DRX_AGC_CTRL_USER,
  140. DRX_AGC_CTRL_OFF};
  141. /**
  142. * /struct struct drxj_cfg_agc * Generic interface for all AGCs present on the DRXJ.
  143. */
  144. struct drxj_cfg_agc {
  145. enum drx_standard standard; /* standard for which these settings apply */
  146. enum drxj_agc_ctrl_mode ctrl_mode; /* off, user, auto */
  147. u16 output_level; /* range dependent on AGC */
  148. u16 min_output_level; /* range dependent on AGC */
  149. u16 max_output_level; /* range dependent on AGC */
  150. u16 speed; /* range dependent on AGC */
  151. u16 top; /* rf-agc take over point */
  152. u16 cut_off_current; /* rf-agc is accelerated if output current
  153. is below cut-off current */};
  154. /* DRXJ_CFG_PRE_SAW */
  155. /**
  156. * /struct struct drxj_cfg_pre_saw * Interface to configure pre SAW sense.
  157. */
  158. struct drxj_cfg_pre_saw {
  159. enum drx_standard standard; /* standard to which these settings apply */
  160. u16 reference; /* pre SAW reference value, range 0 .. 31 */
  161. bool use_pre_saw; /* true algorithms must use pre SAW sense */};
  162. /* DRXJ_CFG_AFE_GAIN */
  163. /**
  164. * /struct struct drxj_cfg_afe_gain * Interface to configure gain of AFE (LNA + PGA).
  165. */
  166. struct drxj_cfg_afe_gain {
  167. enum drx_standard standard; /* standard to which these settings apply */
  168. u16 gain; /* gain in 0.1 dB steps, DRXJ range 140 .. 335 */};
  169. /**
  170. * /struct drxjrs_errors
  171. * Available failure information in DRXJ_FEC_RS.
  172. *
  173. * Container for errors that are received in the most recently finished measurment period
  174. *
  175. */
  176. struct drxjrs_errors {
  177. u16 nr_bit_errors;
  178. /**< no of pre RS bit errors */
  179. u16 nr_symbol_errors;
  180. /**< no of pre RS symbol errors */
  181. u16 nr_packet_errors;
  182. /**< no of pre RS packet errors */
  183. u16 nr_failures;
  184. /**< no of post RS failures to decode */
  185. u16 nr_snc_par_fail_count;
  186. /**< no of post RS bit erros */
  187. };
  188. /**
  189. * /struct struct drxj_cfg_vsb_misc * symbol error rate
  190. */
  191. struct drxj_cfg_vsb_misc {
  192. u32 symb_error;
  193. /**< symbol error rate sps */};
  194. /**
  195. * /enum enum drxj_mpeg_output_clock_rate * Mpeg output clock rate.
  196. *
  197. */
  198. enum drxj_mpeg_start_width {
  199. DRXJ_MPEG_START_WIDTH_1CLKCYC,
  200. DRXJ_MPEG_START_WIDTH_8CLKCYC};
  201. /**
  202. * /enum enum drxj_mpeg_output_clock_rate * Mpeg output clock rate.
  203. *
  204. */
  205. enum drxj_mpeg_output_clock_rate {
  206. DRXJ_MPEGOUTPUT_CLOCK_RATE_AUTO,
  207. DRXJ_MPEGOUTPUT_CLOCK_RATE_75973K,
  208. DRXJ_MPEGOUTPUT_CLOCK_RATE_50625K,
  209. DRXJ_MPEGOUTPUT_CLOCK_RATE_37968K,
  210. DRXJ_MPEGOUTPUT_CLOCK_RATE_30375K,
  211. DRXJ_MPEGOUTPUT_CLOCK_RATE_25313K,
  212. DRXJ_MPEGOUTPUT_CLOCK_RATE_21696K};
  213. /**
  214. * /struct DRXJCfgMisc_t
  215. * Change TEI bit of MPEG output
  216. * reverse MPEG output bit order
  217. * set MPEG output clock rate
  218. */
  219. struct drxj_cfg_mpeg_output_misc {
  220. bool disable_tei_handling; /**< if true pass (not change) TEI bit */
  221. bool bit_reverse_mpeg_outout; /**< if true, parallel: msb on MD0; serial: lsb out first */
  222. enum drxj_mpeg_output_clock_rate mpeg_output_clock_rate;
  223. /**< set MPEG output clock rate that overwirtes the derived one from symbol rate */
  224. enum drxj_mpeg_start_width mpeg_start_width; /**< set MPEG output start width */};
  225. /**
  226. * /enum enum drxj_xtal_freq * Supported external crystal reference frequency.
  227. */
  228. enum drxj_xtal_freq {
  229. DRXJ_XTAL_FREQ_RSVD,
  230. DRXJ_XTAL_FREQ_27MHZ,
  231. DRXJ_XTAL_FREQ_20P25MHZ,
  232. DRXJ_XTAL_FREQ_4MHZ};
  233. /**
  234. * /enum enum drxj_xtal_freq * Supported external crystal reference frequency.
  235. */
  236. enum drxji2c_speed {
  237. DRXJ_I2C_SPEED_400KBPS,
  238. DRXJ_I2C_SPEED_100KBPS};
  239. /**
  240. * /struct struct drxj_cfg_hw_cfg * Get hw configuration, such as crystal reference frequency, I2C speed, etc...
  241. */
  242. struct drxj_cfg_hw_cfg {
  243. enum drxj_xtal_freq xtal_freq;
  244. /**< crystal reference frequency */
  245. enum drxji2c_speed i2c_speed;
  246. /**< 100 or 400 kbps */};
  247. /*
  248. * DRXJ_CFG_ATV_MISC
  249. */
  250. struct drxj_cfg_atv_misc {
  251. s16 peak_filter; /* -8 .. 15 */
  252. u16 noise_filter; /* 0 .. 15 */};
  253. /*
  254. * struct drxj_cfg_oob_misc */
  255. #define DRXJ_OOB_STATE_RESET 0x0
  256. #define DRXJ_OOB_STATE_AGN_HUNT 0x1
  257. #define DRXJ_OOB_STATE_DGN_HUNT 0x2
  258. #define DRXJ_OOB_STATE_AGC_HUNT 0x3
  259. #define DRXJ_OOB_STATE_FRQ_HUNT 0x4
  260. #define DRXJ_OOB_STATE_PHA_HUNT 0x8
  261. #define DRXJ_OOB_STATE_TIM_HUNT 0x10
  262. #define DRXJ_OOB_STATE_EQU_HUNT 0x20
  263. #define DRXJ_OOB_STATE_EQT_HUNT 0x30
  264. #define DRXJ_OOB_STATE_SYNC 0x40
  265. struct drxj_cfg_oob_misc {
  266. struct drxj_agc_status agc;
  267. bool eq_lock;
  268. bool sym_timing_lock;
  269. bool phase_lock;
  270. bool freq_lock;
  271. bool dig_gain_lock;
  272. bool ana_gain_lock;
  273. u8 state;
  274. };
  275. /*
  276. * Index of in array of coef
  277. */
  278. enum drxj_cfg_oob_lo_power {
  279. DRXJ_OOB_LO_POW_MINUS0DB = 0,
  280. DRXJ_OOB_LO_POW_MINUS5DB,
  281. DRXJ_OOB_LO_POW_MINUS10DB,
  282. DRXJ_OOB_LO_POW_MINUS15DB,
  283. DRXJ_OOB_LO_POW_MAX};
  284. /*
  285. * DRXJ_CFG_ATV_EQU_COEF
  286. */
  287. struct drxj_cfg_atv_equ_coef {
  288. s16 coef0; /* -256 .. 255 */
  289. s16 coef1; /* -256 .. 255 */
  290. s16 coef2; /* -256 .. 255 */
  291. s16 coef3; /* -256 .. 255 */};
  292. /*
  293. * Index of in array of coef
  294. */
  295. enum drxj_coef_array_index {
  296. DRXJ_COEF_IDX_MN = 0,
  297. DRXJ_COEF_IDX_FM,
  298. DRXJ_COEF_IDX_L,
  299. DRXJ_COEF_IDX_LP,
  300. DRXJ_COEF_IDX_BG,
  301. DRXJ_COEF_IDX_DK,
  302. DRXJ_COEF_IDX_I,
  303. DRXJ_COEF_IDX_MAX};
  304. /*
  305. * DRXJ_CFG_ATV_OUTPUT
  306. */
  307. /**
  308. * /enum DRXJAttenuation_t
  309. * Attenuation setting for SIF AGC.
  310. *
  311. */
  312. enum drxjsif_attenuation {
  313. DRXJ_SIF_ATTENUATION_0DB,
  314. DRXJ_SIF_ATTENUATION_3DB,
  315. DRXJ_SIF_ATTENUATION_6DB,
  316. DRXJ_SIF_ATTENUATION_9DB};
  317. /**
  318. * /struct struct drxj_cfg_atv_output * SIF attenuation setting.
  319. *
  320. */
  321. struct drxj_cfg_atv_output {
  322. bool enable_cvbs_output; /* true= enabled */
  323. bool enable_sif_output; /* true= enabled */
  324. enum drxjsif_attenuation sif_attenuation;
  325. };
  326. /*
  327. DRXJ_CFG_ATV_AGC_STATUS (get only)
  328. */
  329. /* TODO : AFE interface not yet finished, subject to change */
  330. struct drxj_cfg_atv_agc_status {
  331. u16 rf_agc_gain; /* 0 .. 877 uA */
  332. u16 if_agc_gain; /* 0 .. 877 uA */
  333. s16 video_agc_gain; /* -75 .. 1972 in 0.1 dB steps */
  334. s16 audio_agc_gain; /* -4 .. 1020 in 0.1 dB steps */
  335. u16 rf_agc_loop_gain; /* 0 .. 7 */
  336. u16 if_agc_loop_gain; /* 0 .. 7 */
  337. u16 video_agc_loop_gain; /* 0 .. 7 */};
  338. /*============================================================================*/
  339. /*============================================================================*/
  340. /*== CTRL related data structures ============================================*/
  341. /*============================================================================*/
  342. /*============================================================================*/
  343. /* NONE */
  344. /*============================================================================*/
  345. /*============================================================================*/
  346. /*========================================*/
  347. /**
  348. * /struct struct drxj_data * DRXJ specific attributes.
  349. *
  350. * Global data container for DRXJ specific data.
  351. *
  352. */
  353. struct drxj_data {
  354. /* device capabilties (determined during drx_open()) */
  355. bool has_lna; /**< true if LNA (aka PGA) present */
  356. bool has_oob; /**< true if OOB supported */
  357. bool has_ntsc; /**< true if NTSC supported */
  358. bool has_btsc; /**< true if BTSC supported */
  359. bool has_smatx; /**< true if mat_tx is available */
  360. bool has_smarx; /**< true if mat_rx is available */
  361. bool has_gpio; /**< true if GPIO is available */
  362. bool has_irqn; /**< true if IRQN is available */
  363. /* A1/A2/A... */
  364. u8 mfx; /**< metal fix */
  365. /* tuner settings */
  366. bool mirror_freq_spect_oob;/**< tuner inversion (true = tuner mirrors the signal */
  367. /* standard/channel settings */
  368. enum drx_standard standard; /**< current standard information */
  369. enum drx_modulation constellation;
  370. /**< current constellation */
  371. s32 frequency; /**< center signal frequency in KHz */
  372. enum drx_bandwidth curr_bandwidth;
  373. /**< current channel bandwidth */
  374. enum drx_mirror mirror; /**< current channel mirror */
  375. /* signal quality information */
  376. u32 fec_bits_desired; /**< BER accounting period */
  377. u16 fec_vd_plen; /**< no of trellis symbols: VD SER measurement period */
  378. u16 qam_vd_prescale; /**< Viterbi Measurement Prescale */
  379. u16 qam_vd_period; /**< Viterbi Measurement period */
  380. u16 fec_rs_plen; /**< defines RS BER measurement period */
  381. u16 fec_rs_prescale; /**< ReedSolomon Measurement Prescale */
  382. u16 fec_rs_period; /**< ReedSolomon Measurement period */
  383. bool reset_pkt_err_acc; /**< Set a flag to reset accumulated packet error */
  384. u16 pkt_err_acc_start; /**< Set a flag to reset accumulated packet error */
  385. /* HI configuration */
  386. u16 hi_cfg_timing_div; /**< HI Configure() parameter 2 */
  387. u16 hi_cfg_bridge_delay; /**< HI Configure() parameter 3 */
  388. u16 hi_cfg_wake_up_key; /**< HI Configure() parameter 4 */
  389. u16 hi_cfg_ctrl; /**< HI Configure() parameter 5 */
  390. u16 hi_cfg_transmit; /**< HI Configure() parameter 6 */
  391. /* UIO configuartion */
  392. enum drxuio_mode uio_sma_rx_mode;/**< current mode of SmaRx pin */
  393. enum drxuio_mode uio_sma_tx_mode;/**< current mode of SmaTx pin */
  394. enum drxuio_mode uio_gpio_mode; /**< current mode of ASEL pin */
  395. enum drxuio_mode uio_irqn_mode; /**< current mode of IRQN pin */
  396. /* IQM fs frequecy shift and inversion */
  397. u32 iqm_fs_rate_ofs; /**< frequency shifter setting after setchannel */
  398. bool pos_image; /**< Ture: positive image */
  399. /* IQM RC frequecy shift */
  400. u32 iqm_rc_rate_ofs; /**< frequency shifter setting after setchannel */
  401. /* ATV configuartion */
  402. u32 atv_cfg_changed_flags; /**< flag: flags cfg changes */
  403. s16 atv_top_equ0[DRXJ_COEF_IDX_MAX]; /**< shadow of ATV_TOP_EQU0__A */
  404. s16 atv_top_equ1[DRXJ_COEF_IDX_MAX]; /**< shadow of ATV_TOP_EQU1__A */
  405. s16 atv_top_equ2[DRXJ_COEF_IDX_MAX]; /**< shadow of ATV_TOP_EQU2__A */
  406. s16 atv_top_equ3[DRXJ_COEF_IDX_MAX]; /**< shadow of ATV_TOP_EQU3__A */
  407. bool phase_correction_bypass;/**< flag: true=bypass */
  408. s16 atv_top_vid_peak; /**< shadow of ATV_TOP_VID_PEAK__A */
  409. u16 atv_top_noise_th; /**< shadow of ATV_TOP_NOISE_TH__A */
  410. bool enable_cvbs_output; /**< flag CVBS ouput enable */
  411. bool enable_sif_output; /**< flag SIF ouput enable */
  412. enum drxjsif_attenuation sif_attenuation;
  413. /**< current SIF att setting */
  414. /* Agc configuration for QAM and VSB */
  415. struct drxj_cfg_agc qam_rf_agc_cfg; /**< qam RF AGC config */
  416. struct drxj_cfg_agc qam_if_agc_cfg; /**< qam IF AGC config */
  417. struct drxj_cfg_agc vsb_rf_agc_cfg; /**< vsb RF AGC config */
  418. struct drxj_cfg_agc vsb_if_agc_cfg; /**< vsb IF AGC config */
  419. /* PGA gain configuration for QAM and VSB */
  420. u16 qam_pga_cfg; /**< qam PGA config */
  421. u16 vsb_pga_cfg; /**< vsb PGA config */
  422. /* Pre SAW configuration for QAM and VSB */
  423. struct drxj_cfg_pre_saw qam_pre_saw_cfg;
  424. /**< qam pre SAW config */
  425. struct drxj_cfg_pre_saw vsb_pre_saw_cfg;
  426. /**< qam pre SAW config */
  427. /* Version information */
  428. char v_text[2][12]; /**< allocated text versions */
  429. struct drx_version v_version[2]; /**< allocated versions structs */
  430. struct drx_version_list v_list_elements[2];
  431. /**< allocated version list */
  432. /* smart antenna configuration */
  433. bool smart_ant_inverted;
  434. /* Tracking filter setting for OOB */
  435. u16 oob_trk_filter_cfg[8];
  436. bool oob_power_on;
  437. /* MPEG static bitrate setting */
  438. u32 mpeg_ts_static_bitrate; /**< bitrate static MPEG output */
  439. bool disable_te_ihandling; /**< MPEG TS TEI handling */
  440. bool bit_reverse_mpeg_outout;/**< MPEG output bit order */
  441. enum drxj_mpeg_output_clock_rate mpeg_output_clock_rate;
  442. /**< MPEG output clock rate */
  443. enum drxj_mpeg_start_width mpeg_start_width;
  444. /**< MPEG Start width */
  445. /* Pre SAW & Agc configuration for ATV */
  446. struct drxj_cfg_pre_saw atv_pre_saw_cfg;
  447. /**< atv pre SAW config */
  448. struct drxj_cfg_agc atv_rf_agc_cfg; /**< atv RF AGC config */
  449. struct drxj_cfg_agc atv_if_agc_cfg; /**< atv IF AGC config */
  450. u16 atv_pga_cfg; /**< atv pga config */
  451. u32 curr_symbol_rate;
  452. /* pin-safe mode */
  453. bool pdr_safe_mode; /**< PDR safe mode activated */
  454. u16 pdr_safe_restore_val_gpio;
  455. u16 pdr_safe_restore_val_v_sync;
  456. u16 pdr_safe_restore_val_sma_rx;
  457. u16 pdr_safe_restore_val_sma_tx;
  458. /* OOB pre-saw value */
  459. u16 oob_pre_saw;
  460. enum drxj_cfg_oob_lo_power oob_lo_pow;
  461. struct drx_aud_data aud_data;
  462. /**< audio storage */};
  463. /*-------------------------------------------------------------------------
  464. Access MACROS
  465. -------------------------------------------------------------------------*/
  466. /**
  467. * \brief Compilable references to attributes
  468. * \param d pointer to demod instance
  469. *
  470. * Used as main reference to an attribute field.
  471. * Can be used by both macro implementation and function implementation.
  472. * These macros are defined to avoid duplication of code in macro and function
  473. * definitions that handle access of demod common or extended attributes.
  474. *
  475. */
  476. #define DRXJ_ATTR_BTSC_DETECT(d) \
  477. (((struct drxj_data *)(d)->my_ext_attr)->aud_data.btsc_detect)
  478. /*-------------------------------------------------------------------------
  479. DEFINES
  480. -------------------------------------------------------------------------*/
  481. /**
  482. * \def DRXJ_NTSC_CARRIER_FREQ_OFFSET
  483. * \brief Offset from picture carrier to centre frequency in kHz, in RF domain
  484. *
  485. * For NTSC standard.
  486. * NTSC channels are listed by their picture carrier frequency (Fpc).
  487. * The function DRX_CTRL_SET_CHANNEL requires the centre frequency as input.
  488. * In case the tuner module is not used the DRX-J requires that the tuner is
  489. * tuned to the centre frequency of the channel:
  490. *
  491. * Fcentre = Fpc + DRXJ_NTSC_CARRIER_FREQ_OFFSET
  492. *
  493. */
  494. #define DRXJ_NTSC_CARRIER_FREQ_OFFSET ((s32)(1750))
  495. /**
  496. * \def DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET
  497. * \brief Offset from picture carrier to centre frequency in kHz, in RF domain
  498. *
  499. * For PAL/SECAM - BG standard. This define is needed in case the tuner module
  500. * is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc).
  501. * The DRX-J requires that the tuner is tuned to:
  502. * Fpc + DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET
  503. *
  504. * In case the tuner module is used the drxdriver takes care of this.
  505. * In case the tuner module is NOT used the application programmer must take
  506. * care of this.
  507. *
  508. */
  509. #define DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET ((s32)(2375))
  510. /**
  511. * \def DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET
  512. * \brief Offset from picture carrier to centre frequency in kHz, in RF domain
  513. *
  514. * For PAL/SECAM - DK, I, L standards. This define is needed in case the tuner module
  515. * is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc).
  516. * The DRX-J requires that the tuner is tuned to:
  517. * Fpc + DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET
  518. *
  519. * In case the tuner module is used the drxdriver takes care of this.
  520. * In case the tuner module is NOT used the application programmer must take
  521. * care of this.
  522. *
  523. */
  524. #define DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET ((s32)(2775))
  525. /**
  526. * \def DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET
  527. * \brief Offset from picture carrier to centre frequency in kHz, in RF domain
  528. *
  529. * For PAL/SECAM - LP standard. This define is needed in case the tuner module
  530. * is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc).
  531. * The DRX-J requires that the tuner is tuned to:
  532. * Fpc + DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET
  533. *
  534. * In case the tuner module is used the drxdriver takes care of this.
  535. * In case the tuner module is NOT used the application programmer must take
  536. * care of this.
  537. */
  538. #define DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET ((s32)(-3255))
  539. /**
  540. * \def DRXJ_FM_CARRIER_FREQ_OFFSET
  541. * \brief Offset from sound carrier to centre frequency in kHz, in RF domain
  542. *
  543. * For FM standard.
  544. * FM channels are listed by their sound carrier frequency (Fsc).
  545. * The function DRX_CTRL_SET_CHANNEL requires the Ffm frequency (see below) as
  546. * input.
  547. * In case the tuner module is not used the DRX-J requires that the tuner is
  548. * tuned to the Ffm frequency of the channel.
  549. *
  550. * Ffm = Fsc + DRXJ_FM_CARRIER_FREQ_OFFSET
  551. *
  552. */
  553. #define DRXJ_FM_CARRIER_FREQ_OFFSET ((s32)(-3000))
  554. /* Revision types -------------------------------------------------------*/
  555. #define DRXJ_TYPE_ID (0x3946000DUL)
  556. /* Macros ---------------------------------------------------------------*/
  557. /* Convert OOB lock status to string */
  558. #define DRXJ_STR_OOB_LOCKSTATUS(x) ( \
  559. (x == DRX_NEVER_LOCK) ? "Never" : \
  560. (x == DRX_NOT_LOCKED) ? "No" : \
  561. (x == DRX_LOCKED) ? "Locked" : \
  562. (x == DRX_LOCK_STATE_1) ? "AGC lock" : \
  563. (x == DRX_LOCK_STATE_2) ? "sync lock" : \
  564. "(Invalid)")
  565. #endif /* __DRXJ_H__ */