📄 avsys.h
字号:
// **************************************************************************
// (C)Copyright Cheertek Inc. 2002-2003,
// D300, all right reserved.
// Product : WinAV Firmware
// Date : 2002.09.23
// Author : Cheertek (D300 LLY)
// Purpose : AVSYS module
// The moudle will control the flow of Tuner(Radio)/ AMP
// Sources : avsys.c/ avsys.h
// **************************************************************************
#ifndef __AVSYS_H__
#define __AVSYS_H__
#ifdef __cplusplus
extern "C"{
#endif
///////////////////////////////////////////////////////////////////////////
// ***** Some definition for global variable usage Area *****
// [1] Band ID (__StationInfo->bBand)
// ID must start from '0', because F/W will access freqency array by this index directly
// Ex. wFreq[BAND_AM] : AM frequency
#define BAND_FM 0x0
#define BAND_AM 0x1
// [2] Special Tuner mode info. (__bTunerMode)
// [7:4] : tuner special application mode
// [3:0] : reserve for auto-scan submode, ex up-scan/ down-scan (Same as _TUNER_TuningFreq() parameter meaning)
// LLY2.78b, re-adjut the meaning of bit [7:4]
#define TUNER_MODE_NONE 0x00
#define TUNER_MODE_SCAN_ONE 0x10
#define TUNER_MODE_SCAN_MORE 0x20
#define TUNER_MODE_AUTO_SCAN TUNER_MODE_SCAN_ONE
// Notice: must using "==" operation to check search scan mode
// becaseu, it combine auto scan and scan mode two attributes
#define TUNER_MODE_SEARCH_SCAN (TUNER_MODE_AUTO_SCAN|TUNER_MODE_SCAN_MORE)
#define TUNER_MODE_MEMORY 0x80
// [3] Peripheral input component status (__bPeriperalIN) -- LLY.278a
#define NO_INPUT 0x00
#define EARPHONE_ACTIVE 0x01
#define MICPHONE_ACTIVE 0x02
////////////////////////////////////////////////////////////////////////////
// ***** Some Global Definition Area *****
// [1] Max FM/ AM station number
// LLY.278, exlarge the maximum FM/AM number from 10/5 to 20/20
#define MAX_FM_STATION_NO 20
#define MAX_AM_STATION_NO 20
// [2] The Minimum/ Maximum Freqency of Each Band
#define MIN_FM_FREQ 8750
#define MAX_FM_FREQ 10800
#define MIN_AM_FREQ 522
#define MAX_AM_FREQ 1620
// [3] Default Tuner Band & Freqency info.
#define TUNER_DEFAULT_BAND BAND_FM
#define TUNER_DEFAULT_FM_FREQ MIN_FM_FREQ
#define TUNER_DEFAULT_AM_FREQ MIN_AM_FREQ
// [4] The Gap of each time tuning
#define FM_GAP_PER_TUNING 5 // means : 0.05 MHz
#define AM_GAP_PER_TUNING 9 // means : 9 KHz
// [5] Debug info. for tuner mode
#define TUNER_BUFFER_OVERFLOW 3001
// [6] The BYTE number to keep each station info. -- LLY.278-1
#define STATION_BYTE_NO 2
// [7] The time gap between two search scan action -- LLY2.78b
#define TIME_GAP_FOR_SEARCH_SCAN ((DWORD)COUNT_3_SEC)
//////////////////////////////////////////////////////////////////////////
// ***** Some definition for APIs parameter usage Area *****
// [1] AVSYS_Initial()
// [3:0] means : Initial AV system action
// [7:4] means : Default write or current read -- DATA_DEFAULT or None
#define POWERON_INITIAL 0x01
#define TUNER_INITIAL 0x02
// [2] AVSYS_TunerDataAccess()
// [3:0] means : Read/ Write action
// [7:4] means : Default value or not
#define DATA_READ 0x01
#define DATA_WRITE 0x02
#define DATA_DEFAULT 0x10
// [3] _TUNER_MemoryAction()
#define MEMORY_SAVE 0x1
#define MEMORY_GET 0x2
// [4] _TUNER_TuningFreq()
// Notice: will be used for __bTunerMode too
#define UP_TUNING 0x01
#define DOWN_TUNING 0x02
// [5] _TUNER_AutoScan()
#define DISABLE_AUTO_SCAN 0
#define ENABLE_UP_SCAN UP_TUNING
#define ENABLE_DOWN_SCAN DOWN_TUNING
// [6] The action of program tuner IC -- HAL1_ProgramTuner()
// Notice: Only use [7:4] bit,
// and [3:0] is used for band info.(BAND_FM, BAND_AM)
#define SET_BAND 0x10
#define AUTO_SCAN 0x20
#define MANUAL_SCAN 0x40
#define SEARCH_SCAN 0x80
// [7] Lock or unlock info. while auto-scan station -- HAL1_ProgramTuner()
#define STATION_UNLOCK 0x0
#define STATION_LOCK 0x1
// [8] The action result after query search scan mode -- _TUNER_QuerySearchScan()
#define SEARCH_SCAN_STOP 0x0
#define SEARCH_SCAN_CONTINUE 0x1
#define SEARCH_SCAN_POSTPOND 0x2
///////////////////////////////////////////////////////////////////////////
// ***** Structure Definition Area *****
// [1] Current band & frequency info.
typedef struct tagSTATION_INFO
{
BYTE bBand; // current band
WORD wFreq[2]; // correspond band's frequency
} STATION_INFO, * PSTATION_INFO;
#define STATION_INFO_LENGTH 5 // 1byte+2word
// [2] Memory station info.
typedef struct tagMEMORY_STATION
{
WORD wFM[MAX_FM_STATION_NO];
WORD wAM[MAX_AM_STATION_NO];
} MEMORY_STATION, * PMEMORY_STATION;
// LLY.278, define the structure length base on element number: 20FM + 20 AM (80 bytes)
#define MEMORY_STATION_LENGTH ((MAX_FM_STATION_NO+MAX_AM_STATION_NO)*2)
//Kevin2.81-2, add
// If define it, F/W will save/read the tuner value into/from serial-EPROM -- Kevin2.81-2
// Otherwise, F/W will read the tuner value using using default, and not svae tuner values
#define TUNER_VALUE_SAVE_IN_SERIAL_EPROM
///////////////////////////////////////////////////////////////////////////
// ***** Extern Global Variables Area ****
#ifdef SUPPORT_AV_SYSTEM
extern BYTE __bAUXChannel;
// Only for tuner mode usage
#ifndef NO_TUNER
extern PSTATION_INFO __StationInfo; // current station info.
extern PMEMORY_STATION __MemStation; // memory station info.
#endif // #ifndef NO_TUNER
#endif // #ifdef SUPPORT_AV_SYSTEM
///////////////////////////////////////////////////////////////////////////
// ***** External Function Prototype Area *****
void AVSYS_Initial(BYTE bMode);
void AVSYS_ExitTuner(void);
//BYTE AVSYS_ProcessKey(BYTE bKey, WORD wParam);
BYTE AVSYS_ProcessKey(BYTE bKey);
void AVSYS_Trigger(void);
void AVSYS_TunerDataAccess(BYTE bAction); //Kevin2.81-2, rename
#ifdef __cplusplus
}
#endif
#endif // __AVSYS_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -