📄 qatv.h
字号:
/*******************************************************************************
*
* FILENAME : qatv.h
* DESCRIPTION : Defines the qatv module control function
* CREATION DATE : September 2007
* REVISION : 0.8
*
********************************************************************************
* (C) Copyright 2007, QuestLabs, Inc. All rights reserved.
********************************************************************************
*
*
*
*
*
* 20 Feb 2007 Rudy Lee Initial version
*
*******************************************************************************/
#ifndef _QATV_H_
#define _QATV_H_
/********************************************************************************
*
* DEFINE
*
********************************************************************************/
#ifndef PNULL
#define PNULL ((void *)0)
#endif
/* Default Base Address for I2C of QATV */
#define QATVI2C_DEFAULT_BASE_ADDR (0x002c)
/* define for channel map */
#define QATV_CHANNEL_MAP(a) unsigned long a[][4]
#define QATV_CHANNEL_MAP_P(a) unsigned long (*a)[4]
/********************************************************************************
*
* TYPE
*
********************************************************************************/
/** Errors returned by QATV API. */
typedef enum {
QATV_ERR_SUCCESS= 0, /*!< No Errors */
QATV_ERR_FAIL, /*!< Generic Failure during processing */
QATV_ERR_PARAM, /*!< Bad parameter passed */
QATV_ERR_NOT_SUPPORTED, /*!< Requested feature is not supported */
QATV_ERR_MAX
} QATVERR;
/** Video Standards to configure QATV. */
typedef enum {
QATV_VSTD_NTSC_M = 0, /*!< NTSC-M */
QATV_VSTD_PAL_M, /*!< PAL-M */
QATV_VSTD_PAL_B, /*!< PAL-B */
QATV_VSTD_PAL_B1, /*!< PAL-B1 */
QATV_VSTD_PAL_D, /*!< PAL-D */
QATV_VSTD_PAL_D1, /*!< PAL-D1 */
QATV_VSTD_PAL_G, /*!< PAL-G */
QATV_VSTD_PAL_H, /*!< PAL-H */
QATV_VSTD_PAL_K, /*!< PAL-K */
QATV_VSTD_PAL_N, /*!< PAL-N */
QATV_VSTD_PAL_I, /*!< PAL-I */
QATV_VSTD_PAL_NC, /*!< PAL-NC */
QATV_ASTD_FM_RADIO, /*!< FM-RADIO */
QATV_STD_NUM, /*!< Number of video/audio standard */
QATV_VSTD_NONE /*!< No Video Standard Specified */
} qatv_vid_std_t;
/** Video bw mode to configure QATV */
typedef enum {
QATV_VID_BW_OFF = 0, /*!< Off */
QATV_VID_BW_ON /*!< On */
} qatv_vid_bw_t;
/** Video clock state to configure QATV */
typedef enum {
QATV_VID_CLOCK_NORMAL = 0, /*!< Normal */
QATV_VID_CLOCK_INVERT /*!< Invert (default) */
} qatv_vid_clock_t;
/** Video Chroma/Luma order state to configure QATV */
typedef enum {
QATV_VID_CHRLUM_NORMAL = 0, /*!< Normal */
QATV_VID_CHRLUM_INVERT /*!< Invert */
} qatv_vid_chrlum_t;
/** Video Cb/Cr order state to configure QATV */
typedef enum {
QATV_VID_CBCR_NORMAL = 0, /*!< Normal */
QATV_VID_CBCR_INVERT /*!< Invert */
} qatv_vid_cbcr_t;
/** Video sync polarity state to configure QATV */
typedef enum {
QATV_VID_ACTIVE_HIGH = 0, /*!< Active High */
QATV_VID_ACTIVE_LOW /*!< Invert (default) */
} qatv_vid_sync_t;
/** Vsync activity while Hsync is enable or not */
typedef enum {
QATV_VID_VSYNC_DISABLE = 0, /*!< Disable */
QATV_VID_VSYNC_ENABLE /*!< Enable */
} qatv_vid_vsync_activity_t;
/** Video resolution to configure QATV */
typedef enum {
QATV_VID_320_240 = 0, /*!< 320 * 240 */
QATV_VID_360_240, /*!< 360 * 240 */
QATV_VID_640_240, /*!< 640 * 240 */
QATV_VID_720_240, /*!< 720 * 240 */
QATV_VID_UNDEFINED /*!< Undefined */
} qatv_vid_resolution_t;
/** Audio modes to configure QATV */
typedef enum {
QATV_AUD_SLAVE = 0, /*!< I2S Slave Mode */
QATV_AUD_MASTER, /*!< I2S Master Mode */
QATV_AUD_DAC, /*!< DAC Mode */
QATV_AUD_UNDEFINED /*!< Undefined */
} qatv_aud_mode_t;
/** Audio activity to configure QATV */
typedef enum {
QATV_MUTE = 0, /*!< Audio Mute */
QATV_ENABLE /*!< Audio Enable */
} qatv_aud_enable_t;
/** Audio channel to configure QATV in DAC mode */
typedef enum {
QATV_LEFT = 0, /*!< Left Channel */
QATV_LEFT_RIGHT /*!< Left+Right Channel */
} qatv_aud_channel_t;
/** Audio sample rate to configure QATV in I2C mode */
typedef enum {
QATV_AUD_RATE_NONE = 0, /*!< no i2s sample rate specified */
QATV_AUD_RATE_26_367KHZ, /*!< 26.367KHz i2s sample rate */
QATV_AUD_RATE_32_143KHZ, /*!< 32.143KHz i2s sample rate */
QATV_AUD_RATE_44_118KHZ, /*!< 44.118KHz i2s sample rate */
QATV_AUD_RATE_48_214KHZ, /*!< 48.214KHz i2s sample rate */
QATV_AUD_RATE_52_734KHZ /*!< 52.734KHz i2s sample rate */
} qatv_aud_rate_t;
/** Test mode to configure QATV */
typedef enum {
QATV_TEST_OFF = 0, /*!< Off */
QATV_TEST_ON /*!< On */
} qatv_test_t;
/** Audio test mode to configure QATV */
typedef enum {
QATV_AUD_TEST_OFF = 0, /*!< Off */
QATV_AUD_TEST_1KHZ, /*!< 1KHz */
QATV_AUD_TEST_3KHZ, /*!< 3KHz */
QATV_AUD_TEST_8KHZ /*!< 8KHz */
} qatv_aud_test_t;
/********************************************************************************
*
* FUNCTION (need to be customized by user)
*
********************************************************************************/
int QATVI2C_WriteReg(unsigned i2c_addr, unsigned reg_addr, unsigned short data);
int QATVI2C_ReadReg(unsigned i2c_addr, unsigned reg_addr, unsigned short * data);
void QATV_Delay(unsigned short ms);
/********************************************************************************
*
* API
*
********************************************************************************/
/* System Function */
int QATV_SetI2CBaseAddr(unsigned long base_addr);
int QATV_Init(void);
int QATV_PowerDown(void);
int QATV_PowerUp(void);
int QATV_GetSSI(unsigned short *ssi);
void QATV_SystemPolling(void);
/* Channel Function */
int QATV_SetChannelMap(QATV_CHANNEL_MAP_P(map));
int QATV_SetChannel(int channel);
int QATV_ScanChannels(QATV_CHANNEL_MAP_P(scan_map), int max_scan, void (*scanCallbackFunc)(int));
int QATV_ScanChannels2Start(QATV_CHANNEL_MAP_P(scan_map), int startChannel, int max_scan, int reverse, void (*scanCallbackFunc)(int, int));
int QATV_ScanChannels2(int *curChannel);
/* Video Function */
int QATV_GetBright(unsigned short *bright);
int QATV_SetBright(unsigned short bright);
int QATV_GetTint(signed short *tint);
int QATV_SetTint(signed short tint);
int QATV_GetColor(signed short *color);
int QATV_SetColor(signed short color);
int QATV_GetBWVideoMode(unsigned short *mode);
int QATV_SetBWVideoMode(unsigned short mode);
int QATV_Get601VideoOutClock(unsigned short *clock);
int QATV_Set601VideoOutClock(unsigned short clock);
int QATV_GetChromaLumaOrder(unsigned short *order);
int QATV_SetChromaLumaOrder(unsigned short order);
int QATV_GetCbCrOrder(unsigned short *order);
int QATV_SetCbCrOrder(unsigned short order);
int QATV_GetHSyncPolarity(unsigned short *polarity);
int QATV_SetHSyncPolarity(unsigned short polarity);
int QATV_GetVSyncPolarity(unsigned short *polarity);
int QATV_SetVSyncPolarity(unsigned short polarity);
int QATV_GetVsyncKillDuringNoHsync(unsigned short *enable);
int QATV_SetVsyncKillDuringNoHsync(unsigned short enable);
int QATV_GetVideoResolution(unsigned short *resolution);
int QATV_SetVideoResolution(unsigned short resolution);
/* Audio Function */
int QATV_GetAudioMode(unsigned short *mode);
int QATV_SetAudioMode(unsigned short mode);
int QATV_GetAudioEnable(unsigned short *enable);
int QATV_SetAudioEnable(unsigned short enable);
int QATV_GetAudioGain(int mode, unsigned short *gain);
int QATV_SetAudioGain(int mode, unsigned short gain);
int QATV_GetAudioChannelForDAC(unsigned short *channel);
int QATV_SetAudioChannelForDAC(unsigned short channel);
int QATV_GetAudioSampleRateForI2S(unsigned short *rate);
int QATV_SetAudioSampleRateForI2S(unsigned short rate);
/* Function for testing */
int QATV_TestI2C(void);
void QATV_TestVideo(unsigned short enable);
void QATV_TestAudio(unsigned short mode);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -