示例#1
0
////////////////////////////////////////////////////
// 功能: 延迟N个豪秒
// 输入: 
// 输出:
// 返回: 
// 说明: 
////////////////////////////////////////////////////
static void dma_init(unsigned int channel, char mode)
{
	unsigned int group, data;
#ifdef KPRINTF_DEF
	kprintf("dma init channle = %d\n",channel);
#endif
	group = channel / HALF_DMA_NUM;

	SETREG32(A_DMA_DMAC(group), (DMAC_DMA_EN | DMAC_FAST_AIC) );
	SETREG32(A_DMA_DCKE(group), (1 << (channel  - group * HALF_DMA_NUM)) );

	OUTREG32(A_DMA_DCS(channel), DCS_NDES );
	if (mode)
	{
		data = DCM_SAI | DCM_SP_32BIT | DCM_DP_16BIT | DCM_TSZ_16BYTE | DCM_RDIL_IGN | DCM_TRANS_INTR_EN;
		OUTREG32(A_DMA_DCM(channel), data);
		OUTREG32(A_DMA_DRT(channel), DRT_AIC_TX);
	}
	else
	{
		data = DCM_DAI | DCM_SP_16BIT | DCM_DP_32BIT | DCM_TSZ_16BYTE | DCM_RDIL_IGN;
		OUTREG32(A_DMA_DCM(channel), data);
		OUTREG32(A_DMA_DRT(channel), DRT_AIC_RX);
	}
}
示例#2
0
void dma_nowait_cpyinit()
{
	CLRREG32(A_CPM_CLKGR, ( 1 << 12 ));
	SETREG32(A_DMA_DMAC(DMA_CPY_CHANNEL / 6),DMAC_DMA_EN);
	
	OUTREG32(A_DMA_DCKE(DMA_CPY_CHANNEL / 6),(1 << (DMA_CPY_CHANNEL % 6)));//Open channel clock
	CLRREG32(A_DMA_DMAC(DMA_CPY_CHANNEL / 6), (DMAC_HALT | DMAC_ADDR_ERR));//Ensure DMAC.AR = 0,DMAC.HLT = 0
	CLRREG32(A_DMA_DCS(DMA_CPY_CHANNEL), DCS_AR | DCS_HLT | DCS_TT | DCS_INV); // Ensure DCSn.AR = 0, DCSn.HLT = 0, DCSn.TT = 0, DCSn.INV = 0

	OUTREG32(A_DMA_DTC(DMA_CPY_CHANNEL), 0);//DTCn = 0
	CLRREG32(A_DMA_DCS(DMA_CPY_CHANNEL), DCS_CTE);
	SETREG32(A_DMA_DCS(DMA_CPY_CHANNEL), DCS_NDES);
}
示例#3
0
void yuv_copy_nowait_init()
{
	int i;
	g_desc=(unsigned int*)(((unsigned int)(g_des_space)) | 0xa0000000);
	for(i = 0;i < 3;i++)
	{
		g_desc[i * 8 + 0] = (DES_DAI | DES_SAI | DES_SP_32BIT | DES_DP_32BIT | DES_TSZ_32BIT | DCD_STRIDE_EN | DES_LINK_EN);
		g_desc[i * 8 + 5] = DRT_AUTO;
	}
	g_desc[(--i) * 8 + 0] &= ~(DES_LINK_EN);
			
	CLRREG32(A_CPM_CLKGR, ( 1 << 12 ));
	SETREG32(A_DMA_DMAC(DMA_STRIDE_CPY_CHANNEL / 6),DMAC_DMA_EN);
	
	OUTREG32(A_DMA_DCKE(DMA_STRIDE_CPY_CHANNEL / 6),(1 << (DMA_STRIDE_CPY_CHANNEL % 6)));//Open channel clock
	CLRREG32(A_DMA_DMAC(DMA_STRIDE_CPY_CHANNEL / 6), (DMAC_HALT | DMAC_ADDR_ERR));//Ensure DMAC.AR = 0,DMAC.HLT = 0
	CLRREG32(A_DMA_DCS(DMA_STRIDE_CPY_CHANNEL), DCS_AR | DCS_HLT | DCS_TT | DCS_INV); // Ensure DCSn.AR = 0, DCSn.HLT = 0, DCSn.TT = 0, DCSn.INV = 0

	OUTREG32(A_DMA_DTC(DMA_STRIDE_CPY_CHANNEL), 0);//DTCn = 0
	CLRREG32(A_DMA_DCS(DMA_STRIDE_CPY_CHANNEL), DCS_CTE);
	CLRREG32(A_DMA_DCS(DMA_STRIDE_CPY_CHANNEL), DCS_NDES);	
	SETREG32(A_DMA_DCS(DMA_STRIDE_CPY_CHANNEL), DCS_DES8);
		
}
示例#4
0
////////////////////////////////////////////////////
// 功能: 读取DMA状态
// 输入: 
// 输出:
// 返回: 
// 说明: 
////////////////////////////////////////////////////
void GetDmaInfo()
{
	unsigned int channel;
	channel = PLAYBACK_CHANNEL;
	for(channel= 0; channel < 4 ; channel++)
	{
		kprintf("DMA CHANNEL = %d\n",channel);
		kprintf("status  = %x, count = %x\n",INREG32(A_DMA_DCM(channel)),INREG32(A_DMA_DTC(channel)));
		kprintf("control = %x,irq = %x\n",INREG32(A_DMA_DCS(channel)),INREG32(A_DMA_DIRQP(channel/6)));
		kprintf("source addr = %x, destion addr = %x\n",INREG32(A_DMA_DSA(channel)),INREG32(A_DMA_DTA(channel)));
		kprintf("DRT = %x, DMAC = %x, DCKE = %x\n",INREG32(A_DMA_DRT(channel)),INREG32(A_DMA_DMAC(0)),INREG32(A_DMA_DCKE(0)));
	}
	kprintf("\nDMA interrupt count = %d\n",interrupt_count);
	kprintf("aic register = %x\n",INREG32(A_CPM_CLKGR));
	kprintf("dma register = %x\n\n",INREG32(INTC_IMR));

	kprintf("======== aic status ========\n");
	kprintf("AIC I2S/MSB-justified Control Register I2SCR = %x\n",REG_AIC_I2SCR);
	kprintf("AIC Controller FIFO Status Register AICSR = %x\n",REG_AIC_SR);
	kprintf("AIC AC-link Status Register ACSR = %x\n",REG_AIC_ACSR);
	kprintf("AIC I2S/MSB-justified Status Register I2SSR = %x\n\n",REG_AIC_I2SSR);

	kprintf("======== codec status ========\n");
	kprintf("Audio Interface Control, Software Write = %x\n",codec_reg_read(A_CODEC_AICR));
	kprintf("Control Register 1 = %x\n",codec_reg_read(A_CODEC_CR1));
	kprintf("Control Register 2 = %x\n",codec_reg_read(A_CODEC_CR2));
	kprintf("Control Clock Register 1 = %x\n",codec_reg_read(A_CODEC_CCR1));
	kprintf("Control Clock Register 2 = %x\n",codec_reg_read(A_CODEC_CCR2));
	kprintf("Power Mode Register 1 = %x\n",codec_reg_read(A_CODEC_PMR1));
	kprintf("Power Mode Register 2 = %x\n",codec_reg_read(A_CODEC_PMR2));
	kprintf("Control Ramp Register = %x\n",codec_reg_read(A_CODEC_CRR));
	kprintf("Interrupt Control Register = %x\n",codec_reg_read(A_CODEC_ICR));
	kprintf("Interrupt Flag Register = %x\n",codec_reg_read(A_CODEC_IFR));
	kprintf("Control Gain Register 1 = %x\n",codec_reg_read(A_CODEC_CGR1));
	kprintf("Control Gain Register 2 = %x\n",codec_reg_read(A_CODEC_CGR2));
	kprintf("Control Gain Register 3 = %x\n",codec_reg_read(A_CODEC_CGR3));
	kprintf("Control Gain Register 4 = %x\n",codec_reg_read(A_CODEC_CGR4));
	kprintf("Control Gain Register 5 = %x\n",codec_reg_read(A_CODEC_CGR5));
	kprintf("Control Gain Register 6 = %x\n",codec_reg_read(A_CODEC_CGR6));
	kprintf("Control Gain Register 7 = %x\n",codec_reg_read(A_CODEC_CGR7));
	kprintf("Control Gain Register 8 = %x\n",codec_reg_read(A_CODEC_CGR8));
	kprintf("Control Gain Register 9 = %x\n",codec_reg_read(A_CODEC_CGR9));
	kprintf("Control Gain Register 10 = %x\n",codec_reg_read(A_CODEC_CGR10));
}