/* Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Trident Microsystems nor Hauppauge Computer Works nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* * This structure contains the I2C address, the device ID and a user_data pointer. * The user_data pointer can be used for application specific purposes.
*/ struct i2c_device_addr {
u16 i2c_addr; /* The I2C address of the device. */
u16 i2c_dev_id; /* The device identifier. */ void *user_data; /* User data pointer */
};
/* * \def IS_I2C_10BIT( addr ) * \brief Determine if I2C address 'addr' is a 10 bits address or not. * \param addr The I2C address. * \return int. * \retval 0 if address is not a 10 bits I2C address. * \retval 1 if address is a 10 bits I2C address.
*/ #define IS_I2C_10BIT(addr) \
(((addr) & 0xF8) == 0xF0)
/* * \fn drxbsp_i2c_init() * \brief Initialize I2C communication module. * \return int Return status. * \retval 0 Initialization successful. * \retval -EIO Initialization failed.
*/ int drxbsp_i2c_init(void);
/* * \fn drxbsp_i2c_term() * \brief Terminate I2C communication module. * \return int Return status. * \retval 0 Termination successful. * \retval -EIO Termination failed.
*/ int drxbsp_i2c_term(void);
/* * \fn int drxbsp_i2c_write_read( struct i2c_device_addr *w_dev_addr, * u16 w_count, * u8 * wData, * struct i2c_device_addr *r_dev_addr, * u16 r_count, * u8 * r_data) * \brief Read and/or write count bytes from I2C bus, store them in data[]. * \param w_dev_addr The device i2c address and the device ID to write to * \param w_count The number of bytes to write * \param wData The array to write the data to * \param r_dev_addr The device i2c address and the device ID to read from * \param r_count The number of bytes to read * \param r_data The array to read the data from * \return int Return status. * \retval 0 Success. * \retval -EIO Failure. * \retval -EINVAL Parameter 'wcount' is not zero but parameter * 'wdata' contains NULL. * Idem for 'rcount' and 'rdata'. * Both w_dev_addr and r_dev_addr are NULL. * * This function must implement an atomic write and/or read action on the I2C bus * No other process may use the I2C bus when this function is executing. * The critical section of this function runs from and including the I2C * write, up to and including the I2C read action. * * The device ID can be useful if several devices share an I2C address. * It can be used to control a "switch" on the I2C bus to the correct device.
*/ int drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr,
u16 w_count,
u8 *wData, struct i2c_device_addr *r_dev_addr,
u16 r_count, u8 *r_data);
/* * \fn drxbsp_i2c_error_text() * \brief Returns a human readable error. * Counter part of numerical drx_i2c_error_g. * * \return char* Pointer to human readable error text.
*/ char *drxbsp_i2c_error_text(void);
struct tuner_common { char *name; /* Tuner brand & type name */
s32 min_freq_rf; /* Lowest RF input frequency, in kHz */
s32 max_freq_rf; /* Highest RF input frequency, in kHz */
u8 sub_mode; /* Index to sub-mode in use */ char ***sub_mode_descriptions; /* Pointer to description of sub-modes */
u8 sub_modes; /* Number of available sub-modes */
/* The following fields will be either 0, NULL or false and do not need
initialisation */ void *self_check; /* gives proof of initialization */ bool programmed; /* only valid if self_check is OK */
s32 r_ffrequency; /* only valid if programmed */
s32 i_ffrequency; /* only valid if programmed */
void *my_user_data; /* pointer to associated demod instance */
u16 my_capabilities; /* value for storing application flags */
};
/************* * * This section configures the DRX Data Access Protocols (DAPs). *
**************/
/* * \def DRXDAP_SINGLE_MASTER * \brief Enable I2C single or I2C multimaster mode on host. * * Set to 1 to enable single master mode * Set to 0 to enable multi master mode * * The actual DAP implementation may be restricted to only one of the modes. * A compiler warning or error will be generated if the DAP implementation * overrides or cannot handle the mode defined below.
*/ #ifndef DRXDAP_SINGLE_MASTER #define DRXDAP_SINGLE_MASTER 1 #endif
/* * \def DRXDAP_MAX_WCHUNKSIZE * \brief Defines maximum chunksize of an i2c write action by host. * * This indicates the maximum size of data the I2C device driver is able to * write at a time. This includes I2C device address and register addressing. * * This maximum size may be restricted by the actual DAP implementation. * A compiler warning or error will be generated if the DAP implementation * overrides or cannot handle the chunksize defined below. * * Beware that the DAP uses DRXDAP_MAX_WCHUNKSIZE to create a temporary data * buffer. Do not undefine or choose too large, unless your system is able to * handle a stack buffer of that size. *
*/ #ifndef DRXDAP_MAX_WCHUNKSIZE #define DRXDAP_MAX_WCHUNKSIZE 60 #endif
/* * \def DRXDAP_MAX_RCHUNKSIZE * \brief Defines maximum chunksize of an i2c read action by host. * * This indicates the maximum size of data the I2C device driver is able to read * at a time. Minimum value is 2. Also, the read chunk size must be even. * * This maximum size may be restricted by the actual DAP implementation. * A compiler warning or error will be generated if the DAP implementation * overrides or cannot handle the chunksize defined below.
*/ #ifndef DRXDAP_MAX_RCHUNKSIZE #define DRXDAP_MAX_RCHUNKSIZE 60 #endif
/************* * * This section describes drxdriver defines. *
**************/
/* * \def DRX_UNKNOWN * \brief Generic UNKNOWN value for DRX enumerated types. * * Used to indicate that the parameter value is unknown or not yet initialized.
*/ #ifndef DRX_UNKNOWN #define DRX_UNKNOWN (254) #endif
/* * \def DRX_AUTO * \brief Generic AUTO value for DRX enumerated types. * * Used to instruct the driver to automatically determine the value of the * parameter.
*/ #ifndef DRX_AUTO #define DRX_AUTO (255) #endif
/************* * * This section describes flag definitions for the device capbilities. *
**************/
/* * \brief LNA capability flag * * Device has a Low Noise Amplifier *
*/ #define DRX_CAPABILITY_HAS_LNA (1UL << 0) /* * \brief OOB-RX capability flag * * Device has OOB-RX *
*/ #define DRX_CAPABILITY_HAS_OOBRX (1UL << 1) /* * \brief ATV capability flag * * Device has ATV *
*/ #define DRX_CAPABILITY_HAS_ATV (1UL << 2) /* * \brief DVB-T capability flag * * Device has DVB-T *
*/ #define DRX_CAPABILITY_HAS_DVBT (1UL << 3) /* * \brief ITU-B capability flag * * Device has ITU-B *
*/ #define DRX_CAPABILITY_HAS_ITUB (1UL << 4) /* * \brief Audio capability flag * * Device has Audio *
*/ #define DRX_CAPABILITY_HAS_AUD (1UL << 5) /* * \brief SAW switch capability flag * * Device has SAW switch *
*/ #define DRX_CAPABILITY_HAS_SAWSW (1UL << 6) /* * \brief GPIO1 capability flag * * Device has GPIO1 *
*/ #define DRX_CAPABILITY_HAS_GPIO1 (1UL << 7) /* * \brief GPIO2 capability flag * * Device has GPIO2 *
*/ #define DRX_CAPABILITY_HAS_GPIO2 (1UL << 8) /* * \brief IRQN capability flag * * Device has IRQN *
*/ #define DRX_CAPABILITY_HAS_IRQN (1UL << 9) /* * \brief 8VSB capability flag * * Device has 8VSB *
*/ #define DRX_CAPABILITY_HAS_8VSB (1UL << 10) /* * \brief SMA-TX capability flag * * Device has SMATX *
*/ #define DRX_CAPABILITY_HAS_SMATX (1UL << 11) /* * \brief SMA-RX capability flag * * Device has SMARX *
*/ #define DRX_CAPABILITY_HAS_SMARX (1UL << 12) /* * \brief ITU-A/C capability flag * * Device has ITU-A/C *
*/ #define DRX_CAPABILITY_HAS_ITUAC (1UL << 13)
/*------------------------------------------------------------------------- MACROS
-------------------------------------------------------------------------*/ /* Macros to stringify the version number */ #define DRX_VERSIONSTRING(MAJOR, MINOR, PATCH) \
DRX_VERSIONSTRING_HELP(MAJOR)"." \
DRX_VERSIONSTRING_HELP(MINOR)"." \
DRX_VERSIONSTRING_HELP(PATCH) #define DRX_VERSIONSTRING_HELP(NUM) #NUM
/* * \brief Macro to create byte array elements from 16 bit integers. * This macro is used to create byte arrays for block writes. * Block writes speed up I2C traffic between host and demod. * The macro takes care of the required byte order in a 16 bits word. * x->lowbyte(x), highbyte(x)
*/ #define DRX_16TO8(x) ((u8) (((u16)x) & 0xFF)), \
((u8)((((u16)x)>>8)&0xFF))
/* * \brief Macro to convert 16 bit register value to a s32
*/ #define DRX_U16TODRXFREQ(x) ((x & 0x8000) ? \
((s32) \
(((u32) x) | 0xFFFF0000)) : \
((s32) x))
/* * \enum enum drx_pilot_mode * \brief Pilot modes in DTMB.
*/ enum drx_pilot_mode {
DRX_PILOT_ON = 0, /*< Pilot On */
DRX_PILOT_OFF, /*< Pilot Off */
DRX_PILOT_UNKNOWN = DRX_UNKNOWN, /*< Pilot unknown. */
DRX_PILOT_AUTO = DRX_AUTO /*< Autodetect Pilot */
};
/* * enum drxu_code_action - indicate if firmware has to be uploaded or verified. * @UCODE_UPLOAD: Upload the microcode image to device * @UCODE_VERIFY: Compare microcode image with code on device
*/ enum drxu_code_action {
UCODE_UPLOAD,
UCODE_VERIFY
};
/* * \enum enum drx_lock_status * \brief Used to reflect current lock status of demodulator. * * The generic lock states have device dependent semantics.
DRX_NEVER_LOCK = 0, **< Device will never lock on this signal * DRX_NOT_LOCKED, **< Device has no lock at all * DRX_LOCK_STATE_1, **< Generic lock state * DRX_LOCK_STATE_2, **< Generic lock state * DRX_LOCK_STATE_3, **< Generic lock state * DRX_LOCK_STATE_4, **< Generic lock state * DRX_LOCK_STATE_5, **< Generic lock state * DRX_LOCK_STATE_6, **< Generic lock state * DRX_LOCK_STATE_7, **< Generic lock state * DRX_LOCK_STATE_8, **< Generic lock state * DRX_LOCK_STATE_9, **< Generic lock state * DRX_LOCKED **< Device is in lock *
*/
/* * \enum enum drxuio_mode * \brief Used to configure the modus oprandi of a UIO. * * DRX_UIO_MODE_FIRMWARE is an old uio mode. * It is replaced by the modes DRX_UIO_MODE_FIRMWARE0 .. DRX_UIO_MODE_FIRMWARE9. * To be backward compatible DRX_UIO_MODE_FIRMWARE is equivalent to * DRX_UIO_MODE_FIRMWARE0.
*/ enum drxuio_mode {
DRX_UIO_MODE_DISABLE = 0x01, /*< not used, pin is configured as input */
DRX_UIO_MODE_READWRITE = 0x02, /*< used for read/write by application */
DRX_UIO_MODE_FIRMWARE = 0x04, /*< controlled by firmware, function 0 */
DRX_UIO_MODE_FIRMWARE0 = DRX_UIO_MODE_FIRMWARE, /*< same as above */
DRX_UIO_MODE_FIRMWARE1 = 0x08, /*< controlled by firmware, function 1 */
DRX_UIO_MODE_FIRMWARE2 = 0x10, /*< controlled by firmware, function 2 */
DRX_UIO_MODE_FIRMWARE3 = 0x20, /*< controlled by firmware, function 3 */
DRX_UIO_MODE_FIRMWARE4 = 0x40, /*< controlled by firmware, function 4 */
DRX_UIO_MODE_FIRMWARE5 = 0x80 /*< controlled by firmware, function 5 */
};
/* * \enum enum drxoob_downstream_standard * \brief Used to select OOB standard. * * Based on ANSI 55-1 and 55-2
*/ enum drxoob_downstream_standard {
DRX_OOB_MODE_A = 0, /*< ANSI 55-1 */
DRX_OOB_MODE_B_GRADE_A, /*< ANSI 55-2 A */
DRX_OOB_MODE_B_GRADE_B /*< ANSI 55-2 B */
};
#define DRX_CFG_PINS_SAFE_MODE DRX_CFG_PINSAFE /*============================================================================*/ /*============================================================================*/ /*== CTRL related data structures ============================================*/ /*============================================================================*/ /*============================================================================*/
/* * struct drxu_code_info Parameters for microcode upload and verfiy. * * @mc_file: microcode file name * * Used by DRX_CTRL_LOAD_UCODE and DRX_CTRL_VERIFY_UCODE
*/ struct drxu_code_info { char *mc_file;
};
/* * \struct drx_mc_version_rec_t * \brief Microcode version record * Version numbers are stored in BCD format, as usual: * o major number = bits 31-20 (first three nibbles of MSW) * o minor number = bits 19-16 (fourth nibble of MSW) * o patch number = bits 15-0 (remaining nibbles in LSW) * * The device type indicates for which the device is meant. It is based on the * JTAG ID, using everything except the bond ID and the metal fix. * * Special values: * - mc_dev_type == 0 => any device allowed * - mc_base_version == 0.0.0 => full microcode (mc_version is the version) * - mc_base_version != 0.0.0 => patch microcode, the base microcode version * (mc_version is the version)
*/ #define AUX_VER_RECORD 0x8000
struct drx_mc_version_rec {
u16 aux_type; /* type of aux data - 0x8000 for version record */
u32 mc_dev_type; /* device type, based on JTAG ID */
u32 mc_version; /* version of microcode */
u32 mc_base_version; /* in case of patch: the original microcode version */
};
/*========================================*/
/* * \struct drx_filter_info_t * \brief Parameters for loading filter coefficients * * Used by DRX_CTRL_LOAD_FILTER
*/ struct drx_filter_info {
u8 *data_re; /*< pointer to coefficients for RE */
u8 *data_im; /*< pointer to coefficients for IM */
u16 size_re; /*< size of coefficients for RE */
u16 size_im; /*< size of coefficients for IM */
};
/*========================================*/
/* * \struct struct drx_channel * \brief The set of parameters describing a single channel. * * Used by DRX_CTRL_SET_CHANNEL and DRX_CTRL_GET_CHANNEL. * Only certain fields need to be used for a specific standard. *
*/ struct drx_channel {
s32 frequency; /*< frequency in kHz */ enum drx_bandwidth bandwidth; /*< bandwidth */ enum drx_mirror mirror; /*< mirrored or not on RF */ enum drx_modulation constellation; /*< constellation */ enum drx_hierarchy hierarchy; /*< hierarchy */ enum drx_priority priority; /*< priority */ enum drx_coderate coderate; /*< coderate */ enum drx_guard guard; /*< guard interval */ enum drx_fft_mode fftmode; /*< fftmode */ enum drx_classification classification; /*< classification */
u32 symbolrate; /*< symbolrate in symbols/sec */ enum drx_interleave_mode interleavemode; /*< interleaveMode QAM */ enum drx_ldpc ldpc; /*< ldpc */ enum drx_carrier_mode carrier; /*< carrier */ enum drx_frame_mode framemode; /*< frame mode */ enum drx_pilot_mode pilot; /*< pilot mode */
};
/* * \struct struct drx_complex * A complex number. * * Used by DRX_CTRL_CONSTEL.
*/ struct drx_complex {
s16 im; /*< Imaginary part. */
s16 re; /*< Real part. */
};
/*========================================*/
/* * \struct struct drx_frequency_plan * Array element of a frequency plan. * * Used by DRX_CTRL_SCAN_INIT.
*/ struct drx_frequency_plan {
s32 first; /*< First centre frequency in this band */
s32 last; /*< Last centre frequency in this band */
s32 step; /*< Stepping frequency in this band */ enum drx_bandwidth bandwidth; /*< Bandwidth within this frequency band */
u16 ch_number; /*< First channel number in this band, or first
index in ch_names */ char **ch_names; /*< Optional list of channel names in this
band */
};
/*========================================*/
/* * \struct struct drx_scan_param * Parameters for channel scan. * * Used by DRX_CTRL_SCAN_INIT.
*/ struct drx_scan_param { struct drx_frequency_plan *frequency_plan; /*< Frequency plan (array)*/
u16 frequency_plan_size; /*< Number of bands */
u32 num_tries; /*< Max channels tried */
s32 skip; /*< Minimum frequency step to take
after a channel is found */ void *ext_params; /*< Standard specific params */
};
/* * \brief Power mode of device. * * Used by DRX_CTRL_SET_POWER_MODE.
*/ enum drx_power_mode {
DRX_POWER_UP = 0, /*< Generic , Power Up Mode */
DRX_POWER_MODE_1, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_2, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_3, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_4, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_5, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_6, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_7, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_8, /*< Device specific , Power Up Mode */
DRX_POWER_MODE_9, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_10, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_11, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_12, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_13, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_14, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_15, /*< Device specific , Power Down Mode */
DRX_POWER_MODE_16, /*< Device specific , Power Down Mode */
DRX_POWER_DOWN = 255 /*< Generic , Power Down Mode */
};
/* * \enum struct drx_version * \brief Version information of one software module. * * Used by DRX_CTRL_VERSION.
*/ struct drx_version { enum drx_module module_type; /*< Type identifier of the module */ char *module_name; /*< Name or description of module */
u16 v_major; /*< Major version number */
u16 v_minor; /*< Minor version number */
u16 v_patch; /*< Patch version number */ char *v_string; /*< Version as text string */
};
/* * \enum struct drx_version_list * \brief List element of NULL terminated, linked list for version information. * * Used by DRX_CTRL_VERSION.
*/ struct drx_version_list { struct drx_version *version;/*< Version information */ struct drx_version_list *next; /*< Next list element */
};
/*========================================*/
/* * \brief Parameters needed to confiugure a UIO. * * Used by DRX_CTRL_UIO_CFG.
*/ struct drxuio_cfg { enum drx_uio uio; /*< UIO identifier */ enum drxuio_mode mode; /*< UIO operational mode */
};
/*========================================*/
/* * \brief Parameters needed to read from or write to a UIO. * * Used by DRX_CTRL_UIO_READ and DRX_CTRL_UIO_WRITE.
*/ struct drxuio_data { enum drx_uio uio; /*< UIO identifier */ bool value; /*< UIO value (true=1, false=0) */
};
/*========================================*/
/* * \brief Parameters needed to configure OOB. * * Used by DRX_CTRL_SET_OOB.
*/ struct drxoob {
s32 frequency; /*< Frequency in kHz */ enum drxoob_downstream_standard standard; /*< OOB standard */ bool spectrum_inverted; /*< If true, then spectrum
is inverted */
};
/*========================================*/
/* * \brief Metrics from OOB. * * Used by DRX_CTRL_GET_OOB.
*/ struct drxoob_status {
s32 frequency; /*< Frequency in Khz */ enum drx_lock_status lock; /*< Lock status */
u32 mer; /*< MER */
s32 symbol_rate_offset; /*< Symbolrate offset in ppm */
};
/*========================================*/
/* * \brief Device dependent configuration data. * * Used by DRX_CTRL_SET_CFG and DRX_CTRL_GET_CFG. * A sort of nested drx_ctrl() functionality for device specific controls.
*/ struct drx_cfg {
u32 cfg_type; /*< Function identifier */ void *cfg_data; /*< Function data */
};
/*========================================*/
/* * /struct DRXMpegStartWidth_t * MStart width [nr MCLK cycles] for serial MPEG output.
*/
/* CTRL CFG MPEG output */ /* * \struct struct drx_cfg_mpeg_output * \brief Configuration parameters for MPEG output control. * * Used by DRX_CFG_MPEG_OUTPUT, in combination with DRX_CTRL_SET_CFG and * DRX_CTRL_GET_CFG.
*/
struct drx_cfg_mpeg_output { bool enable_mpeg_output;/*< If true, enable MPEG output */ bool insert_rs_byte; /*< If true, insert RS byte */ bool enable_parallel; /*< If true, parallel out otherwise
serial */ bool invert_data; /*< If true, invert DATA signals */ bool invert_err; /*< If true, invert ERR signal */ bool invert_str; /*< If true, invert STR signals */ bool invert_val; /*< If true, invert VAL signals */ bool invert_clk; /*< If true, invert CLK signals */ bool static_clk; /*< If true, static MPEG clockrate will be used, otherwise clockrate will adapt to the bitrate of the
TS */
u32 bitrate; /*< Maximum bitrate in b/s in case
static clockrate is selected */ enum drxmpeg_str_width width_str; /*< MPEG start width */
};
/*========================================*/
/* * \struct struct drxi2c_data * \brief Data for I2C via 2nd or 3rd or etc I2C port. * * Used by DRX_CTRL_I2C_READWRITE. * If port_nr is equal to primairy port_nr BSPI2C will be used. *
*/ struct drxi2c_data {
u16 port_nr; /*< I2C port number */ struct i2c_device_addr *w_dev_addr; /*< Write device address */
u16 w_count; /*< Size of write data in bytes */
u8 *wData; /*< Pointer to write data */ struct i2c_device_addr *r_dev_addr; /*< Read device address */
u16 r_count; /*< Size of data to read in bytes */
u8 *r_data; /*< Pointer to read buffer */
};
/*========================================*/
/* * \enum enum drx_aud_standard * \brief Audio standard identifier. * * Used by DRX_CTRL_SET_AUD.
*/ enum drx_aud_standard {
DRX_AUD_STANDARD_BTSC, /*< set BTSC standard (USA) */
DRX_AUD_STANDARD_A2, /*< set A2-Korea FM Stereo */
DRX_AUD_STANDARD_EIAJ, /*< set to Japanese FM Stereo */
DRX_AUD_STANDARD_FM_STEREO,/*< set to FM-Stereo Radio */
DRX_AUD_STANDARD_M_MONO, /*< for 4.5 MHz mono detected */
DRX_AUD_STANDARD_D_K_MONO, /*< for 6.5 MHz mono detected */
DRX_AUD_STANDARD_BG_FM, /*< set BG_FM standard */
DRX_AUD_STANDARD_D_K1, /*< set D_K1 standard */
DRX_AUD_STANDARD_D_K2, /*< set D_K2 standard */
DRX_AUD_STANDARD_D_K3, /*< set D_K3 standard */
DRX_AUD_STANDARD_BG_NICAM_FM, /*< set BG_NICAM_FM standard */
DRX_AUD_STANDARD_L_NICAM_AM, /*< set L_NICAM_AM standard */
DRX_AUD_STANDARD_I_NICAM_FM, /*< set I_NICAM_FM standard */
DRX_AUD_STANDARD_D_K_NICAM_FM, /*< set D_K_NICAM_FM standard */
DRX_AUD_STANDARD_NOT_READY,/*< used to detect audio standard */
DRX_AUD_STANDARD_AUTO = DRX_AUTO, /*< Automatic Standard Detection */
DRX_AUD_STANDARD_UNKNOWN = DRX_UNKNOWN /*< used as auto and for readback */
};
/* * \struct struct drx_aud_status * \brief Audio status characteristics.
*/ struct drx_aud_status { bool stereo; /*< stereo detection */ bool carrier_a; /*< carrier A detected */ bool carrier_b; /*< carrier B detected */ bool sap; /*< sap / bilingual detection */ bool rds; /*< RDS data array present */ enum drx_aud_nicam_status nicam_status; /*< status of NICAM carrier */
s8 fm_ident; /*< FM Identification value */
};
/* CTRL_AUD_READ_RDS - DRXRDSdata_t */
/* * \struct DRXRDSdata_t * \brief Raw RDS data array.
*/ struct drx_cfg_aud_rds { bool valid; /*< RDS data validation */
u16 data[18]; /*< data from one RDS data array */
};
/* DRX_CFG_AUD_VOLUME - struct drx_cfg_aud_volume - set/get */ /* * \enum DRXAudAVCDecayTime_t * \brief Automatic volume control configuration.
*/ enum drx_aud_avc_mode {
DRX_AUD_AVC_OFF, /*< Automatic volume control off */
DRX_AUD_AVC_DECAYTIME_8S, /*< level volume in 8 seconds */
DRX_AUD_AVC_DECAYTIME_4S, /*< level volume in 4 seconds */
DRX_AUD_AVC_DECAYTIME_2S, /*< level volume in 2 seconds */
DRX_AUD_AVC_DECAYTIME_20MS/*< level volume in 20 millisec */
};
/* * /enum DRXAudMaxAVCGain_t * /brief Automatic volume control max gain in audio baseband.
*/ enum drx_aud_avc_max_gain {
DRX_AUD_AVC_MAX_GAIN_0DB, /*< maximum AVC gain 0 dB */
DRX_AUD_AVC_MAX_GAIN_6DB, /*< maximum AVC gain 6 dB */
DRX_AUD_AVC_MAX_GAIN_12DB /*< maximum AVC gain 12 dB */
};
/* * /enum DRXAudMaxAVCAtten_t * /brief Automatic volume control max attenuation in audio baseband.
*/ enum drx_aud_avc_max_atten {
DRX_AUD_AVC_MAX_ATTEN_12DB, /*< maximum AVC attenuation 12 dB */
DRX_AUD_AVC_MAX_ATTEN_18DB, /*< maximum AVC attenuation 18 dB */
DRX_AUD_AVC_MAX_ATTEN_24DB/*< maximum AVC attenuation 24 dB */
}; /* * \struct struct drx_cfg_aud_volume * \brief Audio volume configuration.
*/ struct drx_cfg_aud_volume { bool mute; /*< mute overrides volume setting */
s16 volume; /*< volume, range -114 to 12 dB */ enum drx_aud_avc_mode avc_mode; /*< AVC auto volume control mode */
u16 avc_ref_level; /*< AVC reference level */ enum drx_aud_avc_max_gain avc_max_gain; /*< AVC max gain selection */ enum drx_aud_avc_max_atten avc_max_atten; /*< AVC max attenuation selection */
s16 strength_left; /*< quasi-peak, left speaker */
s16 strength_right; /*< quasi-peak, right speaker */
};
/* DRX_CFG_I2S_OUTPUT - struct drx_cfg_i2s_output - set/get */ /* * \enum enum drxi2s_mode * \brief I2S output mode.
*/ enum drxi2s_mode {
DRX_I2S_MODE_MASTER, /*< I2S is in master mode */
DRX_I2S_MODE_SLAVE /*< I2S is in slave mode */
};
/* * \enum enum drxi2s_word_length * \brief Width of I2S data.
*/ enum drxi2s_word_length {
DRX_I2S_WORDLENGTH_32 = 0,/*< I2S data is 32 bit wide */
DRX_I2S_WORDLENGTH_16 = 1 /*< I2S data is 16 bit wide */
};
/* * \enum enum drxi2s_format * \brief Data wordstrobe alignment for I2S.
*/ enum drxi2s_format {
DRX_I2S_FORMAT_WS_WITH_DATA, /*< I2S data and wordstrobe are aligned */
DRX_I2S_FORMAT_WS_ADVANCED /*< I2S data one cycle after wordstrobe */
};
/* * \enum enum drxi2s_polarity * \brief Polarity of I2S data.
*/ enum drxi2s_polarity {
DRX_I2S_POLARITY_RIGHT,/*< wordstrobe - right high, left low */
DRX_I2S_POLARITY_LEFT /*< wordstrobe - right low, left high */
};
/* * \enum DRXI2SVidSync_t * \brief Audio/video synchronization, interacts with I2S mode. * AUTO_1 and AUTO_2 are for automatic video standard detection with preference * for NTSC or Monochrome, because the frequencies are too close (59.94 & 60 Hz)
*/ enum drx_cfg_aud_av_sync {
DRX_AUD_AVSYNC_OFF,/*< audio/video synchronization is off */
DRX_AUD_AVSYNC_NTSC, /*< it is an NTSC system */
DRX_AUD_AVSYNC_MONOCHROME, /*< it is a MONOCHROME system */
DRX_AUD_AVSYNC_PAL_SECAM /*< it is a PAL/SECAM system */};
/*============================================================================*/ /*============================================================================*/ /*== Data access structures ==================================================*/ /*============================================================================*/ /*============================================================================*/
/* Address on device */ typedef u32 dr_xaddr_t, *pdr_xaddr_t;
/* Protocol specific flags */ typedef u32 dr_xflags_t, *pdr_xflags_t;
/* Write block of data to device */ typedefint(*drx_write_block_func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u16 datasize, /* size of data in bytes */
u8 *data, /* data to send */
u32 flags);
/* Read block of data from device */ typedefint(*drx_read_block_func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u16 datasize, /* size of data in bytes */
u8 *data, /* receive buffer */
u32 flags);
/* Write 8-bits value to device */ typedefint(*drx_write_reg8func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u8 data, /* data to send */
u32 flags);
/* Read 8-bits value to device */ typedefint(*drx_read_reg8func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u8 *data, /* receive buffer */
u32 flags);
/* Read modify write 8-bits value to device */ typedefint(*drx_read_modify_write_reg8func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 waddr, /* write address of register */
u32 raddr, /* read address of register */
u8 wdata, /* data to write */
u8 *rdata); /* data to read */
/* Write 16-bits value to device */ typedefint(*drx_write_reg16func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u16 data, /* data to send */
u32 flags);
/* Read 16-bits value to device */ typedefint(*drx_read_reg16func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u16 *data, /* receive buffer */
u32 flags);
/* Read modify write 16-bits value to device */ typedefint(*drx_read_modify_write_reg16func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 waddr, /* write address of register */
u32 raddr, /* read address of register */
u16 wdata, /* data to write */
u16 *rdata); /* data to read */
/* Write 32-bits value to device */ typedefint(*drx_write_reg32func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u32 data, /* data to send */
u32 flags);
/* Read 32-bits value to device */ typedefint(*drx_read_reg32func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 addr, /* address of register/memory */
u32 *data, /* receive buffer */
u32 flags);
/* Read modify write 32-bits value to device */ typedefint(*drx_read_modify_write_reg32func_t) (struct i2c_device_addr *dev_addr, /* address of I2C device */
u32 waddr, /* write address of register */
u32 raddr, /* read address of register */
u32 wdata, /* data to write */
u32 *rdata); /* data to read */
/* Register address and data for register dump function */ struct drx_reg_dump {
u32 address;
u32 data;
};
/*============================================================================*/ /*============================================================================*/ /*== Demod instance data structures ==========================================*/ /*============================================================================*/ /*============================================================================*/
/* * \struct struct drx_common_attr * \brief Set of common attributes, shared by all DRX devices.
*/ struct drx_common_attr { /* Microcode (firmware) attributes */ char *microcode_file; /*< microcode filename */ bool verify_microcode; /*< Use microcode verify or not. */ struct drx_mc_version_rec mcversion; /*< Version record of microcode from file */
/* Clocks and tuner attributes */
s32 intermediate_freq; /*< IF,if tuner instance not used. (kHz)*/
s32 sys_clock_freq; /*< Systemclock frequency. (kHz) */
s32 osc_clock_freq; /*< Oscillator clock frequency. (kHz) */
s16 osc_clock_deviation; /*< Oscillator clock deviation. (ppm) */ bool mirror_freq_spect; /*< Mirror IF frequency spectrum or not.*/
bool is_opened; /*< if true instance is already opened. */
/* Channel scan */ struct drx_scan_param *scan_param; /*< scan parameters */
u16 scan_freq_plan_index; /*< next index in freq plan */
s32 scan_next_frequency; /*< next freq to scan */ bool scan_ready; /*< scan ready flag */
u32 scan_max_channels;/*< number of channels in freqplan */
u32 scan_channels_scanned; /*< number of channels scanned */ /* Channel scan - inner loop: demod related */
drx_scan_func_t scan_function; /*< function to check channel */ /* Channel scan - inner loop: SYSObj related */ void *scan_context; /*< Context Pointer of SYSObj */ /* Channel scan - parameters for default DTV scan function in core driver */
u16 scan_demod_lock_timeout; /*< millisecs to wait for lock */ enum drx_lock_status scan_desired_lock; /*< lock requirement for channel found */ /* scan_active can be used by SetChannel to decide how to program the tuner,
fast or slow (but stable). Usually fast during scan. */ bool scan_active; /*< true when scan routines are active */
/* Power management */ enum drx_power_mode current_power_mode; /*< current power management mode */
/* Tuner */
u8 tuner_port_nr; /*< nr of I2C port to which tuner is */
s32 tuner_min_freq_rf; /*< minimum RF input frequency, in kHz */
s32 tuner_max_freq_rf; /*< maximum RF input frequency, in kHz */ bool tuner_rf_agc_pol; /*< if true invert RF AGC polarity */ bool tuner_if_agc_pol; /*< if true invert IF AGC polarity */ bool tuner_slow_mode; /*< if true invert IF AGC polarity */
struct drx_channel current_channel; /*< current channel parameters */ enum drx_standard current_standard; /*< current standard selection */ enum drx_standard prev_standard; /*< previous standard selection */ enum drx_standard di_cache_standard; /*< standard in DI cache if available */ bool use_bootloader; /*< use bootloader in open */
u32 capabilities; /*< capabilities flags */
u32 product_id; /*< product ID inc. metal fix number */};
/* * Generic functions for DRX devices.
*/
struct drx_demod_instance;
/* * \struct struct drx_demod_instance * \brief Top structure of demodulator instance.
*/ struct drx_demod_instance { /*< data access protocol functions */ struct i2c_device_addr *my_i2c_dev_addr; /*< i2c address and device identifier */ struct drx_common_attr *my_common_attr; /*< common DRX attributes */ void *my_ext_attr; /*< device specific attributes */ /* generic demodulator data */
struct i2c_adapter *i2c;
};
/*------------------------------------------------------------------------- MACROS Conversion from enum values to human readable form.
-------------------------------------------------------------------------*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.