📄 lv24ekit.h
字号:
// definitions of CO_SELECT_MASK
#define CO_NONE 0 // 0: nothing at output
#define CO_RF_OSC 1 // FREQ1: RF frequency
#define CO_IF_OSC 2 // FREQ2: IF Osccilator output
#define CO_SD_OSC 3 // FREQ3: Stereo decoder clock output
#define CO_RD_OSC 4 // FREQ4: RDS Osccilator output
//-----------------------------------------------------------------------------
// Function prototypes
//-----------------------------------------------------------------------------
#include "LvProto.h"
//-----------------------------------------------------------------------------
// Radio definitions
//-----------------------------------------------------------------------------
// De-emphasis value
#define DEEMP_75 1
#define DEEMP_50 0
// Regions
// FM
#define REGION_NONE 0 // None: use hardware limit
#define REGION_EUROPE 1 // FM Europe (87.5MHz - 108 MHz, de-emp=50)
#define REGION_JAPAN 2 // FM Japan (76MHz - 90MHz, de-emp=50)
#define REGION_US 3 // FM US (same as Europe, De-emp=75)
#define REGION_JAPAN_WIDE 4 // FM Japan wide: Same as Japan, with extra CH1(95.75) CH2(101.75) CH3(107.75)
#ifdef SUPPORT_AMFM
// AM
#define REGION_EUROPE_AM_MW 1 // AM MW Europe (522 kHz-1611 kHz, grid=9 kHz) (Also for W-Europe)
#define REGION_JAPAN_AM_MW 2 // AM MW Japan (522 kHz-1629 kHz, grid=9 kHz)
#define REGION_USA_AM_MW 3 // AM MW USA (520 kHz-1710 kHz, grid=10 kHz)
//#define REGION_AM_LW 4 // AM LW (146 kHz- 281 kHz, grid=1 kHz) (All regions)
//#define REGION_AM_SW 5 // AM SW (2280 kHz-21850 kHz, grid=5 kHz) (All regions)
#endif //SUPPORT_AMFM
/*-------------------------------------------------------------------
Device capability ID (Used by:
GetHwFeatureLimit
SetHwFeatureValue
GetHwFeatureValue)
-------------------------------------------------------------------*/
#define IHCAP_TUNERPWR 0 // ID 0: Tuner's power can be switched on/off
#define IHCAP_VOLUME 1 // ID 1: Volume level supported
#define IHCAP_AMUTE 2 // ID 2: Audio mute
#define IHCAP_ATREBLE 3 // ID 3: Audio treble supported
#define IHCAP_ABASS 4 // ID 4: Audio bass supported
#define IHCAP_DYNBASSBOOST 5 // ID 5: Dynamic bass boost supported
#define IHCAP_SMUTE 6 // ID 6: Audio soft mute supported
//#define IHCAP_DEEMP 7 // ID 7: Hardware De-emphasis supported
#define IHCAP_STEREO 8 // ID 8: Stereo supported
#define IHCAP_SOFT_ST 9 // ID 9: Soft stereo supported
#define IHCAP_RADIOSOURCE 10 // ID 10: Hardware supports radio source select
#define RBAND_OFF 0 // Value of radio source feature
#define RBAND_FM 1
#define RBAND_AM 2
#define IHCAP_EXTSOURCE 11 // ID 11: Hardware supports external source select
#define IHCAP_BEEPSOURCE 12 // ID 12: Hardware has pre-programmed beep tone
//#define IHCAP_BEEPBIT 13 // ID 13: Hardware has beep-bit
//#define IHCAP_AFC 14 // ID 14: AFC (automatic frequency control) supported
#define IHCAP_HPA 15 // ID 15: Hardware headphone amplifier presents
//#define IHCAP_HPBASS 16 // ID 16: Hardware supports headphone bass level
//#define IHCAP_RDS 17 // ID 17: RDS supported if set
//#define IHCAP_CNT2 18 // ID 18: Counter2 supported if set
//#define IHCAP_AFC2 19 // ID 19: Hardware AFC2 presents (required external clock - limit is this clock)
// Software features
#define IHCAP_SCANLVL 20 // ID 20: Scan level
#define IHCAP_SCANWRP 21 // ID 21: Frequency wrapping by scanning
#define IHCAP_REGION 22 // ID 22: Region
#define IHCAP_BEEPVOL 23 // ID 23: Beep volume for audible feedback
//#ifdef USE_EXTCLK
#define IHCAP_EXTCLK 24 // ID 24: external clock (0= no external clock, 1= 12MHz, 2=32kHz)
//#endif //USE_EXTCLK
//-----------------------------------------------------------------------------
// Definitions for function's parameters
//-----------------------------------------------------------------------------
// Scan station parameters
#define SCANSTN_DIR ((BYTE)1<<0) // Bit 0: 1 => scan next, 0 => scan previous
#define SCANSTN_NEXT SCANSTN_DIR
#define SCANSTN_PREV 0
#define SCANSTN_AUTO ((BYTE)1<<1) // Bit 1: Auto scan if 1, scan next/previous if 0
// Adjust volume parameters
#define VOLUME_UP 0xFF
#define VOLUME_DOWN 0xFE
// Return values of GetStereoState
#define GSS_MONO 0 // Mono
#define GSS_STEREO 1 // Stereo enabled
#define GSS_STEREO_DET 2 // Stereo enabled and detected
//-----------------------------------------------------------------------------
// Bit definitions for global variables
//-----------------------------------------------------------------------------
// Bit definitions of g_bySwFlag1
#ifdef USE_EXTCLK // Bit 0-1: external clock setting if USE_EXTCLK is enabled
// Don't change bit position of external clock (to use 0..2 after AND mask)
#define SF1_EXTCLK ((BYTE)3<<0) // Bit [1:0]: external clock setting
#define EXTCLK_NONE ((BYTE)0<<0) // 0: No external clock
#define EXTCLK_12MHz ((BYTE)1<<0) // 1: 12MHz external clock
//#define EXTCLK_32KHz ((BYTE)2<<0) // 2: 32kHz external clock (reserved)
#endif //USE_EXTCLK
// Bit 0-1: available if USE_EXTCLK is not defined
#define SF1_PULSE3W_BUSY ((BYTE)1<<2) // Bit 2: measuring is busy
#define SF1_USB_HOST_CON ((BYTE)1<<3) // Bit 3: USB host controls the EVK
// Bit 4: available
#define MUTESRC_APPLICATION ((BYTE)1<<5) // bit 5: Mute source: application
#define MUTESRC_OPERATION ((BYTE)1<<6) // bit 6: mute source: operation (scan, set frequency)
#define MUTESRC_VOLUME ((BYTE)1<<7) // bit 7: mute source: volume
#define MUTESRC_MASK ((BYTE)(MUTESRC_VOLUME|MUTESRC_APPLICATION|MUTESRC_OPERATION))
// Bit definitions of g_byStnFlag
#define STN_WRAP_MODE ((BYTE)3<<0) // Bit [1:0]: frequency wrapping mode by Set/Scan station
// Don't change bit position of wrap mode (to use 0..2 after AND mask)
#define STNWRAP_NONE ((BYTE)0<<0) // 0: No wrap
#define STNWRAP_ONCE ((BYTE)1<<0) // 1: wrap once
#define STNWRAP_CONT ((BYTE)2<<0) // 2: wrap continue
// Bit 2-3: available
#define STN_VALID ((BYTE)1<<4) // Bit 4: Valid station mark
// Bit 5-6: available
#ifdef SUPPORT_AMFM
#define STN_AM_MODE ((BYTE)1<<7) // Bit 7: Radio station is in AM mode if 1
#define STN_FM_MODE ((BYTE)0<<7) // Bit 7: Radio station is in FM mode if 0
#endif //SUPPORT_AMFM
// Bit definitions of g_byHwFlag1
#define HF1_NEG_IF_PHASE ((BYTE)1<<0) // Bit 0: Negative IF phase is 1
#define HF1_HP ((BYTE)1<<1) // Bit 1: Hardware has headphone amplifier
#define HF1_AM ((BYTE)1<<2) // Bit 2: Hardware supports AM
//#define HF1_RDS ((BYTE)1<<3) // Bit 3: Hardware supports RDS
// Bit 4-7: available
// Bit definitions for g_byLvIrqFlg
#define IFL_CHIP_IRQ_EN ((BYTE)1<<0) // Bit 0: Chip interrupt is enabled in stand alone mode
#define IFL_CHIP_IRQ_OCC ((BYTE)1<<1) // Bit 1: Chip interrupt occurred (stand alone mode)
// Bit 2-3: available
#define IFL_USBIRQ_INSTALLED ((BYTE)1<<4) // Bit 4: USB host IRQ script is installed
// Bit 5-7: available
//-----------------------------------------------------------------------------
// 3W specific global variables
//-----------------------------------------------------------------------------
// _define macro declares global variables or refers as extern
#ifdef _MAIN_MODULE
#define _define
#else
#define _define extern
#endif // _MAIN_MODULE
// USB-3W resources
#ifdef USE_USB
#define USB_REPLY_PACKET_SIZE 32 // Reply packet size for USB-3W host
_define BYTE g_ReceiveBuf[64];
//_define BYTE g_ReplyBuf[64];
_define BYTE *g_ReplyBuf;
_define BYTE g_byUsbRxCnt; // Byte count (Received from USB-3W host)
_define BYTE g_by3wIntf; // 3W digital interface storage
//_define BYTE g_byRepIoVal1[2];
//_define BYTE g_byRepIoVal2[2];
//_define BYTE g_byRepIoIntVal[2];
#endif //USE_USB
// Radio resource
_define BYTE g_byStnFlag; // Station flags
_define BYTE g_bySwFlag1; // Software control flag 1. See bit definitions above
_define BYTE g_byRegion; // Current radio region
_define BYTE g_byScanLevel; // Scan level
_define BYTE g_byDynBassBoost; // Dynamic bass boost setting
_define BYTE g_byBeepVol; // Beep volume
// LV2400x register resources
_define BYTE g_byHwFlag1; // Chip attribute flag 1(hardware dependant)
_define BYTE g_byLvIrqFlg; // Several control flags for chip interrupt
_define BYTE g_byBlock; // Current block selected
//BYTE g_byaShwRegValue[LVSHADOW_LSIZE];// array to hold the shadowed value - defined in DgtParser.c
// LV2400x frequency resources
_define WORD g_wLastSetRF; // Last RF frequency which is set (in 10 kHz-unit)
_define WORD g_wLastMsrRF; // Last measured RF frequency (in 10 kHz-unit)
_define WORD g_wFreqGrid; // Frequency grid
// LV2400x QSSF resources
typedef struct
{
WORD CoefLo;
WORD CoefHi;
} QSSF_ITEM;
_define WORD g_wHwRfLow; // The minimal hardware RF
_define WORD g_wHwRfHigh; // The maximal hardware RF
_define WORD g_wDisplayBandLow; // Band limit low
_define WORD g_wDisplayBandHigh; // Band limit high
_define QSSF_ITEM Qssf1; // Coefficient low
_define QSSF_ITEM Qssf2; // Coefficient high
#ifdef USE_PRESET
#define PFLS_SIGN_A 0x4C
#define PFLS_SIGN_B 0x68
#define PRESET_CNT 30
#define SETTING_CNT 30
typedef struct
{
BYTE bySignA; // 0
BYTE bySignB; // 1
WORD waFmPreset[PRESET_CNT]; // 2...61 - preset storage of FM (30)
WORD wLastFreq; // 62..63 - last used frequency
BYTE byaSetting[SETTING_CNT]; // 64...93
#ifdef SUPPORT_AMFM
BYTE byaAmPreset[PRESET_CNT]; // 94...123
#endif //SUPPORT_AMFM
//BYTE byaReserved[4]; // 124..127 - The aligned bytes (matching sector size) are not needed for LCFLS V0.01
} EVK_SETTING_ST;
#define PRESET_AREA_SIZE (sizeof(EVK_SETTING_ST))
_define EVK_SETTING_ST g_stEvkSetting;
// Following are parameters for RetrieveSettingFromFlash-function
// 0...(SETTING_CNT-1): retrieve a feature setting
// FD: Retrieve last set frequency (FM/AM depends on current mode) - not supported yet
// FE: Retrieve station list (FM/AM depends on current mode) - not supported yet
// FF: Retrieve all settings
#define RSFF_ALL 0xFF // Retrieve all settings
#endif //USE_PRESET
// Keypad resource
_define BYTE g_byPressedKey;
_define BYTE g_byMenu;
_define BYTE g_byNrPressed;
_define BYTE g_byInpPos; // current frequency input (cursor) position
_define BYTE g_byaInp[5]; // Array to hold user's input (for setting frequency manually)
_define BYTE g_byCurPreset; // Current preset location for storing/recalling preset
// USB-IRQ resource
#ifdef USE_IRQSCRIPT
// IRQ Script
// Script buffer
#define MAX_IRQSCRIPT_LEN 100 // Currently used 87 bytes for LV2401x (RDS) script
_define BYTE g_byaIrqScript[MAX_IRQSCRIPT_LEN];
// Round robin buffer declaration (meant for RDS data)
#define MAXLEN_IRQRNDBUF 32
typedef struct // Round robin buffer
{
BYTE byW; // The write pointer
BYTE byR; // The read pointer
BYTE byF; // Byte filled count
BYTE byBuf[MAXLEN_IRQRNDBUF];
} RNDBUF_ST, *PRNDBUF_ST;
// External interrupt (meant for external RDS demodulator)
_define BYTE g_byRdsBitCnt; // The received RDS bit counter
_define RNDBUF_ST g_stExtIrq;
// Buffer 0 (required)
#define MAXLEN_IRQBUF_0 16
_define BYTE g_byaIrqBuf0[MAXLEN_IRQBUF_0];
// Buffer 1 (optional - meant for device RDS)
_define RNDBUF_ST g_stIrqBuf1;
#endif //USE_IRQSCRIPT
// Free space
//_define char g_xx[512+181];
/* -------------------------------EOF------------------------------------------ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -