Nav_Amplifier.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:8k
- /****************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: Nav_Amplifier.c $
- *
- * Description:
- * ============
- *
- *
- * Log:
- * ====
- * $Revision: 5 $
- * Last Modified by $Author: Kennyz $ at $Modtime: 03-06-24 18:04 $
- ****************************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef _DEBUG
- #define IFTRACE if (gTraceNavigator)
- #include "DebugDbgMain.h"
- #endif
- #include "IncludeSysDefs.h"
- #include "Includemath-macro.h"
- #include "Kernelker_api.h"
- #include "KernelEventDef.h"
- #include "PlaycoreCoremaincoregdef.h"
- #include "PlaycoreNav_amplifierNav_Amplifier.h"
- #include "PlaycoreTimingTiming.h"
- #ifdef DIGITAL_AMPLIFIER_ENABLE
- UINT8 HeadphoneActiveTime = 0;
- ////////////////////////////////////////////////////////////////////////////////////////////////
- // Constants
- ////////////////////////////////////////////////////////////////////////////////////////////////
- // Macros
- ////////////////////////////////////////////////////////////////////////////////////////////////
- // Globals
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Private Services
- /////////////////////////////////////////////////////////////////////////////////////////////////
- static void Constructor();
- static void Destructor();
- static void OnStatusReport();
- void OnVolumeSet(void* Param);
- void OnLimiterRateSet(void* Param);
- void OnLimiterThresholdSet(void* Param);
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Public Services
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // int Amplifier_Navigator(HDLR_OP Op, EVENT Event, void *Param) -
- // The main router for Receiver-Navigation Events.
- //
- // Input:
- // Op - The type of operation being invoked
- // Event - The event to route
- // Param - An optional Parameter for the event being routed
- //
- // Output:
- // Zero if the routing is successful.
- int Amplifier_Navigator(HDLR_OP Op, EVENT Event, void *Param)
- {
- switch (Op)
- {
- case HDLR_ENTER: Constructor();
- break;
- case HDLR_EXIT: Destructor();
- break;
- case HDLR_EVENT:
- switch (Event)
- {
- case IE_CORE_AMPLIFIER_BASE_SCALE:
- base_set((UINT8)Param);
- break;
- case IE_CORE_AMPLIFIER_BASE_TONE:
- basetone_set((UINT8)Param);
- break;
- case IE_CORE_AMPLIFIER_TREBLE_TONE:
- trebletone_set((UINT8)Param);
- break;
- case IE_CORE_AMPLIFIER_ADJACENT_CHANNEL_MIX:
- adjacent_channel_mix((BOOL)Param);
- break;
- case IE_CORE_AMPLIFIER_EQUALIZATION:
- equalization_set((UINT8)Param);
- break;
- case IE_CORE_AMPLIFIER_VOLUME:
- OnVolumeSet(Param);
- break;
- case IE_CORE_AMPLIFIER_DYNAMICS_MODE:
- dynamics_mode((UINT8)Param);
- break;
- case IE_CORE_AMPLIFIER_LIMITER_RATE:
- OnLimiterRateSet(Param);
- break;
- case IE_CORE_AMPLIFIER_THRESHOLD:
- OnLimiterThresholdSet(Param);
- break;
-
- case IE_CORE_TICK_200:
- OnTick();
- break;
- case IE_CORE_AMPLIFIER_TRICK_CONTROL:
- register_control(Param);
- break;
- case EVENT_CLASS_CORE:
- #ifdef _DEBUG
- OnStatusReport();
- #endif //_DEBUG
- break;
- default:
- dbg_printf(("Amp_Nav: Unexpected Event %xn",Event & 0xFF));
- break;
- }
- break;
- default:
- dbg_printf((" Amp_Nav: Unknown Operation requested %dn", Op));
- break;
- }
- return 0;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Private Services
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // void Constructor() -
- // A Constructor for a Receiver-Navigator instance.
- //
- // Input:
- // None
- //
- // Output:
- // None. The Navigator is constructed.
- //
- // Remarks:
- // This method constructs a new Receiver-Navigator, whose internal data and status
- // are kept in the Receiver_Nav structure passed to the method.
- static void Constructor()
- {
- dbg_printf(("Receiver Nav Constructor()n"));
- amplifier_init();
- #ifdef ENABLE_DAC_VOLUME_CONTROL
- AUDIODAC_VOL_CONTROL(gps->ChannelVolume[0]);
- #endif
- return;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // void Destructor() -
- // A Destructor for a Receiver-Navigator instance.
- //
- // Input:
- // None.
- //
- // Output:
- // None. The Navigator's structures destroyed.
- //
- // Remarks:
- // This method destructs an existing instance of the Receiver-Navigator.
- static void Destructor()
- {
- dbg_printf(("Receiver_Destructor()n"));
- return;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Event Handlers
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // void OnVolumeSet(void* Param) -
- // Handles an IE_CORE_AMPLIFIER_VOLUME Event.
- //
- // Input:
- // None
- //
- // Output:
- // None.
- //
- // Remarks:
- void OnVolumeSet(void* Param)
- {
- UINT16 channel, level;
- channel =((UINT32)Param &0xf000)>>12;
- level = (UINT32)Param & 0xffff;
- volume_set(channel, level);
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // void OnLimiterRateSet(void* Param) -
- // Handles an IE_CORE_AMPLIFIER_LIMITER_RATE Event.
- //
- // Input:
- // Param
- //
- // Output:
- // None.
- //
- // Remarks:
- void OnLimiterRateSet(void* Param)
- {
- UINT16 limiter, type, level;
- limiter = ((UINT32)Param >> 24) & 0xff;
- type = ((UINT32)Param >> 16) & 0xff;
- level = (UINT32)Param & 0xffff;
- limiter_rate_set(limiter, type, level);
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // void OnLimiterThresholdSet(void* Param) -
- // Handles an IE_CORE_AMPLIFIER_THRESHOLD Event.
- //
- // Input:
- // Param:
- //
- // Output:
- // None.
- //
- // Remarks:
- void OnLimiterThresholdSet(void* Param)
- {
- UINT16 limiter, type, level;
- limiter = ((UINT32)Param >> 24) & 0xff;
- type = ((UINT32)Param >> 16) & 0xff;
- level = (UINT32)Param & 0xffff;
- limiter_threshold_set(limiter, type, level);
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // void OnTick() -
- // Handles an IE_CORE_TICK_200 Event.
- //
- // Input:
- // None
- //
- // Output:
- // None.
- //
- // Remarks:
- static void OnTick()
- {
- #ifdef HEADPHONE_ENABLE
- if (Is_Headphone_Active())
- HeadphoneActiveTime++;
- else
- if (0 < HeadphoneActiveTime)
- HeadphoneActiveTime--;
- if (HEADPHONE_ACTIVE_THRESHOLD <= HeadphoneActiveTime)
- {
- HeadphoneActiveTime = HEADPHONE_ACTIVE_THRESHOLD;
- DEC_Amplifier_Mute(TRUE);
- }
- else
- if (0 == HeadphoneActiveTime)
- DEC_Amplifier_Mute(FALSE);
- #endif
- return;
- }
- #ifdef _DEBUG
- static void OnStatusReport()
- {
- return;
- }
- #endif //_DEBUG
-
- #endif
-