Пример #1
0
/*
 @ Function:
 * clear the data beyond the specified memory bound of the memory pool
 *
 @ Agruments:
 * preserved size of memory (unsigned long long)
 *
 @ Return:
 * NULL
 *
 @ Basic Algorithm:
 * reset to be "0" within the specified bound of memory
 * free the memory blocks beyond the bound
 */
void MemPool::Clear( ull_t ullPreservedSize ) {

    /* always preserve the first block in memory pool */
    ull_t ullCurSz = mpstMemBlocks[0]->ullMemSize;
    ClearMemBlock( mpstMemBlocks[0] );
    ull_t ullIdx = 1;
    /* continue to clear memory block until the size of clean memory is not less than that requested */
    while( ullIdx < ullMemBlockRightIndex && ullCurSz < ullPreservedSize ) {
        MemBlock* stMemBlock = mpstMemBlocks[ullIdx];
        ullCurSz += stMemBlock->ullMemSize;
        ClearMemBlock( stMemBlock );
        ++ullIdx;
    }
    /* free all the left memory blocks */
    for( int i=(int)ullIdx; i < ullMemBlockRightIndex; i++ ) {
        delete[] (unsigned char*)(mpstMemBlocks[i]->vdMem);
        delete mpstMemBlocks[i];
    }
    /* update using status of the memory pool */
    ullMemBlockNum = ullIdx;
    ullMemTotalSize = ullCurSz;
    ullMemUsedSize = 0;
    ullMemBlockLeftIndex = 0;
    ullMemBlockRightIndex = ullIdx;

}
static int mtk_pcm_dl1_stop(struct snd_pcm_substream *substream)
{
    printk("%s \n", __func__);

    SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, false);
    SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL1, false);

    // here start digital part
    SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I05, Soc_Aud_InterConnectionOutput_O03);
    SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I06, Soc_Aud_InterConnectionOutput_O04);

    ClearMemBlock(Soc_Aud_Digital_Block_MEM_DL1);
    return 0;
}
static int mtk_pcm_dl2_stop(struct snd_pcm_substream *substream)
{
	pr_warn("%s\n", __func__);
	SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL2, false);

	SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, 0);
	SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, false);

	/* here start digital part */
	SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I07,
		      Soc_Aud_InterConnectionOutput_O03);
	SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I08,
		      Soc_Aud_InterConnectionOutput_O04);

	ClearMemBlock(Soc_Aud_Digital_Block_MEM_DL2);
	return 0;
}
Пример #4
0
static int mtk_pcm_I2S0dl1_stop(struct snd_pcm_substream *substream)
{
    AFE_BLOCK_T *Afe_Block = &(pI2S0dl1MemControl->rBlock);

    pr_debug("%s \n", __func__);

    SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, false);
    SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL1, false);

    // here start digital part
    SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I05, Soc_Aud_InterConnectionOutput_O00);
    SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I06, Soc_Aud_InterConnectionOutput_O01);
    SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I05, Soc_Aud_InterConnectionOutput_O03);
    SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I06, Soc_Aud_InterConnectionOutput_O04);

    ClearMemBlock(Soc_Aud_Digital_Block_MEM_DL1);

    return 0;
}