📄 tmbsltda18211local.h
字号:
//-----------------------------------------------------------------------------
// $Header:
// (C) Copyright 2001 NXP Semiconductors, All rights reserved
//
// This source code and any compilation or derivative thereof is the sole
// property of NXP Corporation and is provided pursuant to a Software
// License Agreement. This code is the proprietary information of NXP
// Corporation and is confidential in nature. Its use and dissemination by
// any party other than NXP Corporation is strictly limited by the
// confidential information provisions of the Agreement referenced above.
//-----------------------------------------------------------------------------
// FILE NAME: tmbslTDA18211local.h
//
// DESCRIPTION: define the Object for the TDA18211
//
// DOCUMENT REF: DVP Software Coding Guidelines v1.14
// DVP Board Support Library Architecture Specification v0.5
//
// NOTES:
//-----------------------------------------------------------------------------
//
#ifndef _TMBSL_TDA18211LOCAL_H //-----------------
#define _TMBSL_TDA18211LOCAL_H
#ifdef _WIN32
#include "windows.h"
#endif
//#define TMBSL_TDA18211 1
#ifdef UNICODE
#define __TEXT(quote) L##quote
#else /* UNICODE */
#define __TEXT(quote) quote
#endif /* UNICODE */
#define TEXT(quote) __TEXT(quote)
#define TMBSL_COMPONENT_NAME TDA18211
#define TMBSL_FUNC(funcName) TEXT(tmbsl)TEXT(TMBSL_COMPONENT_NAME)TEXT(funcName)
//-----------------------------------------------------------------------------
// Standard include files:
//-----------------------------------------------------------------------------
#include "tmhalFEtypes.h"
#include "dvp.h"
#include "tmbslTDA18211.h"
//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------
//
#ifdef __cplusplus
extern "C"
{
#endif
//-----------------------------------------------------------------------------
// Types and defines:
//-----------------------------------------------------------------------------
//
#define TDA18211_BSL_COMP_NUM 3 // Major protocol change - Specification change required
#define TDA18211_BSL_MAJOR_VER 2 // Minor protocol change - Specification change required
#define TDA18211_BSL_MINOR_VER 3 // Software update - No protocol change - No specification change required
//-------------
// ERROR CODES
//-------------
// Invalid unit id
#define TMBSL_ERR_TUNER_BAD_UNIT_NUMBER \
(TMBSL_ERR_TUNER_BASE + TM_ERR_BAD_UNIT_NUMBER)
// Component is not initialized
#define TMBSL_ERR_TUNER_NOT_INITIALIZED \
(TMBSL_ERR_TUNER_BASE+ TM_ERR_NOT_INITIALIZED)
// Invalid input parameter
#define TMBSL_ERR_TUNER_BAD_PARAMETER \
(TMBSL_ERR_TUNER_BASE + TM_ERR_BAD_PARAMETER)
// Function is not supported
#define TMBSL_ERR_TUNER_NOT_SUPPORTED \
(TMBSL_ERR_TUNER_BASE + TM_ERR_NOT_SUPPORTED)
// Function is not supported
#define TMBSL_ERR_IIC_ERR \
(TMBSL_ERR_TUNER_BASE + TM_ERR_IIC_ERR)
#define TDA18211_MAX_UNITS 10 //
#define TDA18211_NB_BYTES 39 //
#define TDA18211_LOG_NB_ROWS 300 //
#define TDA18211_LOG_BLANK_DATA 256 //
#define TDA18211_IR_MEAS_NB_COLUMNS 2 //
#define TDA18211_IR_CAL_NB_COLUMNS 2 //
#define TDA18211_BP_FILTER_NB_COLUMNS 2 //
#define TDA18211_RF_BAND_NB_COLUMNS 12 //
#define TDA18211_GAIN_TAPER_NB_COLUMNS 2 //
#define TDA18211_RF_CAL_NB_COLUMNS 2 //
#define TDA18211_RF_CAL_DC_OVER_DT_NB_COLUMNS 2 //
#define TDA18211_RF_CAL_KMCO_NB_COLUMNS 4 //
#define TDA18211_RF_CAL_CID_TARGET_NB_COLUMNS 3 //
#define TDA18211_CAL_PLL_NB_COLUMNS 3 //
#define TDA18211_MAIN_PLL_NB_COLUMNS 3 //
#define TDA18211_IR_MEAS_NB_ROWS 3 //
#define TDA18211_IR_CAL_NB_ROWS 3 //
#define TDA18211_BP_FILTER_NB_ROWS 2 //
#define TDA18211_RF_BAND_NB_ROWS 3 //
#define TDA18211_GAIN_TAPER_NB_ROWS 48 //
#define TDA18211_RF_CAL_NB_ROWS 319 //
#define TDA18211_RF_CAL_DC_OVER_DT_NB_ROWS 85 //
#define TDA18211_RF_CAL_KMCO_NB_ROWS 3 //
#define TDA18211_RF_CAL_CID_TARGET_NB_ROWS 7 //
#define TDA18211_CAL_PLL_NB_ROWS 18 //
#define TDA18211_MAIN_PLL_NB_ROWS 20 //
#define TDA18211_THERMOMETER_NB_COLUMNS 3 //
#define TDA18211_THERMOMETER_NB_ROWS 16 //
#define TDA18211_IDENTITY_IND 0 //
#define OM5770C2_BOARD_DEF 0x57700002
#define OM5775_BOARD_DEF 0x57750000
#define OM5776_BOARD_DEF 0x57760000 //
#define OM5777_BOARD_DEF 0x57770000 //
#define OM5780_BOARD_DEF 0x57800000 //
#define OM5782_BOARD_DEF 0x57820000 //
#define OM5764_BOARD_DEF 0x57640199 //
#define CUSTOM_BOARD_DEF 0x00000000 // custom
#define OM57XX_STANDARD_DEF 2
#define RF_CAL_IF_FREQ 1000000
#ifdef _WIN32
typedef Bool (*SY_OpenCom_t) (void);
typedef UInt8 (*SY_SetComConfig_t) (I2C_Conf_T);
typedef Bool (*SY_SetDeviceAdd_t) (char DeviceName[],UInt32 NewAdd);
typedef UInt32 (*SY_GetTickTime_t) (void);
typedef UInt32 (*SY_GetTickPeriod_t) (void);
typedef UInt32 (*SY_GetComError_t) (void);
typedef Bool (*SY_Write_t) (UInt32 uAddress,
UInt32 uSubAddress,
UInt32 uNbData,
UInt32* pDataBuff);
typedef Bool (*SY_WriteBit_t) (UInt32 uAddress,
UInt32 uSubAddress,
UInt32 uMaskValue,
UInt32 uValue);
typedef Bool (*SY_Read_t) (UInt32 uAddress,
UInt32 uSubAddress,
UInt32 uNbData,
UInt32* pDataBuff);
typedef UInt8 (*SY_SetComConfigFromVB_t) (I2C_Conf_T);
typedef Bool (*SY_OpenComFromVB_t) (void);
typedef Bool (*SY_SetDeviceAddFromVB_t) (char DeviceName[],UInt32 NewAdd);
typedef Bool (*SY_SetUrt_t) (void);
typedef Bool (*SY_SetErrorEnable_t) (Bool ErrorEnable);
typedef void (*SY_SetI2cPortFromVB_t) (void);
typedef Bool (*SY_CloseCom_t) (void);
#endif
typedef enum _tmTDA18211MapName_t {
tmTDA18211_IR_MEAS_Map, // Image rejection measurement map
tmTDA18211_IR_CAL_Map, // Image rejection calibration map
tmTDA18211_BP_FILTER_Map, // Band pass filter map
tmTDA18211_RF_BAND_Map, // RF band map
tmTDA18211_GAIN_TAPER_Map, // Gain tapper map
tmTDA18211_RF_CAL_Map, // RF calibration map
tmTDA18211_RF_CAL_DC_OVER_DT_Map, // RF calibration temperature adjustment map
tmTDA18211_RF_CAL_KMCO_Map, // RF calibration K,M,COAmpl map
tmTDA18211_RF_CAL_CID_TARGET_Map, // RF calibration CID target map
tmTDA18211_THERMOMETER_Map, // Thermometer map
tmTDA18211_CAL_PLL_Map, // Calibration PLL map
tmTDA18211_MAIN_PLL_Map, // Main PLL map
tmTDA18211_I2C_Map, // I2C map
} tmTDA18211MapName_t, *ptmTDA18211MapName_t;
typedef struct _tmTDA18211_IR_MEAS_Map_t {
UInt32 uRF_Max;
UInt32 uIR_Meas;
} tmTDA18211_IR_MEAS_Map_t, *ptmTDA18211_IR_MEAS_Map_t;
typedef struct _tmTDA18211_IR_CAL_Map_t {
UInt32 uRF;
UInt32 uIR_GStep;
} tmTDA18211_IR_CAL_Map_t, *ptmTDA18211_IR_CAL_Map_t;
typedef struct _tmTDA18211_BP_FILTER_Map_t {
UInt32 uRF_Max;
UInt32 uBP_Filter;
} tmTDA18211_BP_FILTER_Map_t, *ptmTDA18211_BP_FILTER_Map_t;
typedef struct _tmTDA18211_RF_BAND_Map_t {
UInt32 uRF_Max;
UInt32 uRF_Band;
UInt32 uRF1;
UInt32 uRF2;
UInt32 uRF3;
Int32 uRF_A1;
Int32 uRF_B1;
Int32 uRF_A2;
Int32 uRF_B2;
UInt32 uRF1_default;
UInt32 uRF2_default;
UInt32 uRF3_default;
} tmTDA18211_RF_BAND_Map_t, *ptmTDA18211_RF_BAND_Map_t;
typedef struct _tmTDA18211_GAIN_TAPER_Map_t {
UInt32 uRF_Max;
UInt32 uGain_Taper;
} tmTDA18211_GAIN_TAPER_Map_t, *ptmTDA18211_GAIN_TAPER_Map_t;
typedef struct _tmTDA18211_RF_CAL_Map_t {
UInt32 uRF_Max;
UInt32 uRFC_Cprog;
} tmTDA18211_RF_CAL_Map_t, *ptmTDA18211_RF_CAL_Map_t;
typedef struct _tmTDA18211_RF_CAL_DC_OVER_DT_Map_t {
UInt32 uRF_Max;
UInt32 udC_Over_dT;
} tmTDA18211_RF_CAL_DC_OVER_DT_Map_t, *ptmTDA18211_RF_CAL_DC_OVER_DT_Map_t;
typedef struct _tmTDA18211_RF_CAL_KMCO_Map_t {
UInt32 uRF_Max;
UInt32 uK;
UInt32 uM;
UInt32 uCOAmpl;
} tmTDA18211_RF_CAL_KMCO_Map_t, *ptmTDA18211_RF_CAL_KMCO_Map_t;
typedef struct _tmTDA18211_RF_CAL_CID_TARGET_Map_t {
UInt32 uRF_Max;
UInt32 uCID_Target;
UInt32 uCount_Limit;
} tmTDA18211_RF_CAL_CID_TARGET_Map_t, *ptmTDA18211_RF_CAL_CID_TARGET_Map_t;
typedef struct _tmTDA18211_THERMOMETER_Map_t {
UInt32 uTM_D;
UInt32 uTM_60_92;
UInt32 uTM_92_122;
} tmTDA18211_THERMOMETER_Map_t, *ptmTDA18211_THERMOMETER_Map_t;
typedef struct _tmTDA18211_PLL_Map_t {
UInt32 uLO_Max;
UInt32 uPost_Div;
UInt32 uDiv;
} tmTDA18211_PLL_Map_t, *ptmTDA18211_PLL_Map_t;
typedef struct _tmTDA18211Config_t {
UInt32 uBoard;
UInt32 uStandard;
UInt32 uRF;
UInt32 uIF;
UInt32 uBW;
UInt32 uTMVALUE_RFCAL;
UInt32 uPLMODE;
Int32 uRFCAL_TCOMP;
UInt32 uMAPNAME;
UInt32 uMAPCOLUMN;
UInt32 uMAPROW;
UInt32 uPROTOCOLSTEP;
tmTDA18211_IR_MEAS_Map_t IR_MEAS_Map[TDA18211_IR_MEAS_NB_ROWS];
tmTDA18211_IR_CAL_Map_t IR_CAL_Map[TDA18211_IR_CAL_NB_ROWS];
tmTDA18211_BP_FILTER_Map_t BP_FILTER_Map[TDA18211_BP_FILTER_NB_ROWS];
tmTDA18211_RF_BAND_Map_t RF_BAND_Map[TDA18211_RF_BAND_NB_ROWS];
tmTDA18211_GAIN_TAPER_Map_t GAIN_TAPER_Map[TDA18211_GAIN_TAPER_NB_ROWS];
tmTDA18211_RF_CAL_Map_t RF_CAL_Map[TDA18211_RF_CAL_NB_ROWS];
tmTDA18211_RF_CAL_DC_OVER_DT_Map_t RF_CAL_DC_OVER_DT_Map[TDA18211_RF_CAL_DC_OVER_DT_NB_ROWS];
tmTDA18211_RF_CAL_KMCO_Map_t RF_CAL_KMCO_Map[TDA18211_RF_CAL_KMCO_NB_ROWS];
tmTDA18211_RF_CAL_CID_TARGET_Map_t RF_CAL_CID_TARGET_Map[TDA18211_RF_CAL_CID_TARGET_NB_ROWS];
tmTDA18211_THERMOMETER_Map_t THERMOMETER_Map[TDA18211_THERMOMETER_NB_ROWS];
tmTDA18211_PLL_Map_t CAL_PLL_Map[TDA18211_CAL_PLL_NB_ROWS];
tmTDA18211_PLL_Map_t MAIN_PLL_Map[TDA18211_MAIN_PLL_NB_ROWS];
} tmTDA18211Config_t, *ptmTDA18211Config_t;
typedef struct _tmTDA18211I2CMap_t
{
union
{
UInt8 ID_BYTE; // address 0x00
// Chip identification byte
struct
{
UInt8 ID :7; // Chip identification number
UInt8 UNUSED :1; // Reserved, must be written as 1
}bF;
}uBx00;
union
{
UInt8 THERMO_BYTE; // address 0x01
// Thermometer byte
struct
{
UInt8 TM_D :4; // Data from die temperature measurement
UInt8 TM_ON :1; // Enable Die temperature measurement
UInt8 TM_Range :1; // Range selection bit for the internal die sensor
// 0: 60 to 92癈
// 1: 92 to 122癈
UInt8 MAIN_Lock :1; // Indicate that the MAIN synthesizer is locked to the programmed frequency
// 0: Not Locked
// 1: Locked
UInt8 POR :1; // Power on reset bit
// This bit is set to 1 each time the power supply falls below a certain level (around 1.4V) and is reset after a read operation ending with a stop condition
}bF;
}uBx01;
union
{
UInt8 POWER_LEVEL_BYTE; // address 0x02
// Power level byte
struct
{
UInt8 Power_Level_7_to_0:8;// Power level indicator value
}bF;
}uBx02;
union
{
UInt8 EASY_PROG_BYTE_1; // address 0x03
// Easy programming byte 1
struct
{
UInt8 BP_Filter :3; // RF band-pass filter selection (H3/H5)
UInt8 IR_CAL_OK :1; // Indicate that the 3 Image rejection calibration procedure (Flow, Fmid, Fhigh) have been successful
UInt8 RF_CAL_OK :1; // Indicate that the RF tracking filter calibration procedure has been successful
UInt8 UNUSED :1; // Reserved
UInt8 Dis_Power_level:1;// Disable power level measurement
// 0: Power measurement valid
// 1: Power measurement not guaranted
UInt8 Power_Level_8 :1; // Power level indicator value
}bF;
}uBx03;
union
{
UInt8 EASY_PROG_BYTE_2; // address 0x04
// Easy programming byte 2
struct
{
UInt8 Gain_Taper :5; // Gain taper value
// 0 : max atten. (end of Band)
// 31: min atten. (start of Band)
UInt8 RF_Band :3; // RF tracking filter band and sub-band selection
}bF;
}uBx04;
union
{
UInt8 EASY_PROG_BYTE_3; // address 0x05
// Easy programming byte 3
struct
{
UInt8 Std :5; // Standard selection
UInt8 SM_XT :1; // XTAL output sleep mode
UInt8 SM_LT :1; // Loop through sleep mode
UInt8 SM :1; // General sleep mode
}bF;
}uBx05;
union
{
UInt8 EASY_PROG_BYTE_4; // address 0x06
// Easy programming byte 4
struct
{
UInt8 CAL_Mode :2; // calibration mode selection
UInt8 IF_Level :3; // IF output level selection
UInt8 Xtout_400mV :1; // XTAL output level optional selection
UInt8 XTout_ON :1; // Enable 16MHz on XTAL output
UInt8 CAL_RFn :1; // CAL or RF input selection
}bF;
}uBx06;
union
{
UInt8 EASY_PROG_BYTE_5; // address 0x07
// Easy programming byte 5
struct
{
UInt8 IR_Meas :3; // Image rejection measurement mode
UInt8 I2C_Xtout_Asym:1; // Reserved
UInt8 IR_Gstep :3; // Gain step for image rejection measurement. Depends on frequency
UInt8 Extended_Reg :1; // Enable the extended byte addressing
// 0: Limited byte (&h00:&h0F)
// 1: Extended byte (&h00:&h26)
}bF;
}uBx07;
union
{
UInt8 CAL_POST_DIV_BYTE; // address 0x08
// CAL post divider byte
struct
{
UInt8 CALPostDiv :7; // CAL post divider
UInt8 RUF_0 :1; // Reserved
}bF;
}uBx08;
union
{
UInt8 CAL_DIV_BYTE_1; // address 0x09
// CAL divider byte 1
struct
{
UInt8 CAL_Div_22_to_16:7;// CAL divider value 22 to 16
UInt8 RUF_1 :1; // Reserved
}bF;
}uBx09;
union
{
UInt8 CAL_DIV_BYTE_2; // address 0x0A
// CAL divider byte 2
struct
{
UInt8 CAL_Div_15_to_8:8;// CAL divider value 15 to 8
}bF;
}uBx0A;
union
{
UInt8 CAL_DIV_BYTE_3; // address 0x0B
// CAL divider byte 3
struct
{
UInt8 CAL_Div_7_to_0:8; // CAL divider value 7 to 0
}bF;
}uBx0B;
union
{
UInt8 MAIN_POST_DIV_BYTE; // address 0x0C
// MAIN post divider byte
struct
{
UInt8 MAIN_Post_Div :7; // MAIN post divider value
UInt8 IF_notch :1; // Reserved
}bF;
}uBx0C;
union
{
UInt8 MAIN_DIV_BYTE_1; // address 0x0D
// MAIN divider byte 1
struct
{
UInt8 MAIN_Div_22_to_16:7;// MAIN divider value 22 to 16
UInt8 RUF_2 :1; // Reserved
}bF;
}uBx0D;
union
{
UInt8 MAIN_DIV_BYTE_2; // address 0x0E
// MAIN divider byte 2
struct
{
UInt8 MAIN_Div_15_to_8:8;// MAIN divider value 15 to 8
}bF;
}uBx0E;
union
{
UInt8 MAIN_DIV_BYTE_3; // address 0x0F
// MAIN divider byte 3
struct
{
UInt8 MAIN_Div_7_to_0:8;// MAIN divider value 7 to 0
}bF;
}uBx0F;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -