亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hwctxt.cpp

?? 基于WINCE 的音頻驅(qū)動(dòng)源碼
?? CPP
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		StartOutputDMA()

Description:	Starts outputting the sound data to the audio codec
				chip via DMA.

Notes:			Currently, both playback and record share the same
				DMA channel.  Consequently, we can only start this
				operation if the input channel isn't using DMA.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
BOOL HardwareContext::StartOutputDMA()
{
	DEBUGMSG(ZONE_FUNCTION,(TEXT("+++StartOutputDMA\n")));
	
    if(!m_OutputDMARunning)
    {
        //----- 1. Initialize our buffer counters -----
        m_OutputDMARunning=TRUE;
        m_OutBytes[OUT_BUFFER_A]=m_OutBytes[OUT_BUFFER_B]=0;

        //----- 2. Prime the output buffer with sound data -----
		m_OutputDMAStatus = (DMA_DONEA | DMA_DONEB) & ~DMA_BIU;	
		ULONG OutputTransferred = TransferOutputBuffers(m_OutputDMAStatus);
        
		//----- 3. If we did transfer any data to the DMA buffers, go ahead and enable DMA -----
		if(OutputTransferred)
        {
			//----- 4. Configure the DMA channel for playback -----
			if(!InitOutputDMA())
			{
				DEBUGMSG(ZONE_ERROR, (TEXT("HardwareContext::StartOutputDMA() - Unable to initialize output DMA channel!\r\n")));
				goto START_ERROR;
			}
			////////////////////////////////////////////////////////////////////////////////
			// To correct left/right channel on ouput stream,
			// You should reset IISCON[0] bit.
			Lock();
			g_pIISregs->IISCON  &= ~IIS_INTERFACE_ENABLE;
			g_pIISregs->IISCON |= TRANSMIT_DMA_REQUEST_ENABLE;
			g_pIISregs->IISCON &= ~TRANSMIT_IDLE_CMD;
			g_pIISregs->IISFCON |= (  TRANSMIT_FIFO_ACCESS_DMA | TRANSMIT_FIFO_ENABLE  );
			g_pIISregs->IISMOD  |= IIS_TRANSMIT_MODE;
			//----- 5. Make sure the audio isn't muted -----
			AudioMute(DMA_CH_OUT, FALSE);					

			//----- 6. Start the DMA controller -----
			AUDIO_RESET_PLAYBACK_POINTER();
			SELECT_AUDIO_DMA_OUTPUT_BUFFER_A();
			Codec_channel();								// Turn ON output channel
			// charlie, start A buffer
			AUDIO_OUT_DMA_ENABLE();
	        // wait for DMA to start.
	        while((g_pDMAregs->DSTAT2&0xfffff)==0);        
			// check if tx fifo data is ready
			while ( !(g_pIISregs->IISCON & (1<<7)) ) ;

			g_pIISregs->IISCON  |= IIS_INTERFACE_ENABLE;
			Unlock();
			////////////////////////////////////////////////////////////////////////////////
	        // change the buffer pointer
	        SELECT_AUDIO_DMA_OUTPUT_BUFFER_B();
	        // Set DMA for B Buffer
        }
        else    // We didn't transfer any data, so DMA wasn't enabled
        {
            m_OutputDMARunning=FALSE;
        }
    }
    
    DEBUGMSG(ZONE_FUNCTION,(TEXT("---StartOutputDMA\n")));

	return TRUE;

START_ERROR:
	return FALSE;
}

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		StopOutputDMA()

Description:	Stops any DMA activity on the output channel.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
void HardwareContext::StopOutputDMA()
{
	//----- 1. If the output DMA is running, stop it -----
    if (m_OutputDMARunning)
	{
		m_OutputDMAStatus = DMA_CLEAR;				
		AUDIO_OUT_DMA_DISABLE();
		AUDIO_OUT_CLEAR_INTERRUPTS();
		while(g_pIISregs->IISCON & (1<<7)); // wait for tx fifo empty
		g_pIISregs->IISCON &= ~TRANSMIT_DMA_REQUEST_ENABLE;
		g_pIISregs->IISCON |= TRANSMIT_IDLE_CMD;
		g_pIISregs->IISFCON &= ~(  TRANSMIT_FIFO_ACCESS_DMA | TRANSMIT_FIFO_ENABLE  );
		g_pIISregs->IISMOD  &= ~IIS_TRANSMIT_MODE;
		AudioMute(DMA_CH_OUT, TRUE);		
    }

	m_OutputDMARunning = FALSE;
	Codec_channel();
}


/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		InitInputDMA()

Description:	Initializes the DMA channel for input.

Notes:			***** NOT IMPLEMENTED *****

				The following routine is not implemented due to a
				hardware bug in the revision of the Samsung SC2440
				CPU this driver was developed on.  See the header
				at the top of this file for details.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
BOOL HardwareContext::InitInputDMA()
{

	DEBUGMSG(ZONE_FUNCTION,(TEXT("+++InitInputDMA\n")));

    if (!g_PhysDMABufferAddr.LowPart)
    {
        DEBUGMSG(TRUE, (TEXT("ERROR:HardwareContext::InitInputDMA: Invalid DMA buffer physical address.\r\n")));
        return(FALSE);
    }

	//============================ Configure DMA Channel 1 ===========================
	//------ On platforms with the revsion of the Samsung SC2440 CPU with the IIS SLAVE bug fix, this -----
	//		 code can be used to configure DMA channel 1 for input.

	//----- 1. Initialize the DMA channel for input mode and use the first input DMA buffer -----
	g_pDMAregs->DISRC1	= (int)(S3C2440A_BASE_REG_PA_IISBUS+0x10);
	g_pDMAregs->DISRCC1 = (SOURCE_PERIPHERAL_BUS | FIXED_SOURCE_ADDRESS);				// Source is periperal bus, fixed addr
    
    //----- 2. Initialize the DMA channel to receive data over the I2S bus -----
    g_pDMAregs->DIDST1	= (int)(g_PhysDMABufferAddr.LowPart); 
    g_pDMAregs->DIDSTC1 &= ~(DESTINATION_PERIPHERAL_BUS | FIXED_DESTINATION_ADDRESS);	// Destination is system bus, increment addr

	//----- 3. Configure the DMA channel's transfer characteristics: handshake, sync PCLK, interrupt, -----
	//		   single tx, single service, I2SSDI, I2S request, no auto-reload, half-word, tx count
	g_pDMAregs->DCON1	= (  HANDSHAKE_MODE | GENERATE_INTERRUPT | I2SSDI_DMA1 | DMA_TRIGGERED_BY_HARDWARE 
                           | TRANSFER_HALF_WORD | (AUDIO_DMA_PAGE_SIZE / 2)
                            );
	return(TRUE);
}


/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		StartInputDMA()

Description:	Starts inputting the recorded sound data from the 
				audio codec chip via DMA.

Notes:			***** NOT IMPLEMENTED *****

				The following routine is not implemented due to a
				hardware bug in the revision of the Samsung SC2440
				CPU this driver was developed on.  See the header
				at the top of this file for details.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
BOOL HardwareContext::StartInputDMA()
{
	
	//------ On platforms with the revsion of the Samsung SC2440 CPU with the IIS SLAVE bug fix, this -----
	//		 code can be used to configure DMA channel 1 for input.

	DEBUGMSG(ZONE_FUNCTION,(TEXT("+++StartInputDMA\n")));

	if(!m_InputDMARunning)
    {
        //----- 1. Initialize our buffer counters -----
        m_InputDMARunning=TRUE;
		Codec_channel();        // Turn On Input channel
        m_InBytes[IN_BUFFER_A]=m_InBytes[IN_BUFFER_B]=0;

        //----- 2. Prime the output buffer with sound data -----
		m_InputDMAStatus = (DMA_DONEA | DMA_DONEB) & ~DMA_BIU;	

		//----- 3. Configure the DMA channel for record -----
		if(!InitInputDMA())
		{
			DEBUGMSG(ZONE_ERROR, (TEXT("HardwareContext::StartInputDMA() - Unable to initialize input DMA channel!\r\n")));
			goto START_ERROR;
		}
		g_pIISregs->IISFCON |= (RECEIVE_FIFO_ACCESS_DMA  | RECEIVE_FIFO_ENABLE);
		g_pIISregs->IISCON  |= RECEIVE_DMA_REQUEST_ENABLE;	 
		g_pIISregs->IISMOD  |= IIS_RECEIVE_MODE;
	
		//----- 4. Make sure the audio isn't muted -----
		AudioMute(DMA_CH_MIC, FALSE);					

		//----- 5. Start the input DMA -----
		AUDIO_RESET_RECORD_POINTER();
		SELECT_AUDIO_DMA_INPUT_BUFFER_A();

		Codec_channel();        // Turn On Input channel
		g_pDMAregs->DMASKTRIG1 = ENABLE_DMA_CHANNEL;		
		
        // wait for DMA to start.
        while((g_pDMAregs->DSTAT1&0xfffff)==0);        
        // change the buffer pointer
        SELECT_AUDIO_DMA_INPUT_BUFFER_B();
				
    }
    DEBUGMSG(ZONE_FUNCTION,(TEXT("---StartInputDMA\n")));
	return(TRUE);

START_ERROR:
	return(FALSE);
}


/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		StopInputDMA()

Description:	Stops any DMA activity on the input channel.

Notes:			***** NOT IMPLEMENTED *****

				The following routine is not implemented due to a
				hardware bug in the revision of the Samsung SC2440
				CPU this driver was developed on.  See the header
				at the top of this file for details.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
void HardwareContext::StopInputDMA()
{

	//------ On platforms with the revsion of the Samsung SC2440 CPU with the IIS SLAVE bug fix, this -----
	//		 code can be used to configure DMA channel 1 for input.

	//----- 1. If the output DMA is running, stop it -----
    if (m_InputDMARunning)
	{
		m_InputDMAStatus = DMA_CLEAR;				
		
		g_pIISregs->IISCON &= ~RECEIVE_DMA_REQUEST_ENABLE;
		g_pIISregs->IISFCON &= ~(RECEIVE_FIFO_ACCESS_DMA  | RECEIVE_FIFO_ENABLE);
		g_pDMAregs->DMASKTRIG1 |= STOP_DMA_TRANSFER;
		g_pDMAregs->DMASKTRIG1 &= ~ENABLE_DMA_CHANNEL;
		g_pIISregs->IISMOD  &= ~IIS_RECEIVE_MODE;
		AUDIO_IN_CLEAR_INTERRUPTS();
		AudioMute(DMA_CH_MIC, TRUE);		
    }

	m_InputDMARunning = FALSE;
	Codec_channel();
}


DWORD HardwareContext::GetInterruptThreadPriority()
{
    HKEY hDevKey;
    DWORD dwValType;
    DWORD dwValLen;
    DWORD dwPrio = 249; // Default priority

    hDevKey = OpenDeviceKey((LPWSTR)m_DriverIndex);
    if (hDevKey)
    {
        dwValLen = sizeof(DWORD);
        RegQueryValueEx(
            hDevKey,
            TEXT("Priority256"),
            NULL,
            &dwValType,
            (PUCHAR)&dwPrio,
            &dwValLen);
        RegCloseKey(hDevKey);
    }

    return dwPrio;
}



/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		InitInterruptThread()

Description:	Initializes the IST for handling DMA interrupts.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
BOOL HardwareContext::InitInterruptThread()
{
    m_hAudioInterrupt = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!m_hAudioInterrupt)
    {
        ERRMSG("Unable to create interrupt event");
        return(FALSE);
    }

    if (! InterruptInitialize(m_dwSysintrOutput, m_hAudioInterrupt, NULL, 0)) {
        ERRMSG("Unable to initialize output interrupt");
        return FALSE;
    }
    if (! InterruptInitialize(m_dwSysintrInput, m_hAudioInterrupt, NULL, 0)) {
        ERRMSG("Unable to initialize input interrupt");
        return FALSE;
    }

    m_hAudioInterruptThread  = CreateThread((LPSECURITY_ATTRIBUTES)NULL,
                                            0,
                                            (LPTHREAD_START_ROUTINE)CallInterruptThread,
                                            this,
                                            0,
                                            NULL);
    if (!m_hAudioInterruptThread)
    {
        ERRMSG("Unable to create interrupt thread");
        return FALSE;
    }

    // Bump up the priority since the interrupt must be serviced immediately.
	CeSetThreadPriority(m_hAudioInterruptThread, GetInterruptThreadPriority());

    return(TRUE);
}


/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:		PowerUp()

Description:	Powers up the audio codec chip.

Notes:			Currently, this function is unimplemented because
				the audio codec chip is ONLY powered up when the 
				user wishes to play or record.  The AudioMute() function
				handles the powerup sequence.

Returns:		Boolean indicating success
-------------------------------------------------------------------*/
void HardwareContext::PowerUp()
{
//    SPI_Init();
    I2S_Init();
}

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲生活片亚洲生活在线观看| 欧美mv和日韩mv的网站| 欧美日韩久久久| 日本一区二区三区国色天香| 亚洲永久精品国产| 国产a视频精品免费观看| 4438x成人网最大色成网站| 自拍偷拍国产亚洲| 国产伦精品一区二区三区免费迷| 欧美精选午夜久久久乱码6080| 日本一区二区三区在线不卡| 激情综合网av| 制服丝袜日韩国产| 亚洲已满18点击进入久久| 国产精品一区在线| 日韩欧美国产1| 免费观看日韩av| 欧美高清精品3d| 亚洲一区二区三区在线播放| 99精品黄色片免费大全| 欧美国产日韩在线观看| 国产麻豆精品在线观看| 精品国产乱码久久久久久久| 看国产成人h片视频| 91精品国产乱| 日韩精品视频网站| 91精品欧美一区二区三区综合在| 亚洲成人久久影院| 欧美三级在线播放| 午夜欧美电影在线观看| 欧美人xxxx| 日本视频一区二区| 日韩区在线观看| 久久99精品国产麻豆不卡| 精品国产乱码久久久久久图片| 亚洲成a人v欧美综合天堂| 在线观看网站黄不卡| 一区二区三区在线影院| 欧美日韩在线三级| 日日嗨av一区二区三区四区| 51午夜精品国产| 黄色资源网久久资源365| 久久青草欧美一区二区三区| 粉嫩高潮美女一区二区三区| 国产精品美女久久久久久久久| 97精品久久久久中文字幕| 一区二区在线观看视频| 欧美群妇大交群中文字幕| 青青草97国产精品免费观看 | www.99精品| 国产精品美女一区二区三区| 91麻豆精品一区二区三区| 亚洲综合999| 日韩一区二区免费视频| 狠狠色丁香九九婷婷综合五月| 久久久www免费人成精品| 成人黄色小视频| 亚洲第一综合色| 久久综合视频网| 91一区二区在线观看| 亚洲国产乱码最新视频| 精品嫩草影院久久| 91热门视频在线观看| 图片区小说区国产精品视频| 日韩一区二区免费视频| 99久久国产综合色|国产精品| 午夜精品久久久久久久久| 久久综合色一综合色88| 91精品福利视频| 国产精品一区二区三区四区| 亚洲人成影院在线观看| 日韩欧美国产一区二区三区| 99热精品国产| 激情国产一区二区| 亚洲自拍偷拍av| 国产精品素人视频| 7777精品伊人久久久大香线蕉 | 色呦呦日韩精品| 黑人巨大精品欧美一区| 亚洲精品视频一区二区| 精品免费视频一区二区| 欧美在线色视频| 国产成人自拍网| 亚洲大片在线观看| 亚洲欧洲av一区二区三区久久| 欧美日韩视频在线一区二区| 成人性生交大片免费| 麻豆成人久久精品二区三区红 | 国产女主播视频一区二区| 精品嫩草影院久久| 精品视频一区三区九区| 成人一区二区三区中文字幕| 美国av一区二区| 午夜成人免费视频| 亚洲精品乱码久久久久久久久| 久久嫩草精品久久久精品一| 欧美一区二视频| 欧美综合一区二区三区| 99精品国产一区二区三区不卡| 国产精品一区一区| 久久不见久久见免费视频1 | 亚洲人成7777| 国产精品乱码一区二区三区软件 | 136国产福利精品导航| 欧美va在线播放| 欧美一区二区三区在线电影| 一本久久综合亚洲鲁鲁五月天| thepron国产精品| 国产精品2024| 国产电影精品久久禁18| 精品一区二区三区在线播放 | 91在线播放网址| 丁香激情综合国产| 国产成人在线网站| 成人综合婷婷国产精品久久蜜臀| 国产精品亚洲成人| 国产精品一区二区久久不卡| 国产一二三精品| 成人手机电影网| 99精品久久99久久久久| 一本一道波多野结衣一区二区| 色婷婷精品久久二区二区蜜臂av | 欧美一区二区三区喷汁尤物| 欧美一级黄色录像| 久久久精品一品道一区| 精品成人在线观看| 国产精品午夜春色av| 国产精品高清亚洲| 亚洲精品水蜜桃| 天天色综合成人网| 久久精品国产久精国产| 懂色av一区二区在线播放| 欧美日韩精品电影| 日韩欧美高清dvd碟片| 国产欧美综合色| 亚洲综合色自拍一区| 首页国产欧美久久| 国内精品免费在线观看| 成人性生交大片免费看中文网站| 91美女片黄在线观看| 在线电影一区二区三区| 久久你懂得1024| 亚洲尤物视频在线| 精彩视频一区二区三区| 不卡的av网站| 国产欧美一区二区三区在线看蜜臀| 欧美三级日韩在线| 一道本成人在线| 日韩女优电影在线观看| 亚洲欧洲精品天堂一级| 国产精品一区二区不卡| 国产欧美日韩三区| 91精品国产综合久久久久| 久久亚洲综合色一区二区三区| 中文字幕亚洲精品在线观看| 午夜精品一区二区三区免费视频| 国产麻豆精品theporn| 欧美性色aⅴ视频一区日韩精品| 日韩视频一区在线观看| 中文字幕中文字幕在线一区| 日韩国产欧美视频| 成人动漫av在线| 日韩午夜电影av| 亚洲免费高清视频在线| 青青草国产成人99久久| 色哟哟国产精品免费观看| 久久久美女毛片| 视频一区二区不卡| 99精品国产视频| 国产亚洲精品超碰| 免费美女久久99| 欧美午夜在线观看| 最新中文字幕一区二区三区| 极品少妇一区二区三区精品视频| 欧美三区在线观看| 一区二区中文视频| 国产成人精品一区二| 日韩欧美不卡一区| 性久久久久久久久| 色哟哟日韩精品| 国产精品欧美久久久久无广告 | 6080日韩午夜伦伦午夜伦| 亚洲人成网站影音先锋播放| 国产乱码字幕精品高清av | 午夜精品久久久久久久99水蜜桃 | 国产精品99久久久久久有的能看| 欧美精品久久久久久久久老牛影院| 亚洲欧洲成人av每日更新| 国产成人av影院| 欧美不卡一区二区| 日本一不卡视频| 91精品国产综合久久香蕉麻豆| 亚洲主播在线播放| 在线亚洲免费视频| 一区二区三区在线观看视频 | 亚洲综合色噜噜狠狠| 99精品视频在线观看| 国产精品伦一区二区三级视频| 国产成人综合视频| 国产精品国产馆在线真实露脸|