📄 tlg1100app.h
字号:
#ifndef _TLG1100APP_H_
#define _TLG1100APP_H_
/****************************************************************************/
/*!@file tlg1100App.h
*
* @brief Example application code for using TLG1100 API.
*
* This file contains the api definitions for the TLG1100 Example Application
* procedures. These procedures assume that TLG_EMBEDDED_TIMERS is defined.
* The simplest application that can be written is (assuming TLGAPP_Init() has
* been customized correctly):
*
@verbatim
main()
{
TLGAPP_TurnOnTestPattern();
}
OR
main()
{
TLGAPP_Init(TLGI2C_DEFAULT_BASE_ADDR);
TLGAPP_SetChannelMapNTSC();
TLGAPP_SetChannel(48);
}
@endverbatim
*
*
****************************************************************************/
/* Revision Information:
*
* $Revision: 1.9 $
*
* (c) 2006 Telegent Systems
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#if TLG_CHIP_TYPE == TLG_CHIP_TYPE_TLG1100_1
/** Example data structure of an entry in a channel map.
* @typedef tlg_channel_t
*
* This datastructure defines an example format for entries in a channel map.
* A channel map is defined as an array of these structures that is terminated
* with an entry whose "chn" field is set to "0". For instance:
*
* tlg_channel_t small_ntsc_chn_map[] = {
*
* {2, 101000000, 6},
*
* {0, 0, 0}
*
* };
*
* @param chn integer value to describe the channel number (e.g. 2,3...).
* @param hz center frequency in Hz of the channel.
* @param bw bandwidth in MHz of the channel. Values are (5,6,7,8)
* @param chstd channel standard
* TLG_VSTD_NTSC_M
* TLG_VSTD_PAL_M
* TLG_VSTD_PAL_B
* TLG_VSTD_PAL_D
* TLG_VSTD_PAL_D1
* TLG_VSTD_PAL_G
* TLG_VSTD_PAL_H
* TLG_VSTD_PAL_K
* TLG_VSTD_PAL_N
* TLG_VSTD_PAL_I
* TLG_VSTD_PAL_N
*/
#define xSUPPORT_STRUCT
#ifdef SUPPORT_STRUCT
/** Pointer to a tlg_channel_t.
* @typedef p_tlg_channel_t
*/
typedef struct tlg_channel_s {
int chn;
uint32 hz;
int bw;
int chstd;
} tlg_channel_t, *p_tlg_channel_t;
#define CHN_S .chn
#define HZ_S .hz
#define BW_S .bw
#define STD_S .chstd
#else
/*
* moving to no structures since some C compilers don't support them
*/
#define tlg_channel_t(a) uint32 a[][4]
#define p_tlg_channel_t(a) uint32 (*a)[4]
#define CHN_S [0]
#define HZ_S [1]
#define BW_S [2]
#define STD_S [3]
#endif
#define TLG_NEW_INIT (0) /*!< indicates first Init of TLG1100 */
#define TLG_INIT_DEEP_SLEEP (1) /*!< indicates re-init from deep sleep */
/** Restart the TLGAPP API.
*
* This procedure resets all the TLGAPP API state variables so that the
* TLG1100 may be restarted using TLGAPP_Init(). An external chip reset
* procedure may also be employed to physically reset the chip as well.
*
*/
TLGDLL_API void TLGAPP_Restart(void);
/** Initialize the TLG1100 to be ready to perform channel changes.
*
* This procedure performs all tasks necessary to initialize the TLG1100
* chip and have it perform calibration. Upon return from this procedure the
* TLG1100 is ready to perform channel changes.
*/
TLGDLL_API int TLGAPP_Init(uint32 base_addr);
/** USER CUSTOMIZABLE procedure to set up audio and video portions of TLG1100.
*
* This procedure is a USER CUSTOMIZABLE procedure where all audio and video
* initialization should be done. The code resides in tlg1100customize.c
*/
TLGDLL_API void TLGAPP_InitVideoAndAudio(void);
/** Initialize registers to their desired default values.
*
* This procedure loads selected registers to their default values as
* defined in the tlg1100.ini file. It is called by TLGAPP_Init() and should
* not need to be called by itself.
*
* @sa TLGAPP_Init.
*/
TLGDLL_API void TLGAPP_Ini_Reg(int start);
/** Setup channel mode, video standard and bandwidth for channel.
*
* This procedure checks the input parameters against the currently
* configured values and, if necessary, sets the TLG100 to these values.
*
* @param mode The desired mode. Valid values are:
* - TLG_MODE_ANALOG_TV
* - TLG_MODE_FM_RADIO
* @param std The desired video standard. Valid values are:
* - TLG_VSTD_NTSC_M
* - TLG_VSTD_PAL_M
* - TLG_VSTD_PAL_B
* - TLG_VSTD_PAL_B1
* - TLG_VSTD_PAL_D
* - TLG_VSTD_PAL_D1
* - TLG_VSTD_PAL_G
* - TLG_VSTD_PAL_H
* - TLG_VSTD_PAL_K
* - TLG_VSTD_PAL_N
* - TLG_VSTD_PAL_I
* - TLG_VSTD_PAL_NC
* @param bw The new bandwidth setting. Values are:
* - TLG_BW_5
* - TLG_BW_6
* - TLG_BW_7
* - TLG_BW_8
*
* @retval TLG_ERR_SUCCESS Call succeeded.
* @retval TLG_ERR_PARAM Bad parameter value passed.
* @retval TLG_ERR_FAIL Error during call.
*/
TLGDLL_API int TLGAPP_ChannelSetup(int mode, int std, int bw);
/** Set the channel map for the system along with its default settings.
*
* This procedure sets the default channel map for the system as well as
* checking its mode, video standard and bandwidth settings and updating
* the TLG1100 registers if necessary. Note, if the channel map is a FM Radio
* channel map, TLGAPP_SetChannelMapFM() should be called instead as this
* will also set the proper slope and offset settings for the system.
*
* @param map Pointer to an array of tlg_channel_t entries. The list
* should be terminated with an entry whose .chn field is set
* to 0.
* @param mode the mode for the channel map. See TLGAPP_ChannelSetup() for
* a description of this parameter.
* @param std The default video standard for this channel map. See
* TLGAPP_ChannelSetup() for a descrition of this parameter.
* TLGAPP_ChannelSetup() for a descrition of this parameter.
* @param bw The default bandwidth for this channel map. See
*
* @retval TLG_ERR_SUCCESS Call succeeded.
* @retval TLG_ERR_PARAM Bad parameter value passed.
* @retval TLG_ERR_FAIL Error during call.
*/
TLGDLL_API int TLGAPP_SetChannelMap(p_tlg_channel_t(map), int mode, int std, int bw);
/** Set the Channel map, mode, bandwidth, video standard to PAL-D settings.
*
* This procedure sets the default channel map to the PAL-D channel map and
* sets up the mode to TLG_MODE_ANALOG_TV, the standard to TLG_VSTD_PAL_D
* and the bandwidth to TLG_BW_8 (if not already set up).
*
* @retval TLG_ERR_SUCCESS Call succeeded.
* @retval TLG_ERR_PARAM Bad parameter value passed.
* @retval TLG_ERR_FAIL Error during call.
*/
TLGDLL_API int TLGAPP_SetChannelMapPALD(void);
/** Set the Channel map, mode, bandwidth, video standard to NTSC settings.
*
* This procedure sets the default channel map to the NTSC channel map and
* sets up the mode to TLG_MODE_ANALOG_TV, the standard to TLG_VSTD_NTSC_M
* and the bandwidth to TLG_BW_6 (if not already set up).
*
* @retval TLG_ERR_SUCCESS Call succeeded.
* @retval TLG_ERR_PARAM Bad parameter value passed.
* @retval TLG_ERR_FAIL Error during call.
*/
TLGDLL_API int TLGAPP_SetChannelMapNTSC(void);
/** Set the Channel map, mode, bandwidth, video standard to FM Radio settings.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -