📄 tlg1100api.h
字号:
#ifndef _TLG1100API_H_
#define _TLG1100API_H_
/****************************************************************************/
/*!@file tlg1100Api.h
*
* @brief Api Definitions for the TLG1100 programmatic interface support.
*
* This file contains the api definitions for the TLG1100 Ultra Low Power
* NTSC/PAL Tuner/Decoder chip support library.
*
*
****************************************************************************/
/* Revision Information:
*
* $Revision: 1.48 $
*
* (c) 2006 Telegent Systems
****************************************************************************/
#ifdef TLG_USE_DLL
#ifdef TLGDLL_EXPORTS
#define TLGDLL_API __declspec(dllexport)
#else
#define TLGDLL_API __declspec(dllimport)
#endif /* TLGDLL_EXPORTS */
#else /* !TLG_USE_DLL */
#define TLGDLL_API
#endif /* TLG_USE_DLL */
#ifdef __cplusplus
extern "C" {
#endif
#if TLG_CHIP_TYPE == TLG_CHIP_TYPE_TLG1100_1
#include "tlg1100Hal.h"
#include "tlgi2c.h"
/** This should be a customizable variable for now.
*/
#define TLG_RESTART_THRESH_DEV (1) /** undefine this to make const */
#define TLG_RESTART_THRESH_DEF_VAL (500)
#ifdef TLG_RESTART_THRESH_DEV
extern TLGDLL_API int TLG_RESTART_THRESH;
#else
#define TLG_RESTART_THRESH TLG_RESTART_THRESH_DEF_VAL
#endif /* TLG_RESTART_THRESH_DEV */
#ifndef uint8
#define uint8 unsigned char
#endif /* uint8 */
#ifndef uint16
#define uint16 unsigned short
#endif /* uint16 */
#ifndef uint32
#ifdef TLG_INT_32BIT
#define uint32 unsigned int
#else
#define uint32 unsigned long
#endif /* TLG_INT_32BIT */
#endif /* uint32 */
#ifndef int32
#ifdef TLG_INT_32BIT
#define int32 int
#else
#define int32 long
#endif /* TLG_INT_32BIT */
#endif /* int32 */
#ifndef NULL
#define NULL ((void*)0)
#endif /* NULL */
#ifndef __cplusplus
#ifndef bool
#define bool uint32
#endif /* bool */
#ifndef false
#define false (0)
#endif /* false */
#ifndef true
#define true (1)
#endif /* true */
#endif /* __cplusplus */
#ifndef pow2
#define pow2(a) (((uint32)1) << (a))
#endif /* pow2 */
#ifndef max
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif /* max */
#ifndef min
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif /* min */
/*
* TLG1100 Portable Software Library
* Version 1.10 (0)
*/
#define TLG_VERSION_MAJOR (1)
#define TLG_VERSION_MINOR (10)
#define TLG_VERSION_PATCH (0)
#define TLG_OFF (0)
#define TLG_ON (1)
#define TLG_MVE_AUTO (1)
#define TLG_MVE_MANUAL (0)
#define TLG_NORMAL (0)
#define TLG_FROZEN (1)
#define TLG_INVERT (1)
#define TLG_SWAP (1)
#define TLG_SLAVE (0)
#define TLG_MASTER (1)
#define TLG_DAC (2)
#define TLG_UNDEFINED (3)
#define TLG_MUTE (0)
#define TLG_ENABLE (1)
#define TLG_1KHZ (1)
#define TLG_3KHZ (2)
#define TLG_8KHZ (3)
#define TLG_LEFT (0)
#define TLG_LEFT_RIGHT (1)
#define TLG_CBCR_NORMAL (0)
#define TLG_CBCR_SWAP (1)
#define TLG_CHRLUM_NORMAL (0)
#define TLG_CHRLUM_SWAP (1)
#define TLG_VID_LCD (0)
#define TLG_VID_DENC (1)
#define TLG_ACTIVE_HIGH (0)
#define TLG_ACTIVE_LOW (1)
#define TLG_FREEZE_MAX (0)
#define TLG_FREEZE_MIN (1)
#define TLG_I2C_MODE_SYNC (0) /*!< indicates i2c is Synchronous mode */
#define TLG_I2C_MODE_ASYNC (1) /*!< indicates i2c is Asynchronous mode */
#define TLG_Y_MAX (0x0f) /*!< max Y setting for YUV scale */
#define TLG_U_MAX (0xff) /*!< max U setting for YUV scale */
#define TLG_V_MAX (0xff) /*!< max V setting for YUV scale */
#define TLG_MVE_A_MAX (0x3f)
#define TLG_MVE_MAX (1)
#define TLG_MIN_AUD_GAIN ( 0) /*!< min gain for TLG_MASTER,TLG_SLAVE */
#define TLG_MAX_AUD_GAIN_DIG ( 9) /*!< max gain for TLG_MASTER,TLG_SLAVE */
#define TLG_MAX_AUD_GAIN_DAC ( 5) /*!< max gain for TLG_DAC */
#define TLG_AUD_RATE_NONE (0) /*!< no i2s sample rate specified */
#define TLG_AUD_RATE_26_367KHZ (1) /*!< 26.367KHz i2s sample rate */
#define TLG_AUD_RATE_32_143KHZ (2) /*!< 32.143KHz i2s sample rate */
#define TLG_AUD_RATE_44_118KHZ (3) /*!< 44.118KHz i2s sample rate */
#define TLG_AUD_RATE_48_214KHZ (4) /*!< 48.214KHz i2s sample rate */
#define TLG_AUD_RATE_52_734KHZ (5) /*!< 52.734KHz i2s sample rate */
#define TLG_LOCK_STATE_SYNTH ((uint16) 1 << 12) /*!< synthesizer lock*/
#define TLG_LOCK_STATE_VSYNC ((uint16) 1 << 5) /*!< VSYNC lock */
#define TLG_LOCK_STATE_VIDEO ((uint16) 1 << 4)
#define TLG_LOCK_STATE_AUDIO ((uint16) 1 << 3)
#define TLG_LOCK_STATE_CHROMA ((uint16) 1 << 2)
#define TLG_LOCK_STATE_LUMA ((uint16) 1 << 1)
#define TLG_LOCK_STATE_HSYNC ((uint16) 1 << 0)
#define TLG_UHF_MID_CUTOFF_HZ (500000000) /*!< midpoint cutoff for UHF */
#define TLG_UHF_CUTOFF_HZ (400000000) /*!< cutoff frequency for UHF */
#define TLG_VHF2_CUTOFF_HZ (150000000) /*!< cutoff frequency for VHF2 */
#define TLG_VHF1_MID_CUTOFF_HZ ( 80000000) /*!< midpoint cutoff for VHF1 */
#define TLG_VHF1_CUTOFF_HZ (000000000) /*!< cutoff frequency for VHF1 */
#define TLG_GPIO1 (0x0001)
#define TLG_GPIO2 (0x0002)
#define TLG_GPIO3 (0x0004)
#define TLG_GPIO1_SET (TLG_GPIO1)
#define TLG_GPIO2_SET (TLG_GPIO2)
#define TLG_GPIO3_SET (TLG_GPIO3)
#define TLG_GPIO1_CLR (0)
#define TLG_GPIO2_CLR (0)
#define TLG_GPIO3_CLR (0)
#define TLG_AVG_FILTER_DEPTH 4 /* must be a power of 2 */
#define TLG_AVG_FILTER_IDX(__i) ((__i)&(TLG_AVG_FILTER_DEPTH-1))
#define TLG_NUM_SSI_METRIC 8
typedef struct tlg_avg_filter_s {
uint32 taps[TLG_AVG_FILTER_DEPTH];
uint16 num_sample;
uint16 cur_tap;
} tlg_avg_filter_t, *p_tlg_avg_filter_t;
/** Supported frequency bandwidth settings for TLG API. */
typedef enum {
TLG_BW_5 = 5, /*!< 5 MHz bandwidth */
TLG_BW_6 = 6, /*!< 6 MHz bandwidth */
TLG_BW_7 = 7, /*!< 7 MHz bandwidth */
TLG_BW_8 = 8, /*!< 8 MHz bandwidth */
TLG_BW_NONE
} tlg_bw_t;
/** Modes for TLG1100. */
typedef enum {
TLG_MODE_NONE, /*!< No Mode specified */
TLG_MODE_ANALOG_TV, /*!< Analog Television mode */
TLG_MODE_FM_RADIO /*!< FM Radio mode */
} tlg_mode_t;
/** LNA Types for TLG1100 */
typedef enum {
TLG_LNA_NONE = 0,
TLG_LNA_UHF = 3,
TLG_LNA_VHF2 = 5,
TLG_LNA_VHF1 = 6
} tlg_lna_t;
/** Video Standards to configure TLG1100. */
#if 0
typedef enum {
TLG_VSTD_NTSC_M = 0, /*!< NTSC-M */
TLG_VSTD_PAL_M = 1, /*!< PAL-M */
TLG_VSTD_PAL_B = 2, /*!< PAL-B */
TLG_VSTD_PAL_B1 = 3, /*!< PAL-B1 */
TLG_VSTD_PAL_D = 4, /*!< PAL-D */
TLG_VSTD_PAL_D1 = 5, /*!< PAL-D1 */
TLG_VSTD_PAL_G = 6, /*!< PAL-G */
TLG_VSTD_PAL_H = 7, /*!< PAL-H */
TLG_VSTD_PAL_K = 8, /*!< PAL-K */
TLG_VSTD_PAL_N = 9, /*!< PAL-N */
TLG_VSTD_PAL_I = 10, /*!< PAL-I */
TLG_VSTD_PAL_NC = 11, /*!< PAL-NC */
TLG_VSTD_NONE /*!< No Video Standard Specified */
} tlg_vidstd_t;
#endif
/** Antenna Configurations supported. */
typedef enum {
TLG_ANTENNA_DEF = 0, /*!< Default Antenna Behavior */
TLG_ANTENNA_HDPH, /*!< Settings for the TLG_HDPH Antenna */
TLG_ANTENNA_MAX /*!< Number of Antenna settings */
} tlg_antenna_t;
/** Errors returnd by TLG API. */
typedef enum {
TLG_ERR_SUCCESS= 0, /*!< No Errors */
TLG_ERR_FAIL, /*!< Generic Failure during processing */
TLG_ERR_PARAM, /*!< Bad parameter passed */
TLG_ERR_NOT_SUPPORTED, /*!< Requested feature is not supported */
TLG_ERR_MAX
} TLGERR;
/** States to supply to ASYNC calls, use TLG_STATE0 for first state. */
typedef enum {
TLG_STATE0=0, /*!< Initial state for a TLG ASync State Machine*/
TLG_STATE1, /*!< State 1 for a TLG ASync State Machine */
TLG_STATE2, /*!< State 2 for a TLG ASync State Machine */
TLG_STATE3, /*!< State 3 for a TLG ASync State Machine */
TLG_STATE4, /*!< State 4 for a TLG ASync State Machine */
TLG_STATE5, /*!< State 5 for a TLG ASync State Machine */
TLG_STATE6, /*!< State 6 for a TLG ASync State Machine */
TLG_STATE_FINAL /*!< Final state for a TLG ASync State Machine */
} TLG_state_t;
/** Maximum number of states for a TLG ASync State Machine. */
#define TLG_STATE_MAX (TLG_STATE_FINAL)
/** Size of the TLG State parm block. */
#define TLG_STATE_PARMS_SIZE (32)
/** Store internal state information across asynchronous calls.
*
* The asynchronous calls in TLG1100 API all have a common calling convention.
* Each call has a "state" vector and "ms" millisecond delay.
* Element 0 (e.g. state[0]) should be set to TLG_STATE0 on the initial call.
* When state[0] == TLG_STATE_FINAL, the ASYNC call has completed. The rest
* of the elements of the "state" vector are used by the internal state
* machine of each call. Notice if an asynchronous procedure calls another
* asynchronous procedure, they can assign a portion of the state vector to
* the state vector for the subordinate call: e.g.
*
* Proc1ASYNC(tlg_statep state, int *ms)
*
* {
*
* state[1] = TLG_STATE0;
*
* Proc2ASYNC(&state[1], ms);
* ...
*
* Proc1ASYNC has assigned a portion of its state vector (&state[1]) to be
* the state vector for Proc2ASYNC. This type of nesting can occur multiple
* times as long as the size of the state vector is not exceeded.
*/
typedef uint16 tlg_statep[TLG_STATE_PARMS_SIZE];
#define TLG_MIN_REG_ADDR (0x0000)
#define TLG_MAX_REG_ADDR (0x01b8)
#ifdef TLG_USE_SHADOW_REGISTERS
/** CUSTOMER SUPPLIED array of registers to be used as a shadow or cache. */
extern uint16 _TLG_shadow_reg[];
extern uint8 _TLG_shadow_reg_use[];
#endif /* TLG_SHADOW_REGISTER_SIZE */
#ifdef TLG_DO_ERROR_CHECKING
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -