⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db_api.h

📁 DVB软件,基于CT216软件的开发源程序.
💻 H
📖 第 1 页 / 共 3 页
字号:
/**************************************************************************

        (C)Copyright Cheertek Inc. 2002-2004,
           D700, all right reserved.

        Product : STB Firmware

****************************************************************************/

#ifndef __DVB_DATABASE_H
#define __DVB_DATABASE_H
/*! \file
This module provides the database access API.
There three tables in the database.  These 
tables relation show as follow:
\verbatim
                                                      +---------+  
  +-----------+           +-------------+             | TV and  |
  | Satellite |   1 : n   | Transponder |    1 : n    | Radio   |
  | Table     | <=======> | Table       |  <========> | Service |
  +-----------+           +-------------+             | Table   |
                                                      +---------+
\endverbatim

The satellite database has a special record "Others".  This is used in 
the transponder base not satellite base.
When the transponder and satellite is no relation, the transponder's satellite index
needs setting to "Others" satellite. 

The database operation is in SDRAM buffer.  When add, delete and
update the record in database, the database in flash isn't modified.  
The application needs save the database from SDRAM buffer to flash and show the message
on OSD in a good time.
*/

#include "dvb_type.h"
#include "dvb_av.h"
#include "ap_defs.h"

#define MAX_SAT_NAME_LENGTH			16/**< Define the maximum length of satellite name. */
#define MAX_PROVIDER_NAME_LENGTH	16/**< Define the maximum length of service provider name. */ //Marlin 20060504 Add
#define MAX_TP_NAME_LENGTH			16/**< Define the maximum length of transponder name. */
#define	MAX_SERVICE_NAME_LENGTH		20/**< Define the maximum length of service name. */

#ifdef ATSC_SYSTEM
#define	MAX_UTF16_SERVICE_NAME_LENGTH		(7) /* follow the PSIP standard */	
#endif /* #ifdef ATSC_SYSTEM */

#ifdef TUI	/**seven for TUI to keep 7 audio PIDs.*/
	#define MAX_AUDIO_PID_NUMBER         7
#else
	#define MAX_AUDIO_PID_NUMBER		2 /**< Define the total audio PIDs. */	
#endif

#define MAX_FAVORITE_GROUP_NUM 15    /**< Define group number of favorite. */	
#define MASK_OF_FAVORITE_GROUP 0x7fff   /**< Define mask to check favorite bit. */	

/**
* Define the system type.
*/
typedef enum
{
	EN_SYSTEM_TYPE_DVBS,
	EN_SYSTEM_TYPE_DVBT,
	EN_SYSTEM_TYPE_DVBC,
	EN_SYSTEM_TYPE_DTMB,//add dtmb 0613
	EN_SYSTEM_TYPE_TOTAL
} EN_SYSTEM_TYPE;

/**
* Define the service type.
*/
typedef enum
{
	EN_SERVICE_TYPE_TV,		/**< the TV service */
    EN_SERVICE_TYPE_RADIO,	/**< the Radio service */
    EN_SERVICE_TYPE_TOTAL
}EN_SERVICE_TYPE;

typedef enum
{
	EN_DISPLAY_TYPE_DB_IDX,		/**< by database index */
#ifdef ENABLE_LCN_SUPPORT
    EN_DISPLAY_TYPE_LCNS,		/**< by logical channel number */
#endif
    EN_DISPLAY_TYPE_SRV_ID		/**< by service ID */
}EN_PGM_DISPLAY_TYPE;

typedef enum
{
	EN_SORT_BY_SID,		/**< by service ID */
    EN_SORT_BY_NAME_AZ,	/**< by name from a to z */
    EN_SORT_BY_NAME_ZA,	/**< by name from z to a */
    EN_SORT_BY_CHNO,	/**< by channel number and service ID */
    EN_SORT_BY_FAV,	    /**< by favorite first */
    EN_SORT_BY_NON_FAV,	/**< by non-favorite first */
    EN_SORT_BY_FAVEX,	    /**< by favorite extention first */
    EN_SORT_BY_NON_FAVEX,	/**< by non-favorite extention first */
    EN_SORT_BY_FREE,   	/**< by free service */
#ifdef ENABLE_LCN_SUPPORT
    EN_SORT_BY_LCNS,	    /**< by logical channel number */
    EN_SORT_BY_LCNS_SCR,	/**< by logical channel number and scramble mode */
#ifdef LCN_COUNTRY_CHECK_DISABLE    
    EN_SORT_BY_PCN,         /**< by parser order channel number and scramble mode */
#endif    
#endif    
    EN_SORT_BY_CA,	    /**< by scramble service */
#ifdef TUI
	EN_SORT_BY_FREQ 	/*<by program's frequency,add by shawn*/
#endif
}EN_SORT_TYPE;


/**
* Define for u8LNBPower.
*/
#define LNB_POWER_SYSTEM    0   /**< LNB power depend on system setting. */	
#define LNB_POWER_OFF       1   /**< LNB power off. */	
#define LNB_POWER_13V18V    2   /**< LNB power can be 13V or 18V. */	
#define LNB_POWER_18V       3   /**< LNB power is 18V, Horizontal. */	
#define LNB_POWER_13V       4   /**< LNB power is 13V, Vertical, */	


/**
* Define for u8LNBType.
*/
#define LNB_C_BAND      0   /**< C band LNB. */	
#define LNB_KU_BAND     1   /**< Ku band LNB. */	
#define LNB_UNIVERSAL   2   /**< Universal LNB. */	

/**
* Define the satellite information structure.  This structure size musts divided by 4.
*/
typedef struct DVB_SatInfo
{
	char acSatelliteName[MAX_SAT_NAME_LENGTH] ;	/**< the satellite name */
	u16 u16VidService_start_idx ;				
	/**< the first video service index on this satellite */
	u16 u16VidService_end_idx ;					
	/**< the latest video service on this satellite */
	u16 u16RdoService_start_idx ;
	/**< the first radio service index on this satellite */
	u16 u16RdoService_end_idx ;
	/**< the latest radio service index on this satellite */
	u16 u16LocalFrequency ;
	/**< This is local frequency. The unit is MHz.

	The normal value for C band is 5150 and for Ku band is 11300.*/
	s16 s16Longitude;
	/**< This is satellite longitude.  The value needs divide 10 to convert to actual value.
	
	Example: The decimal value 1055 is 105.5 degree */
	bool8	b8Control12V;	/**< 12V control on(TRUE) /off(FALSE) */
	bool8	b8Tone22K;		/**< 22K tone on(TRUE) /off(FALSE) */
	u8	u8DiSEqC ;			/**< DiSEqC off or port 1,2, ...
	The value 0 indicate the DiSEqC is off */
	u8 u8LNBPower;	/**< LNB_POWER_SYSTEM / LNB_POWER_OFF / LNB_POWER_13V18V / LNB_POWER_13V / LNB_POWER_18V */ 
	u16 u16LocalFrequency_High ;
	/**< Second local frequency. The unit is MHz.*/
	u8 u8LNBType;   /**< LNB_C_BAND / LNB_KU_BAND / LNB_UNIVERSAL */ 
	u8 u8MotorPosition; /**< DiSEqC 1.2  Motor Position , OFF(0)/01/02/....... */ 
}_Pack_Struct_
DVB_SatInfo;

//Marlin 20060504 Add
typedef struct _DVB_TerreInfo
{
	char	acProviderName[MAX_SAT_NAME_LENGTH];
	u16 u16VidService_start_idx ;				
	/**< the first video service index on this satellite */
	u16 u16VidService_end_idx ;					
	/**< the latest video service on this satellite */
	u16 u16RdoService_start_idx ;
	/**< the first radio service index on this satellite */
	u16 u16RdoService_end_idx ;
} _Pack_Struct_ DVB_TerreInfo;

typedef struct _DVB_CableInfo
{
	char	acProviderName[MAX_SAT_NAME_LENGTH];
	u16 u16VidService_start_idx ;				
	/**< the first video service index on this satellite */
	u16 u16VidService_end_idx ;					
	/**< the latest video service on this satellite */
	u16 u16RdoService_start_idx ;
	/**< the first radio service index on this satellite */
	u16 u16RdoService_end_idx ;
} _Pack_Struct_ DVB_CableInfo;

//add dtmb info 20080613
typedef struct _DVB_DtmbInfo
{
	char	acProviderName[MAX_SAT_NAME_LENGTH];
	u16 u16VidService_start_idx ;				
	/**< the first video service index on this satellite */
	u16 u16VidService_end_idx ;					
	/**< the latest video service on this satellite */
	u16 u16RdoService_start_idx ;
	/**< the first radio service index on this satellite */
	u16 u16RdoService_end_idx ;
}_Pack_Struct_ DVB_DtmbIfo;
//Marlin 20060504 Add
typedef union
{
	DVB_SatInfo		netSat;
	DVB_TerreInfo	netTerre;
	DVB_CableInfo	netCable;
	DVB_DtmbIfo		netDtmb;//add dtmb
} _Pack_Struct_ DVB_NetInfo;

/**
* Define the transponder information structure.   This structure size musts divided by 4.
*/
typedef struct DVB_TPInfo
{
	char acTransponderName[MAX_TP_NAME_LENGTH];	/**< the transponder name */ 
	u16 u16LocalFrequency;
	/**< This is local frequency. The unit is MHz.

	The normal value for C band is 5150 and for Ku band is 11300.*/
	u16 u16TPFrequency;
	/**< This is transponder frequency. The unit is MHz. */
	u16 u16SymbolRate;
	/**< This is transponder symbol rate. The unit is Kbaud. */
	bool8	b8Polar_H; /**< Horizontal(TRUE) / Vertical(FALSE) */
	bool8	b8Control12V;	/**< 12V control on(TRUE) / OFF(FALSE) */
	bool8	b8Tone22K;		/**< 22K tone ON(TRUE) / OFF(FALSE) */
	u8	u8DiSEqC;		/**< DiSEqC OFF or port 1,2, ...
	The value 0 indicate the DiSEqC is off */
	u8	u8SatelliteIndex ;	/**< This is satellite index and a relation key. */
	u8  u8Unused;			/**< Fit to 4 bytes alignment. */ 
#if 1	
	u16 u16OrgNID; /**< Original Network ID*/
	u16 u16TPID; /**< Transport Stream ID */
#endif	 
}_Pack_Struct_
DVB_TPInfo;

//Venti 20060602 Add
typedef struct _CableTPInfoEx
{
	u32		u32FrequencyKHz;
	u8		u8BandwidthMHz;
	u8		u8SpectrumInv;
	u8		u8ChNo;
	u16 	u16SymbRateKB;
	u8		u8QamType;
	u16		u16NetworkIndex;
#if 1	
	u16 u16OrgNID; /**< Original Network ID*/
	u16 u16TPID; /**< Transport Stream ID */
#endif	
} _Pack_Struct_ DVB_CableTPInfoEx;

//Marlin 20060504 Add
typedef struct _TerreTPInfoEx
{
	u32		u32FrequencyKHz;
	u8		u8BandwidthMHz;
	u8		u8FFT;
	u8		u8Const;
	u8		u8GI;
	u8		u8Hierarchy;
	u8		u8ChNo;
	u16		u16NetworkIndex;
#if 1	
	u16 u16OrgNID; /**< Original Network ID*/
	u16 u16TPID; /**< Transport Stream ID */
#endif		
} _Pack_Struct_ DVB_TerreTPInfoEx;

//seven add dtmb 20080613
typedef struct _DtmbTPInfoEx
{
	u32		u32FrequencyKHz;
	u8		u8ChNo;
	u8 		u8CarryMode;
	u8		u8GI;
	u8 		u8QAMMode;
	u8 		u8TimeDeinterleaver;
	u8 		u8FECRate;
	u16		u16NetworkIndex;
#if 1	
	u16 u16OrgNID; /**< Original Network ID*/
	u16 u16TPID; /**< Transport Stream ID */
#endif	
}_Pack_Struct_ DVB_DtmbTPInfoEx;
typedef union _TPInfoEx
{
	DVB_TPInfo			tpSat;
	DVB_TerreTPInfoEx	tpTerre;
	DVB_CableTPInfoEx	tpCable;
	DVB_DtmbTPInfoEx	tpDtmb;//add dtmb
} _Pack_Struct_ DVB_TPInfoEx;

/**
* Define the service information structure.  This structure size musts divided by 4.
*/
typedef struct DVB_ServiceInfo
{
#ifdef ATSC_SYSTEM
	u8 acServiceName[MAX_UTF16_SERVICE_NAME_LENGTH * 2 + 3];  /**< 0x11 + 2 NULL bytes the service name */
	u32 u32MajorCHNo:10;
	u32 u32MinorCHNo:10;
	u32 u32AccessCtrl:1;
	u32 u32Hidden:1;
	u32 u32HideGuide:1;
	u32 u32ServiceType:6;
	u32 u32Reserved1:1;
	u32 u32Reserved2:1;
	u32 u32Reserved3:1;
#else	
	char acServiceName[MAX_SERVICE_NAME_LENGTH];  /**< the service name */ 
#endif	
	u16 u16ServiceId;	/**< The service id come form SI table to check reduce service. */ 
	u16 u16PCRPid ;		/**< the PCR PID */ 
	u16 u16VideoPid ;	/**< the Video PID */
	u16 au16AudioPid[MAX_AUDIO_PID_NUMBER] ;	/**< the Audio PIDs */ 
	u16 u8TransponderIndex ;	/**< This is transponder index and a relation key. */
	u8 u8Type ;
	/**<  
	\verbatim
	bit 7 : parental lock
			0 : unlock
			1 : lock

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -