2 Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of Trident Microsystems nor Hauppauge Computer Works
14 nor the names of its contributors may be used to endorse or promote
15 products derived from this software without specific prior written
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 POSSIBILITY OF SUCH DAMAGE.
32 * \file $Id: bsp_tuner.h,v 1.5 2009/10/19 22:15:13 dingtao Exp $
34 * \brief Tuner dependable type definitions, macro's and functions
38 #ifndef __DRXBSP_TUNER_H__
39 #define __DRXBSP_TUNER_H__
40 /*------------------------------------------------------------------------------
42 ------------------------------------------------------------------------------*/
43 #include "bsp_types.h"
50 /*------------------------------------------------------------------------------
52 ------------------------------------------------------------------------------*/
54 /* Sub-mode bits should be adjacent and incremental */
55 #define TUNER_MODE_SUB0 0x0001 /* for sub-mode (e.g. RF-AGC setting) */
56 #define TUNER_MODE_SUB1 0x0002 /* for sub-mode (e.g. RF-AGC setting) */
57 #define TUNER_MODE_SUB2 0x0004 /* for sub-mode (e.g. RF-AGC setting) */
58 #define TUNER_MODE_SUB3 0x0008 /* for sub-mode (e.g. RF-AGC setting) */
59 #define TUNER_MODE_SUB4 0x0010 /* for sub-mode (e.g. RF-AGC setting) */
60 #define TUNER_MODE_SUB5 0x0020 /* for sub-mode (e.g. RF-AGC setting) */
61 #define TUNER_MODE_SUB6 0x0040 /* for sub-mode (e.g. RF-AGC setting) */
62 #define TUNER_MODE_SUB7 0x0080 /* for sub-mode (e.g. RF-AGC setting) */
64 #define TUNER_MODE_DIGITAL 0x0100 /* for digital channel (e.g. DVB-T) */
65 #define TUNER_MODE_ANALOG 0x0200 /* for analog channel (e.g. PAL) */
66 #define TUNER_MODE_SWITCH 0x0400 /* during channel switch & scanning */
67 #define TUNER_MODE_LOCK 0x0800 /* after tuner has locked */
68 #define TUNER_MODE_6MHZ 0x1000 /* for 6MHz bandwidth channels */
69 #define TUNER_MODE_7MHZ 0x2000 /* for 7MHz bandwidth channels */
70 #define TUNER_MODE_8MHZ 0x4000 /* for 8MHz bandwidth channels */
72 #define TUNER_MODE_SUB_MAX 8
73 #define TUNER_MODE_SUBALL (TUNER_MODE_SUB0 | TUNER_MODE_SUB1 | \
74 TUNER_MODE_SUB2 | TUNER_MODE_SUB3 | \
75 TUNER_MODE_SUB4 | TUNER_MODE_SUB5 | \
76 TUNER_MODE_SUB6 | TUNER_MODE_SUB7)
78 /*------------------------------------------------------------------------------
80 ------------------------------------------------------------------------------*/
82 typedef u32 TUNERMode_t
;
83 typedef u32
*pTUNERMode_t
;
85 typedef char *TUNERSubMode_t
; /* description of submode */
86 typedef TUNERSubMode_t
*pTUNERSubMode_t
;
92 } TUNERLockStatus_t
, *pTUNERLockStatus_t
;
96 char *name
; /* Tuner brand & type name */
97 s32 minFreqRF
; /* Lowest RF input frequency, in kHz */
98 s32 maxFreqRF
; /* Highest RF input frequency, in kHz */
100 u8 subMode
; /* Index to sub-mode in use */
101 pTUNERSubMode_t subModeDescriptions
; /* Pointer to description of sub-modes */
102 u8 subModes
; /* Number of available sub-modes */
104 /* The following fields will be either 0, NULL or false and do not need
106 void *selfCheck
; /* gives proof of initialization */
107 bool programmed
; /* only valid if selfCheck is OK */
108 s32 RFfrequency
; /* only valid if programmed */
109 s32 IFfrequency
; /* only valid if programmed */
111 void *myUserData
; /* pointer to associated demod instance */
112 u16 myCapabilities
; /* value for storing application flags */
114 } TUNERCommonAttr_t
, *pTUNERCommonAttr_t
;
117 * Generic functions for DRX devices.
119 typedef struct TUNERInstance_s
*pTUNERInstance_t
;
121 typedef DRXStatus_t(*TUNEROpenFunc_t
) (pTUNERInstance_t tuner
);
122 typedef DRXStatus_t(*TUNERCloseFunc_t
) (pTUNERInstance_t tuner
);
124 typedef DRXStatus_t(*TUNERSetFrequencyFunc_t
) (pTUNERInstance_t tuner
,
129 typedef DRXStatus_t(*TUNERGetFrequencyFunc_t
) (pTUNERInstance_t tuner
,
136 typedef DRXStatus_t(*TUNERLockStatusFunc_t
) (pTUNERInstance_t tuner
,
140 typedef DRXStatus_t(*TUNERi2cWriteReadFunc_t
) (pTUNERInstance_t tuner
,
141 struct i2c_device_addr
*
142 wDevAddr
, u16 wCount
,
144 struct i2c_device_addr
*
145 rDevAddr
, u16 rCount
,
149 TUNEROpenFunc_t openFunc
;
150 TUNERCloseFunc_t closeFunc
;
151 TUNERSetFrequencyFunc_t setFrequencyFunc
;
152 TUNERGetFrequencyFunc_t getFrequencyFunc
;
153 TUNERLockStatusFunc_t lockStatusFunc
;
154 TUNERi2cWriteReadFunc_t i2cWriteReadFunc
;
156 } TUNERFunc_t
, *pTUNERFunc_t
;
158 typedef struct TUNERInstance_s
{
160 struct i2c_device_addr myI2CDevAddr
;
161 pTUNERCommonAttr_t myCommonAttr
;
163 pTUNERFunc_t myFunct
;
167 /*------------------------------------------------------------------------------
169 ------------------------------------------------------------------------------*/
171 /*------------------------------------------------------------------------------
173 ------------------------------------------------------------------------------*/
175 /*------------------------------------------------------------------------------
177 ------------------------------------------------------------------------------*/
179 DRXStatus_t
DRXBSP_TUNER_Open(pTUNERInstance_t tuner
);
181 DRXStatus_t
DRXBSP_TUNER_Close(pTUNERInstance_t tuner
);
183 DRXStatus_t
DRXBSP_TUNER_SetFrequency(pTUNERInstance_t tuner
,
187 DRXStatus_t
DRXBSP_TUNER_GetFrequency(pTUNERInstance_t tuner
,
192 DRXStatus_t
DRXBSP_TUNER_LockStatus(pTUNERInstance_t tuner
,
193 pTUNERLockStatus_t lockStat
);
195 DRXStatus_t
DRXBSP_TUNER_DefaultI2CWriteRead(pTUNERInstance_t tuner
,
196 struct i2c_device_addr
*wDevAddr
,
199 struct i2c_device_addr
*rDevAddr
,
200 u16 rCount
, u8
*rData
);
202 /*------------------------------------------------------------------------------
204 ------------------------------------------------------------------------------*/
208 #endif /* __DRXBSP_TUNER_H__ */