qcc51xx如何配置spdif输入

 qcc51xx如何配置spdif输入

/*
Copyright (c) 2005 - 2018 Qualcomm Technologies International, Ltd.
*/
/**
\file
\ingroup sink_app
\brief
    This file handles all Synchronous connection messages
 
*/
 
 
/****************************************************************************
    Header files
*/
#ifdef ENABLE_GAA
#include <sink2gaa.h>
#endif /* ENABLE_GAA */
#include "sink_private_data.h"
#include "sink_main_task.h"
#include "sink_audio.h"
#include "sink_hfp_data.h"
#include "sink_statemanager.h"
#include "sink_powermanager.h"
#include "sink_pio.h"
#include "sink_link_policy.h"
#include "sink_tones.h"
#include "sink_volume.h"
#include "sink_speech_recognition.h"
#include "sink_wired.h"
#include "sink_display.h"
#include "sink_audio_routing.h"
#include "sink_peer.h"
#include "sink_swat.h"
#include "sink_ba.h"
#include "sink_ba_broadcaster.h"
#include "sink_ble.h"
#include "sink_callmanager.h"
#include "sink_malloc_debug.h"
#include "sink_usb.h"
 
#include <audio_plugin_voice_variants.h>
#include <audio_plugin_output_variants.h>
#include <connection.h>
#include <hfp.h>
#include <stdlib.h>
#include <audio.h>
#include <audio_plugin_if.h>
#include <sink.h>
#include <bdaddr.h>
#include <inquiry.h>
#include "sink_sc.h"
#include "sink_gaia.h"
 
/* Audio params used for second SCO */
const hfp_audio_params multipoint_params = {8000, 7, sync_air_coding_cvsd, sync_retx_power_usage};
 
#define ALLOWANCE_FOR_TRANSITION_IN_HFP_CALL_STATE        1000
 
#ifdef DEBUG_AUDIO
 
#define AUD_DEBUG(x) DEBUG(x)
#else
#define AUD_DEBUG(x)
#endif
 
/****************************************************************************
NAME
    audioPriorLatency
 
DESCRIPTION
    Return initial latency estimate for given endpoint codec
 
RETURNS
    Predicted latency in milliseconds
*/
uint16 audioPriorLatency(uint8 seid)
{
 
    uint16 latency_ms;
 
#if defined ENABLE_PEER && defined PEER_TWS
    if (peerIsThisDeviceTwsSlave())
    {
 
        /* TWS Master will send time-to-play values when it relays, hence target latency on slave should be zero */
        latency_ms = AUDIO_LATENCY_TWS_NULL;
    }
    else
#endif /* defined ENABLE_PEER && defined PEER_TWS */
    {
 
        switch (seid & BASE_SEID_MASK)
        {
 
        case FASTSTREAM_SEID:
        case APTX_SPRINT_SEID:
        case APTX_LL_SEID:
            latency_ms = AUDIO_LATENCY_SHORT_MS;
            break;
 
        case APTXHD_SEID:
            latency_ms = AUDIO_LATENCY_LONG_MS;
            break;
 
        case AAC_SEID:
            /* Use the same latency for AAC regardless of whether we are in TWS or non-TWS use case
              * This will only work if the AAC decoder is capable of latency this high in non-TWS cases
              */
            latency_ms = AUDIO_LATENCY_AAC_MS;
            break;
 
        case APTX_SEID:
            latency_ms = AUDIO_LATENCY_APTX_MS;
            break;
 
        case SBC_SEID:
            latency_ms = AUDIO_LATENCY_SBC_MS;
            break;
 
        case MP3_SEID:
            latency_ms = AUDIO_LATENCY_MP3_MS;
            break;
 
        default:
            latency_ms = AUDIO_LATENCY_NORMAL_MS;
            break;
        }
    }
 
    AUD_DEBUG(("AUD: seid=%u latency=%u\n", seid, latency_ms));
    return latency_ms;
}
/****************************************************************************
NAME
    getScoPriorityFromHfpPriority
 
DESCRIPTION
    obtain the current sco priority level of the AG priority passed in
 
RETURNS
    current sco priority level, if any, may not have a sco
*/
audio_priority getScoPriorityFromHfpPriority(hfp_link_priority priority)
{
 
    AUD_DEBUG(("AUD: GetScoPriority - %d=%d\n",priority,sinkHfpDataGetScoPriority(PROFILE_INDEX(OTHER_PROFILE(priority))))) ;
    return sinkHfpDataGetScoPriority(PROFILE_INDEX(OTHER_PROFILE(priority)));
}
 
/****************************************************************************
NAME
    setScoPriorityFromHfpPriority
 
DESCRIPTION
    sets the current sco priority level of the AG priority passed in
 
RETURNS
    nothing
*/
void setScoPriorityFromHfpPriority(hfp_link_priority priority, audio_priority level)
{
 
    AUD_DEBUG(("AUD: SetScoPriority - %d=%d\n",priority,level)) ;
    if(priority != hfp_invalid_link)
      sinkHfpDataSetScoPriority(level,PROFILE_INDEX(OTHER_PROFILE(priority)));
}
 
 
/****************************************************************************
NAME
    audioGetLinkPriority
 
DESCRIPTION
    Common method of getting the link we want to manipulate audio settings on
 
RETURNS
 
*/
hfp_link_priority audioGetLinkPriority ( bool audio )
{
 
    hfp_link_priority priority;
 
    /* See if we can get a link from the device audio sink... */
    priority = HfpLinkPriorityFromAudioSink(sinkAudioGetRoutedVoiceSink());
 
    /* if the call is in outgoing call state */
    if(!priority)
        priority = HfpLinkPriorityFromCallState(hfp_call_state_outgoing);
 
    /* If that fails see if we have an active call... */
    if(priority == hfp_invalid_link)
        priority = HfpLinkPriorityWithActiveCall(audio);
 
    /* if there is an incoming call [get first incoming] */
    if(priority == hfp_invalid_link)
        priority = HfpGetFirstIncomingCallPriority();
 
    /* If we got something return it, otherwise return primary link */
    return ((priority != hfp_invalid_link) ? priority : hfp_primary_link);
}
 
/****************************************************************************
NAME
    audioSwapMediaChannel
 
DESCRIPTION
    attempt to swap between media channels if two channels exist and one of them
    is currentyl being routed to the speaker.
RETURNS
    successful or not status
*/
bool audioSwapMediaChannel(void)
{
 
    a2dp_stream_state a2dpStatePri = a2dp_stream_idle;
    a2dp_stream_state a2dpStateSec = a2dp_stream_idle;
    Sink a2dpSinkPri = 0;
    Sink a2dpSinkSec = 0;
 
    /* if a2dp connected obtain the current streaming state for primary a2dp connection */
    getA2dpStreamData(a2dp_primary, &a2dpSinkPri, &a2dpStatePri);
 
    /* if a2dp connected obtain the current streaming state for secondary a2dp connection */
    getA2dpStreamData(a2dp_secondary, &a2dpSinkSec, &a2dpStateSec);
 
    /* check whether a2dp pri is currently being routed and a2dp sec is available */
    if((sinkAudioGetRoutedAudioSink() == a2dpSinkPri)&&(a2dpSinkSec)&&(a2dpStateSec == a2dp_stream_streaming))
    {
 
        /* swap to a2dp secondary */
        audioDisconnectRoutedAudio();
        audioRouteSpecificA2dpSource(audio_source_a2dp_2);
        return TRUE;
    }
    /* check whether a2dp sec is currently being routed and swap to a2dp pri */
    else if((sinkAudioGetRoutedAudioSink() == a2dpSinkSec)&&(a2dpSinkPri)&&(a2dpStatePri == a2dp_stream_streaming))
    {
 
        audioDisconnectRoutedAudio();
        audioRouteSpecificA2dpSource(audio_source_a2dp_1);
        return TRUE;
    }
    /* not possible to swap media channels */
    return FALSE;
}
 
/****************************************************************************
NAME
    audioShutDownForUpgrade
 
DESCRIPTION
    Disconnects any routed voice/audio sources and once the audio busy 
    pointer is cleared, messages sink_upgrade to proceed
 
RETURNS
    void
*/
void audioShutDownForUpgrade(Task task, MessageId id)
{
 
    audioDisconnectRoutedVoice();
    audioSuspendDisconnectAudioSource();
 
    MessageSendConditionallyOnTask(task, id, NULL, AudioBusyPtr());
}
 
/****************************************************************************
NAME
    audioGetSettings
 

                
  • 12
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
qcc51xx代码流程是指Qualcomm公司推出的一款芯片的软件编程流程,主要用于嵌入式系统的开发。以下是对qcc51xx代码流程的300字回答: qcc51xx芯片的代码流程主要包括硬件初始化、操作系统启动、应用程序加载和执行等几个关键步骤。 首先是硬件初始化,该步骤主要包括对qcc51xx芯片内部外设的初始化,例如GPIO、UART、SPI等外设的配置和初始化,以及时钟和电源管理等设置。这些初始化操作主要是为了保证后续的软件运行能够正常和稳定地使用硬件资源。 接下来是操作系统启动,qcc51xx芯片支持多种操作系统,如Linux、Android等。在操作系统启动过程中,会进行内存的分配和初始化、中断和定时器的初始化、设备驱动程序的注册等操作。这样才能够正常启动操作系统,并为后续的应用程序执行提供必要的基础设施。 然后是应用程序加载和执行,qcc51xx芯片上的应用程序主要由用户程序和驱动程序组成。用户程序是运行在操作系统上的具体功能实现,而驱动程序则是为硬件设备提供控制和数据传输等功能。操作系统会根据用户程序的调度和请求,加载相应的应用程序,并执行相应的操作。应用程序的执行过程中,还需要处理系统调用、中断处理、任务切换等操作。 总的来说,qcc51xx代码流程主要包括硬件初始化、操作系统启动和应用程序加载和执行几个关键步骤。通过这些步骤,qcc51xx芯片的软件能够正常地运行和提供所需的功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值