📄 fmtuner.c
字号:
//-----------------------------------------------------------------------------
// (C) Copyright 2003 Philips Semiconductors, All rights reserved
//
// This source code and any compilation or derivative thereof is the sole
// property of Philips Corporation and is provided pursuant to a Software
// License Agreement. This code is the proprietary information of Philips
// Corporation and is confidential in nature. Its use and dissemination by
// any party other than Philips Corporation is strictly limited by the
// confidential information provisions of the Agreement referenced above.
//-----------------------------------------------------------------------------
// FILE NAME: fmTuner.c
//
// VERSION: <1.00.00.0000>
//
// DESCRIPTION: This source file contains interface function called by appmanager.
// They are used for module initialization,open,and event/command process
// Exported function list:
// U32 fmTuner_Initialize(void),
// U32 fmTuner_Open(void),
// U32 fmTuner_Close(void),
// U32 fmTuner_CmdProcessor(
// U32 kCommand,
// U32 kData,
// U32 kExtData1,
// U32 kExtData2
// )
//
// DOCUMENT REF:SZLAB/PRS0003
//-----------------------------------------------------------------------------
// Standard include files:
//-----------------------------------------------------------------------------
//
#include "common.h"
#include "cmd_glb.h"
#include "keyb_glb.h"
#include "global.h"
#include "PSA_API.h"
//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------
//
#include "fmTuner.h"
#include "fmVolume.h"
#include "drvNvdata.h"
#include "fmI2cmaster.h"
#include "fmTuner_DrvFunction.h"
#include "fmTuner_GPIO.h"
#include "drvLcd.h"
#include "fmDisplay.h"
#include "fmTuner_PresetStore.h"
//-----------------------------------------------------------------------------
// Types and defines:
//-----------------------------------------------------------------------------
//
extern U32 fmTuner_KeyProcess(U32 u32kKeyCode,U32 u32kKeyEvent);
//-----------------------------------------------------------------------------
// Global data:
//-----------------------------------------------------------------------------
//
Tuner_States_Ready_en fmTunerPlayingFlag=STATE_NOT_READY;
//-----------------------------------------------------------------------------
// Internal Prototypes:
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
// Exported functions:
//-----------------------------------------------------------------------------
//
//
//-----------------------------------------------------------------------------
// FUNCTION: fmTuner_Initialize
//
// DESCRIPTION: This function is used for module initialization
//
// RETURN: U32,for description,please refer to global.h
//
// NOTES: <Function notes - pre/post state, side effects, reentrancy>
//-----------------------------------------------------------------------------
U32
fmTuner_Initialize(void)
{
gfmTuner_pPointer=&gfmTuner_sRuningParameter;
fmI2cmaster_initialize();
//fmTuner_InitializeGPIO();
//delay 10ms
fmTuner_OsGenernalDelay(10);
return cSSA_OK;
}//fmTuner_Initialize()
//-----------------------------------------------------------------------------
// FUNCTION: fmTuner_Open
//
// DESCRIPTION: <Function description/purpose>
//
// RETURN: <Return data type/description>
//
// NOTES: <Function notes - pre/post state, side effects, reentrancy>
//-----------------------------------------------------------------------------
U32
fmTuner_Open(void)
{
drvNvdata_GetPersistentValue(drvNvdata_Index_Tuner,&gfmTuner_sRuningParameter);
fmTuner_StandBy(TRUE);
//delay 10ms
fmTuner_OsGenernalDelay(10);
return cSSA_OK;
}//fmTuner_Open()
//-----------------------------------------------------------------------------
// FUNCTION: fmTuner_Close
//
// DESCRIPTION: <Function description/purpose>
//
// RETURN: <Return data type/description>
//
// NOTES: <Function notes - pre/post state, side effects, reentrancy>
//-----------------------------------------------------------------------------
U32
fmTuner_Close(void)
{
return cSSA_OK;
}//fmTuner_Close
//-----------------------------------------------------------------------------
// FUNCTION: fmTuner_CmdProcessor
//
// DESCRIPTION: This function handles porcessing of system event including keyboard,PSA event,command
//
// RETURN: U32,for description,please refer to global.h
//
// NOTES: <Function notes - pre/post state, side effects, reentrancy>
//-----------------------------------------------------------------------------
U32
fmTuner_CmdProcessor(
U32 kCommand,
U32 kData,
U32 kExtData1,
U32 kExtData2
)
{
U32 ReturnCode;
ReturnCode=cSSA_OK;
switch (kCommand)
{
case cCMD_START:
fmTuner_StandBy(FALSE);
fmTuner_OsGenernalDelay(1500);
//drvLcd_ClearDisplayScreen();
fmTuner_GlobalVariablesInitialize();
//delay 10ms
fmTuner_OsGenernalDelay(10);
PSA_SetAudioParameters(PSA_LINE_FEEDBACK_SS,PSA_12_KHZ_SR,0x00);
drvNvdata_GetPersistentValue(drvNvdata_Index_Tuner,&gfmTuner_sRuningParameter);
gfmTuner_u16TunerFrequency=gfmTuner_pPointer->LastFrequency;
fmTuner_TuneToFrequecy(gfmTuner_u16TunerFrequency);
gfmTuner_u8InTune=TRUE;
fmTuner_OsGenernalDelay(5);
drvLcd_ClearDisplayScreen();
fmTuner_DisplayRefresh();
fmTunerPlayingFlag=STATE_READY;
break;
case cCMD_STOP:
fmTuner_StandBy(TRUE);
//fmTuner_MuteDemuteTuner(TRUE);
if(gfmTuner_u8WriteFlash==TRUE)
{
gfmTuner_pPointer->LastFrequency=gfmTuner_u16TunerFrequency;
drvNvdata_SetPersistentValue(drvNvdata_Index_Tuner,&gfmTuner_sRuningParameter);
}
fmTuner_GlobalVariablesInitialize();
fmTunerPlayingFlag=STATE_NOT_READY;
break;
case cCMD_SET_RUNNING_MODE:
switch(kData)
{
case RUNNING_MODE_NORMAL:
gfmTuner_u8BackGround=FALSE;
drvLcd_ClearDisplayScreen();
fmTuner_DisplayRefresh();
break;
case RUNNING_MODE_BACKGROUND:
gfmTuner_u8BackGround=TRUE;
drvLcd_ClearDisplayScreen();
break;
}
break;
case cCMD_DISPATCH_MESSAGE:
switch(kData)
{
case cMSG_KEYB:
if(fmTunerPlayingFlag==STATE_READY&&gfmTuner_u8BackGround==FALSE)
{
ReturnCode=fmTuner_KeyProcess((Keyb_Code_e)kExtData1,kExtData2);
}
break;
case cMSG_PSA_EVENT:
ReturnCode=cSSA_PSA_MSG_UNKNOWN;
break;
case cMSG_TIMER:
if(fmTunerPlayingFlag==STATE_READY&&gfmTuner_u8BackGround==FALSE)
{
gfmTuner_u8TimerHalfSec++;
if(gfmTuner_u8TimerHalfSec>=16)
{
gfmTuner_u8TimerHalfSec=0;
}
if(gfmTuner_u8TimeOutFunctionTimer>1)
{
gfmTuner_u8TimeOutFunctionTimer--;
}
if(gfmTuner_u8TimeOutFunctionTimer==1)
{
if(gfmTuner_u8SaveBusy==TRUE)
{
fmTuner_ExitSaveHandler();
}
gfmTuner_u8TimeOutFunctionTimer=0;
}
if(gfmTuner_u8SaveBusy==TRUE)
{
fmTuner_FlashChannelNumber();
}
//polling tuner
fmTuner_ReadSequentialByte(gfmTuner_I2C_BufferRead,cIIC_LENGTH_FIVE);
if(gfmTuner_u8InTune==TRUE)
{
fmTuner_CheckInTune();
}
if(gfmTuner_u8SearchBusy==TRUE)
{
fmTuner_CheckSearch();
}
if(gfmTuner_u8AstSearchBusy==TRUE&&!gfmTuner_u8SearchBusy)
{
fmTuner_CheckAstSearch();
}
if(!gfmTuner_u8AstSearchBusy&&!gfmTuner_u8InTune&&!gfmTuner_u8SearchBusy&&gfmTuner_eMonoStereo==fmTuner_MonoStereo_Stereo)
{
fmTuner_StereoMonoDisplay();
}
}
break;
default:
ReturnCode=cSSA_MSG_UNKNOWN_TYPE;
break;
}
break;
default:
//not currently supported command
ReturnCode=cSSA_UNKNOWN_COMMAND;
break;
}
return ReturnCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -