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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? audioinit.c

?? 基于實時嵌入式系統的voip系統(real time embeded system)。主要難點在實時處理語音信號。語音信號基于其自身特點
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************************  AudioInit.c - Initializes and changes configuration*        of CS4281 card for VxWorks.**  Author - Ed Hursey*  Date - December 2005**  Note - This file is based on the driver provided on the*    course web site.**************************************************************************//* VxWorks API includes */#include "vxWorks.h"#include "stdio.h"#include "stdlib.h"#include "ioLib.h"#include "semLib.h"#include "intLib.h"#include "iv.h"#include "voip.h"/* VxWorks 5.4 PCI driver interface includes */#include "drv/pci/pciConfigLib.h"#include "drv/pci/pciConfigShow.h"#include "drv/pci/pciHeaderDefs.h"#include "drv/pci/pciLocalBus.h"#include "drv/pci/pciIntLib.h"/* pcPentium BSP includes */#include "sysLib.h"/* Cystal cs4281 and ac97 hardware */#include "cs4281Registers.h"/* Local definition of CS4281 values */#define PCI_VENDOR_ID_CIRRUS         0X1013#define PCI_DEVICE_ID_CRYSTAL_CS4281 0X6005#define CS4281_pBA0       0x04000000   /*DMA locations*/#define CS4281_pBA1       0x05000000#define INT_NUM_IRQ0      0x20/* Interrupt Service Related*/unsigned char cs4281_irq;int CNT_DMA_Playback, CNT_DMA_Record; /* debug counter *//***************************************************************************   Function - readl*   Parameters - offset - the address to read from*   Returns - the value read./**************************************************************************/UINT32 readl(UINT32 offset){	UINT32 result;	PCI_READ(offset, 0x0, &result);	return result;}/***************************************************************************   Function - writel*   Parameters - value - the value to be written*                offset - the address to write to*   Returns - 0./**************************************************************************/int writel(UINT32 value, UINT32 offset){	PCI_WRITE(offset,0x0, value);	return 0;}/***************************************************************************   Function - cs4281_read_ac97*   Parameters - offset - the offset to read from*                value - the value read*   Returns - 0 = OK, 1 = ERROR*   Purpose -  read a word from the CS4281 address space (based on BA0)*     step-1: write ACCAD (Commond Address Register) 46C h*     step-2: write ACCDA (Command Data    Register) 470 h, 0 for read*     step-3: write ACCTL (Control         Register) 460 h, initiating op*     step-4: read  ACCTL , until DCV is reset and [460h] = 17h*     step-5: if DCV not cleared, error*     step-6: read  ACSTS (Status          Register) 464 h, check VSTS bit****************************************************************************/int cs4281_read_ac97(UINT32 offset, UINT32 *value){	UINT32 count, status;	/* Make sure there is no data in ACSDA[47Ch] */	status = readl(CS4281_pBA0 + BA0_ACSDA);	/* Get the actual offset, and read ... */	writel( offset - BA0_AC97_RESET, CS4281_pBA0 + BA0_ACCAD );	writel( 0, CS4281_pBA0 + BA0_ACCDA );	writel( ACCTL_DCV | ACCTL_CRW | ACCTL_VFRM | ACCTL_ESYN, CS4281_pBA0 + BA0_ACCTL );	/* Wait fo the read to occur */	for( count = 0; count < 10; count ++ )	{		taskDelay(25);		/* check if read is complete */		if(! (readl(CS4281_pBA0 + BA0_ACCTL) & ACCTL_DCV) )			break;	}	if( readl(CS4281_pBA0 + BA0_ACCTL) & ACCTL_DCV )		return 1;	/* Wait for the valid status bit to go active */	for( count = 0; count < 10; count ++ )	{		status = readl(CS4281_pBA0 + BA0_ACSTS);		if(status & ACSTS_VSTS)			break;		taskDelay(25);	}	if(!(status & ACSTS_VSTS))		return 1;	/* Read data from the AC97 register 474h */	*value = readl( CS4281_pBA0 + BA0_ACSDA );	return 0;}/***************************************************************************   Function - cs4281_write_ac97*   Parameters - offset - the offset to write to*                value - the value to*   Returns - 0 = OK, 1 = ERROR*   Purpose - write a word to the cs4281 address space*      step-1: write ACCAD (Command Address Register) 46C h*      step-2: write ACCDA (Command Data    Register) 470 h*      step-3: write ACCTL (Control         Register) 460 h*      step-4: read  ACCTL,  DCV should be reset and [460h] = 07h*      step-5: if DCV not cleared, error*****************************************************************************/int cs4281_write_ac97(UINT32 offset, UINT32 value ){	UINT32 count, status;	/* write to the actual AC97 register */	writel(offset - BA0_AC97_RESET, CS4281_pBA0 + BA0_ACCAD);	writel(value, CS4281_pBA0 + BA0_ACCDA);	writel(ACCTL_DCV | ACCTL_VFRM |ACCTL_ESYN, CS4281_pBA0 + BA0_ACCTL);	/* Wait for write to finish ... */	for(count=0; count<10; count ++)	{		taskDelay(25);		/* check if write complete */		status = readl(CS4281_pBA0 + BA0_ACCTL);		if(!(status & ACCTL_DCV))		break;	}	if(status & ACCTL_DCV)		return 1;	return 0;}/***************************************************************************   Function - cs4281_hw_init*   Parameters - none*   Returns - 0 = OK, -1 = ERROR*   Purpose - Bring up the part*****************************************************************************/int cs4281_hw_init( void ){	UINT32 ac97_slotid;	UINT32 temp1, temp2;	/****************************************************	*      set up the Sound System configuration	****************************************************/	printf("\nCS4281 HardWare Initialization ...\n");	/* ease the 'write protect' */	writel(0x4281, CS4281_pBA0 + BA0_CWPR);	/* Blast the clock control register to 0, so that PLL starts out	Blast the master serial port cntl register to 0, so that serial port	starts out	*/	writel(0, CS4281_pBA0 + BA0_CLKCR1);	writel(0, CS4281_pBA0 + BA0_SERMC);	/***** <1> Make ESYN go to 0, to turn off the Sync pulse */	writel(0, CS4281_pBA0 + BA0_ACCTL);	taskDelay(50);	/***** <2> Drive ARST# pin low for 1uS, then drive high, so that the	external logic are reset	*/	writel(0, CS4281_pBA0 + BA0_SPMC);	taskDelay(100);	writel(SPMC_RSTN, CS4281_pBA0 + BA0_SPMC);	taskDelay(500);	/***** <3> Turn on the Sound System clocks */	writel(CLKCR1_PLLP, CS4281_pBA0 + BA0_CLKCR1);	taskDelay(500);	writel(CLKCR1_PLLP | CLKCR1_SWCE, CS4281_pBA0 + BA0_CLKCR1);	/***** <4> Power on everything for now */	writel(0x7e, CS4281_pBA0 + BA0_SSPM);	/***** <5> Wait for clock stabilization */	for(temp1=0; temp1<1000; temp1++)	{		taskDelay(1);		if( readl(CS4281_pBA0 + BA0_CLKCR1) & CLKCR1_DLLRDY )			break;	}	if(!(readl(CS4281_pBA0 + BA0_CLKCR1) & CLKCR1_DLLRDY))	{		printf("cs4281: DLLRDY failed! \n");		return -1;	}	/***** <6> Enable ASYNC generation */	writel(ACCTL_ESYN, CS4281_pBA0 +BA0_ACCTL);	/* wait for a while to start generating bit clock */	taskDelay(500);	/* Set the serial port timing configuration */	writel( SERMC_PTC_AC97, CS4281_pBA0 + BA0_SERMC );	/***** <7> Wait for the codec ready signal from the AC97 codec */	for(temp1=0; temp1<1000; temp1++)	{		taskDelay(1);		if(readl(CS4281_pBA0 + BA0_ACSTS) & ACSTS_CRDY )		break;	}	if(!(readl(CS4281_pBA0 + BA0_ACSTS)& ACSTS_CRDY))	{		printf("cs4281: ACTST never came ready!\n");		return -1;	}	/***** <8> Assert the 'valid frame' signal to begin sending	commands to AC97 codec */	writel(ACCTL_VFRM |ACCTL_ESYN, CS4281_pBA0 + BA0_ACCTL);	/***** <9> Wait until CODEC calibration is finished.*/	for(temp1=0; temp1<1000; temp1++)	{		taskDelay(10);		if(cs4281_read_ac97(BA0_AC97_POWERDOWN, &temp2) )			return -1;		if( (temp2 & 0x0000000F) == 0x0000000F )			break;	}	if( (temp2 & 0x0000000F) != 0x0000000F )	{		printf("cs4281: Codec failed to calibrate\n");		return -1;	}	/***** <12> Start digital data transfer of audio data to codec */	writel(ACOSV_SLV3 | ACOSV_SLV4, CS4281_pBA0 + BA0_ACOSV );	/************************************************	*    Unmute the Master and	*    Alternate (headphone) volumes, to max.	************************************************/	cs4281_write_ac97(BA0_AC97_HEADPHONE_VOLUME, 0);	cs4281_write_ac97(BA0_AC97_MASTER_VOLUME, 0); /*3870 turned volume way down*/	cs4281_write_ac97(BA0_AC97_MASTER_VOLUME_MONO, 0);	cs4281_write_ac97(BA0_AC97_PC_BEEP_VOLUME, 0);	cs4281_write_ac97(BA0_AC97_PHONE_VOLUME, 0);	cs4281_write_ac97(BA0_AC97_CD_VOLUME, 0);	cs4281_write_ac97(BA0_AC97_VIDEO_VOLUME, 0);	cs4281_write_ac97(BA0_AC97_AUX_VOLUME, 0);	cs4281_write_ac97(BA0_AC97_PCM_OUT_VOLUME, 0);   /*machine 1 use mic in*/   if( g_machine_number == 1 )   {		cs4281_write_ac97(BA0_AC97_RECORD_SELECT, 0); /*select line 1028 in as input*/   }	else /*machine 2 use line in*/	{		cs4281_write_ac97(BA0_AC97_RECORD_SELECT, 1028); /*select line 1028 in as input*/	}	cs4281_write_ac97(BA0_AC97_RECORD_GAIN, 0);	cs4281_write_ac97(BA0_AC97_RECORD_GAIN_MIC, 0); /*seems to have no effect*/ 	/*cs4281_write_ac97(BA0_AC97_MIC_VOLUME,0);  /*either this one or the one below	causes loopback out the speaker of the input seems to have no effect*/	/*cs4281_write_ac97(BA0_AC97_LINE_IN_VOLUME,0); /*set to lowest and doesn't see to	have affect, now changed to 0 db to see what it does*/	/************************************************	*    POWER on the DAC	************************************************/	cs4281_read_ac97(BA0_AC97_POWERDOWN, &temp1);	cs4281_write_ac97(BA0_AC97_POWERDOWN, temp1 &= 0xfdff);	/* Wait until we sample a DAC ready state */	for(temp2=0; temp2<32; temp2++)	{		taskDelay(1);		cs4281_read_ac97(BA0_AC97_POWERDOWN, &temp1);		if(temp1 & 0x2)			break;	}	/******************************************	*Power on the ADC	*******************************************/	cs4281_read_ac97(BA0_AC97_POWERDOWN, &temp1);	cs4281_write_ac97(BA0_AC97_POWERDOWN, temp1 &= 0xfeff);	/* Wait until we sample ADC ready state.*/	for(temp2=0; temp2<32; temp2++)	{		taskDelay(1);		cs4281_read_ac97(BA0_AC97_POWERDOWN, &temp1);		if(temp1 & 0x1)			break;	}	/*	For playback, we map AC97 slot 3 and 4(Left	& Right PCM playback) to DMA Channel 0.	Set the fifo to be 15 bytes at offset zero.	*/	ac97_slotid = 0x01000f00;	writel(ac97_slotid, CS4281_pBA0 + BA0_FCR0);	writel(ac97_slotid | FCRn_FEN, CS4281_pBA0 + BA0_FCR0);	/*For record, we map AC97 slot 10 and 11 (Left & Right PCM playback) to	DMA Channel 1, Set the fifo to be 15 bytes at offset 16.	*/	ac97_slotid = 0x0b0a0f10;	writel(ac97_slotid, CS4281_pBA0 + BA0_FCR1);	writel(ac97_slotid | FCRn_FEN, CS4281_pBA0 + BA0_FCR1);	/*	Map the Playback SRC to the same AC97 slots(3 & 4--	--Playback left & right)as DMA channel 0.	Map the record SRC to the same AC97 slots(10 & 11--	-- Record left & right) as DMA channel 1.	*/	ac97_slotid = 0x0b0a0100;	writel(ac97_slotid, CS4281_pBA0 + BA0_SRCSA);	/*	Set 'Half Terminal Count Interrupt Enable' and 'Terminal	Count Interrupt Enable' in DMA Control Registers 0 & 1.	Set 'MSK' flag to 1 to keep the DMA engines paused.	*/	temp1 = (DCRn_HTCIE | DCRn_TCIE | DCRn_MSK);	writel(temp1, CS4281_pBA0 + BA0_DCR0);	writel(temp1, CS4281_pBA0 + BA0_DCR1);	/*	Set 'Auto-Initialize Control' to 'enabled'; For playback,	set 'Transfer Type Control'(TR[1:0]) to 'read transfer',	for record, set Transfer Type Control to 'write transfer'.	All other bits set to zero;  Some will be changed @ transfer start.	*/	temp1 = (DMRn_DMA | DMRn_AUTO | DMRn_TR_READ);	writel(temp1, CS4281_pBA0 + BA0_DMR0);	temp1 = (DMRn_DMA | DMRn_AUTO | DMRn_TR_WRITE);	writel(temp1, CS4281_pBA0 + BA0_DMR1);	/*	Enable DMA interrupts generally, and	DMA0 & DMA1 interrupts specifically.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品66部| 国产夫妻精品视频| 国产网红主播福利一区二区| 91丨九色丨尤物| 久久国产夜色精品鲁鲁99| 国产精品美女久久福利网站| 欧美精品日韩一区| 成人美女视频在线观看| 免费观看在线综合| 亚洲一区二区三区在线看| 久久综合九色综合久久久精品综合| 色天天综合久久久久综合片| 国产成人午夜精品5599| 日韩电影在线免费| 亚洲视频电影在线| 久久精品视频在线免费观看| 欧美唯美清纯偷拍| 91原创在线视频| 成人美女视频在线观看18| 精油按摩中文字幕久久| 香蕉影视欧美成人| 亚洲伦在线观看| 国产精品剧情在线亚洲| 精品国产电影一区二区| 88在线观看91蜜桃国自产| 一本久久精品一区二区| 99久久精品一区| 成人免费视频国产在线观看| 另类小说图片综合网| 日日嗨av一区二区三区四区| 一区二区三区久久| 成人免费一区二区三区在线观看| 久久影院午夜片一区| 精品久久久久香蕉网| 欧美成人三级电影在线| 日韩亚洲电影在线| 欧美男同性恋视频网站| 欧美色综合天天久久综合精品| 波多野结衣精品在线| 成人av免费在线| 国产传媒欧美日韩成人| 国产一区二区三区香蕉| 国内精品自线一区二区三区视频| 日本 国产 欧美色综合| 日本中文字幕一区| 日本不卡1234视频| 精品无人码麻豆乱码1区2区| 久久精品国产在热久久| 精品亚洲免费视频| 激情文学综合丁香| 国产成人午夜片在线观看高清观看| 国产一区二区伦理| 成人蜜臀av电影| 色综合色综合色综合| 欧美性xxxxxx少妇| 欧美日韩激情在线| 日韩欧美中文一区二区| 日韩欧美一二三四区| 久久网站最新地址| 国产欧美日韩另类视频免费观看| 国产精品美女久久久久久2018| 中文字幕一区二区三区精华液| 亚洲久本草在线中文字幕| 一区二区三区日韩精品视频| 亚洲一区在线视频观看| 天天色图综合网| 精品一区二区三区欧美| 国产91精品精华液一区二区三区| 99久久伊人久久99| 欧美视频在线不卡| 91精品国产一区二区三区香蕉| 精品少妇一区二区三区视频免付费 | 一区二区欧美国产| 午夜精品爽啪视频| 国模套图日韩精品一区二区| 丁香六月久久综合狠狠色| 97久久超碰精品国产| 欧美剧在线免费观看网站| 日韩视频免费观看高清完整版在线观看 | 日本午夜精品视频在线观看| 美女免费视频一区| 不卡视频一二三| 欧美日韩精品欧美日韩精品一综合| 精品欧美乱码久久久久久 | 正在播放一区二区| 久久蜜臀中文字幕| 一区二区三区影院| 免费美女久久99| 色欧美88888久久久久久影院| 欧美一区二区三区四区在线观看| 亚洲国产成人自拍| 日韩黄色免费网站| aaa亚洲精品一二三区| 欧美一区二视频| 亚洲欧洲精品天堂一级 | 日韩综合一区二区| 一区二区欧美国产| 欧美日韩精品综合在线| 色综合久久六月婷婷中文字幕| 欧美一区二区三区日韩视频| 中文av一区二区| 免费成人性网站| 色妞www精品视频| 精品国产乱码久久久久久闺蜜| 亚洲一区二区3| 成人高清视频在线| 日韩欧美一区二区视频| 一区二区三区在线观看动漫| 国产成人在线视频网站| 在线成人高清不卡| 亚洲裸体xxx| 成人黄色大片在线观看| 欧美精品一区二区三区一线天视频| 亚洲另类色综合网站| 盗摄精品av一区二区三区| 欧美一区日本一区韩国一区| 亚洲自拍偷拍av| 一本色道久久综合亚洲aⅴ蜜桃| 久久精品免费在线观看| 久久疯狂做爰流白浆xx| 51精品秘密在线观看| 亚洲综合成人在线视频| 色乱码一区二区三区88| 中文天堂在线一区| 国产成人午夜视频| 欧美成人性战久久| 久久国产视频网| 日韩一区二区免费视频| 丝袜美腿一区二区三区| 欧美三片在线视频观看| 一区二区三区久久| 在线一区二区视频| 亚洲欧美色一区| 91在线视频网址| 亚洲欧美综合另类在线卡通| 成人免费视频一区二区| 国产精品久久久久一区二区三区| 国产精品99久| 国产欧美一区二区三区在线老狼| 国产乱国产乱300精品| 26uuu另类欧美| 国产一区二区三区精品视频| 精品国产免费一区二区三区四区 | 一本到三区不卡视频| 亚洲女人****多毛耸耸8| 91麻豆免费观看| 一区二区三区久久久| 欧美日韩精品免费观看视频| 婷婷夜色潮精品综合在线| 91精品国产乱| 精油按摩中文字幕久久| 国产欧美一区二区三区沐欲| 成人高清伦理免费影院在线观看| 中文字幕一区二区三区四区不卡 | 日本在线不卡视频| 精品免费国产二区三区| 国产一区视频网站| 国产精品福利在线播放| 色偷偷88欧美精品久久久| 亚洲一二三四区不卡| 日韩一区二区在线看片| 国产精品1区2区3区| 亚洲国产成人一区二区三区| 色天天综合色天天久久| 日韩精品亚洲一区二区三区免费| 日韩欧美第一区| 成人国产精品免费观看动漫| 一区二区日韩av| 精品欧美乱码久久久久久1区2区| www.色精品| 日韩经典中文字幕一区| 国产欧美日韩中文久久| 91免费版在线看| 免费欧美日韩国产三级电影| 国产婷婷一区二区| 欧美亚洲综合色| 韩国av一区二区三区在线观看| 日韩一区中文字幕| 91精选在线观看| 成人激情电影免费在线观看| 亚洲成人资源在线| 国产欧美综合色| 欧美日韩一二区| 高清不卡一二三区| 天天色综合成人网| 中文字幕色av一区二区三区| 欧美一区三区四区| 色呦呦网站一区| 国产麻豆视频精品| 亚洲第一久久影院| 中文成人综合网| 精品捆绑美女sm三区| 91免费在线视频观看| 精品一区免费av| 亚洲一二三四区不卡| 国产精品福利电影一区二区三区四区| 欧美一区二区网站| 欧美三级在线看| 成人97人人超碰人人99| 看片的网站亚洲|