📄 cdr12aud.c
字号:
/* == IDENTIFICATION ================================================== * * Copyright (C) 2006, Philips Semiconductors Nuernberg * * System : Vega Family * Component : PT & FT * Layer : DRIVER * Process : Audio Driver * Module : cdr12aud.c * * @(#) %filespec: cdr12aud.c-5 % * *//* == HISTORY ========================================================= *//* * Name Date Ver Action * ------------------------------------------------------------------- * tcmc_hyu 24-Feb-2006 5 add bsd09cnf.h for FT * tcmc_asb 20-Feb-2006 4 p_dr12_Mute/Unmute for ISET_OVERLAY * tcmc_asb 20-Feb-2006 2-3 critical section p_dr12_SetDSPValue * tcmc_asb 16-Jan-2006 1 created */#define cdr12aud_c/* == GLOBAL DECLARATIONS ======================================= */#include "cda00api.h"#ifdef PT_MODULE#include "hsd02eep.h"#else#include "bsd09cnf.h"#include "bsd02eep.h"#endif#include "cdr03eep.h"#include "cdr02aud.h"#if defined (DSP_USE_ISET_OVERLAY)/* FUNCTIONAL DESCRIPTION: * * Set DSP value, if instance is valid. * Anyway, add resp. update entry in Set Value Cache * * PARAMETERS * u16_Inst DSP instance identifier (ARM or R.E.A.L located) * with FLC: unit + member, known from flow preparation * w/o FLC: predefined number, e.g. DSP_TOG1 * u16_Off parameter of instance (by _OFFS_ definition) * value new value for the parameter * returns 0 ok * <0 error, see p_da_SetDSPValue * -1 if overflow in Set Value Cache * * INTERFACE DECLARATION: */s32 p_dr12_SetDSPValue(u32 u16_Inst, u32 u16_Off, s32 s32_Value){ u32 criticalIrqs; s32 res; res= 0; criticalIrqs= p_sys5_DisaIrqIcuMask(DA_IRQS); if (p_da_InstanceValid(u16_Inst) >= 0) { res= p_da_SetDSPValue(u16_Inst, u16_Off, s32_Value); } p_sys5_EnaIrqIcuMask(criticalIrqs); if (u16_Inst & DSP_INSTANCE_ARM) { // Overlay for ARM DSP only #define DR12_IO(x) (G_st_dr02_SVC[x].inst<<16 | G_st_dr02_SVC[x].off) if (res >= 0) { // add to cache or update u32 first= 0, last= G_u16_dr02_NumOfSVC-1, io= u16_Inst <<16 | (u16)u16_Off; s32 where; if (G_u16_dr02_NumOfSVC==0) { where= -1; } else { for (;;) { if (first+1 >= last) { // max 2 left if (DR12_IO(last) == io) { where= last; // found: last } else if (DR12_IO(last) < io) { where= -last -2; // insert behind last } else if (DR12_IO(first) == io) { where= first; // found: first } else if (DR12_IO(first) < io) { where= -first -2; // insert behind first } else { where= -first -1; // insert before first } break; } else { where= (first + last) / 2; if (DR12_IO(where) == io) { break; } else if (DR12_IO(where) < io) { first= where+1; } else { last= where-1; } } } } if (where < 0) // insert new cache element { if (G_u16_dr02_NumOfSVC < DR02_MAX_SVC) { where= -where; memmove(G_st_dr02_SVC + where , G_st_dr02_SVC + where - 1 , (sizeof G_st_dr02_SVC[0]) * (G_u16_dr02_NumOfSVC - where + 1) ); G_u16_dr02_NumOfSVC++; where--; G_st_dr02_SVC[where].off= (u16)io; G_st_dr02_SVC[where].inst= io>>16; } else { // cache ovfl res= -1; } } if (res >= 0) // update cached value { G_st_dr02_SVC[where].val= (u32)s32_Value; } } #undef DR12_IO } return res;}/* FUNCTIONAL DESCRIPTION: * * Apply settings from Set Value Cache, for valid instances * * PARAMETERS * * RETURNS * * INTERFACE DECLARATION: */void p_dr12_RestoreDSPValues(void){ u32 i; for (i= 0; i<G_u16_dr02_NumOfSVC; i++) { t_dr02_svc *pst= G_st_dr02_SVC + i; if (p_da_InstanceValid(pst->inst) >= 0) { p_da_SetDSPValue (pst->inst, pst->off, pst->val); } }}/* FUNCTIONAL DESCRIPTION: * * Starts fade-out of Adpcm output. * * PARAMETER: * u16_Instance ADPCM decoder instance * * INTERFACE DECLARATION: ****************************************************/s32 p_dr12_MuteAdpcmDec(u32 u16_Inst){ s32 res; res= p_dr12_SetDSPValue(u16_Inst, DSP_ADDR_OFFS_DAD_SMUm, 0); return res;}/* FUNCTIONAL DESCRIPTION: * * Starts fade-in of Adpcm output. * * PARAMETER: * u16_Instance ADPCM decoder instance * * INTERFACE DECLARATION: ****************************************************/s32 p_dr12_UnmuteAdpcmDec(u32 u16_Inst){ s32 res; res= p_dr12_SetDSPValue(u16_Inst, DSP_ADDR_OFFS_DAD_SMUm, -1); return res;}#endif // DSP_USE_ISET_OVERLAY/* FUNCTIONAL DESCRIPTION: * * Apply DSP Patches stored in EEPROM, SD02_DSP_PATCH area. * * INTERFACE DECLARATION: */void p_dr12_DSPPatch(void){ /* Allow setting DSP parameters with settings stored in the EEPROM * DSP patch area size is SD02_DSP_PATCH_LEN * 6 byte patch structure (new since VDSW340, Jan.2006) * empty patches show 0xFFFF as instance parameter */ u32 eeOff; for (eeOff= SD02_DSP_PATCH; eeOff <= SD02_DSP_PATCH_LEN - sizeof (t_dr02_DSPPatch); eeOff += sizeof (t_dr02_DSPPatch)) { t_dr02_DSPPatch dspPatch; p_dr13_EEPROMReadBytes(&dspPatch, eeOff, sizeof (t_dr02_DSPPatch)); if (dspPatch.inst != 0xFFFF) { p_dr12_SetDSPValue(dspPatch.inst, dspPatch.off, dspPatch.val); } }}//eof
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -