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

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

?? libsi3000init.c

?? G711在dsPIC33FJ256GP506下的應用
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*********************************************************************
*                                                                    *
*                       Software License Agreement                   *
*                                                                    *
*   The software supplied herewith by Microchip Technology           *
*   Incorporated (the "Company") for its dsPIC controller            *
*   is intended and supplied to you, the Company's customer,         *
*   for use solely and exclusively on Microchip dsPIC                *
*   products. The software is owned by the Company and/or its        *
*   supplier, and is protected under applicable copyright laws. All  *
*   rights are reserved. Any use in violation of the foregoing       *
*   restrictions may subject the user to criminal sanctions under    *
*   applicable laws, as well as to civil liability for the breach of *
*   the terms and conditions of this license.                        *
*                                                                    *
*   THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION.  NO           *
*   WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING,    *
*   BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND    *
*   FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE     *
*   COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,  *
*   INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.  *
*                                                                    *
*********************************************************************/

/******************************************************************************
**  Filename:     libSi3000Init.c
**
**  System:       RISC
**
**  Platform:     dsPIC33F
**
**  Description:  This file contains the API libSi3000Init().This API
**                initializes the DCI on dsPIC30F device and also the  SI 3000
**                codec connected to it based on the settings provided by the
**                user through spxSi3000 structure.
**
******************************************************************************/

#include <p33Fxxxx.h>
#include "G711Lib_common.h"
#include "G711Lib_Si3000.h"
#include "G711Lib_internal.h"

/******************************************************************************
**
**  FunctionName: libSi3000Init ( )
**
**  Description:  This API initializes the DCI and SI 3000 codec registers
**                based on settings provided by the user through structure.
**                Here DCI module can be made either Slave or Master. It
**                accesses members of the dci structure for initializing the
**                above said registers.It has no outputs.
******************************************************************************/
void libSi3000Init ( void )
{
  unsigned int temp1,temp2;            //Temporary variables.
  if ( g711.dcimode == 1 )
  {
/*-----------------------------------------------------------------------------
      Cofiguration of DCI peripheral for setting up SI 3000 codec Registers.
-----------------------------------------------------------------------------*/
   DCICON1 = 0x0000;      		       //Ensure DCI module is placed in known
   DCICON2 = 0x0000;                   //state.
   DCICON3 = 0x0000;
   TSCON   = 0x0000;
   RSCON   = 0x0000;
   _TRISF6 = 0x01;       			   //Make codec reset switch port pin as
                                       //inputfor now.Ensure port pins are
                         			   //setcorrectly (Not really required
                         		       //since DCI takes control of it's pins)

   TRISG = 0x5000;		 		       //CSDI pin configured for input
	    							   //COFS output to Si3000 in DCI Master
			   			 			   //mode CSCK output to Si3000

   DCICON1 = 0x0040;	 			   //Set for multichannel frame sync mode
						 			   //Data tx/rx begins 1clock afterFs pulse
						 			   //Data changes on rising, sampled on 
                                       //falling Tristate output CSDO pin 
                                       //when not txing Frame sync 
						 			   //generated by dsPIC DCI
						 			   //Clock is output from DCI
						 			   //Ensure module is disabled for now

   DCICON2 = 0x04EF;				   //Data word size is 16-bits (bits 3:0)
									   //Data frame is 8 words (bits 8:5)
									   //Set buffer length control (2data words
									   //Will be buffered between interrupts)


   DCICON3 = g711.bcg1;			       //Initialize DCI bit clock generator


   RSCON = 0x0001;				       //Set receive slot 1 enable RSCON

   TSCON = 0x0001;				       //Set transmit slot 1 enable TSCON

   _DCIIF = 0x00;      			       //Ensure DCI interrupt flag is resetIFS2


   _DCIIE = 0x00;	    			   //ISR processing is disabled for nowIEC2

/*-----------------------------------------------------------------------------
            Setup of SI 3000 codec through DCI peripheral on dsPIC30F device.
-----------------------------------------------------------------------------*/
   TXBUF0 = PLUS_ONE_WITH_SECONDARY;   //Load TXBUF0 with a value that
                                       //requests a secondary frame

   TXBUF1 = (WRITE_PLL1_DIVIDE_N1|g711.pLL1divideN1);

                                       //Load TXBUF1 with a value that will
                            		   //initiate a WRITE to PLL Divide Control
                                       //Register 3 in the Si3000.



   _RF6 = 0x00;						   //Synchronize DCI with Si3000to
                                       //ensure first frame synce is
                                       //aligned with TXBUF0.
                                       //This is not really required
                                       //when the DCI is Master and
                                       //Codec is the Slave but is
                                       //required when the Codecis the
                                       //Master and DCI is the Slave.
   asm("nop");
   _TRISF6 = 0x00;		               //Reset codec
   asm("repeat  #40");                 //Transmit a minimum pulse
   asm("nop");                         //width of 5uS

   _TRISF6 = 0x01;					   //Release codec

   _DCIEN = 0x1;			    	   //Enable DCI module
									   //This ensures the first primary
                                       //and secondary frame use data
                                       //loaded already into TXBUF0
                                       //and TXBUF1

   while ( ! _TMPTY );				   //Wait until TXBUF0 and TXBUF1
       							       //have been movedto their shadow
									   //registers for transmission

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;   //Load TXBUF0 with a value that
       						           //requests a secondary frame

   TXBUF1 = (WRITE_PLL1_MULTIPLY_M1 | g711.pLL1multiplyM1);

                                       //Load TXBUF1 with avalue that will ini-
                            		   //tiate aWRITE to PLL Multiply Register4

   while( ! _TMPTY );                  //Wait until TXBUF0 and TXBUF1
                                	   //have been moved to their shadow
                                       //registers for transmission

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;   //Load TXBUF0 with a value that
       							       //requests a secondary frame

   TXBUF1 = (WRITE_CONTROL_1  | g711.control1);
                                       //Load TXBUF1 with a value that
                            		   //will power up/down line driver
                               		   //and the speaker driver in Si3000
                             		   //Control Register 1

   while ( ! _TMPTY ); 				   //Wait until TXBUF0 and TXBUF1
                      				   //have been moved to their shadow
                                       //registers for transmission

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;   //Load TXBUF0 with a value that
                           			   //requests a secondary frame

   TXBUF1 = (WRITE_CONTROL_2 | g711.control2); //Load TXBUF1 with a value that
                          				//will initialize Control2
                                        //Register 2.
   while ( ! _TMPTY );

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;	//Load TXBUF0 with a value that
                           				//requests a secondary frame

   TXBUF1 = (WRITE_RX_GAIN_CONTROL_1 | g711.rxgaincontroL1);//Load TXBUF1 with
                          				//a value that will initialize
                                        //RX Gain Control1 Register.


   while ( ! _TMPTY);					//Wait until TXBUF0 and TXBUF1
                         				//have been moved to their shadow
                                        //registers for transmission

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;    //Load TXBUF0 with a value that
                                        //requests a secondary frame

   TXBUF1 = (WRITE_ADC_VOLUME_CONTROL  | g711.adcvolumecontrol);//Load TXBUF1
                            			//with a value that will
                                        //initialize ADC volume contol
                                        //Register6.
   while ( ! _TMPTY );					//Wait until TXBUF0 and TXBUF1
                         				//have been moved to their shadow
                                        //registers for transmission

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;    //Load TXBUF0 with a value that
                     					//requests a secondary frame

   TXBUF1 = (WRITE_DAC_VOLUME_CONTROL |g711.dacvolumecontrol);//Load TXBUF1
                           				// with a value that that will
                                        //initialize DAC Volume Control
                                        // Register7

   while ( ! _TMPTY );					//Wait until TXBUF0 and TXBUF1
                          			    //have been moved to their shadow
                                        //registers for transmission

   TXBUF0 = PLUS_ONE_WITH_SECONDARY;    //Load TXBUF0 with a value that
                      					//requests a secondary frame
   TXBUF1 = (WRITE_ANALOG_ATTENUATION | g711.analogattenuation);//Load TXBUF1
                           				//with a value that that
                                        //will initialize Analog
                                        //attenuation Control Register9.
   while(!_TMPTY);						//Wait until TXBUF0 and TXBUF1
                          				//have been moved to their shadow
                                        //registers for transmission

/*-----------------------------------------------------------------------------
Note that the TMPTY bit only gives a status of whether or not TXBUF registers
are ready to accept data. This does not tell you if the transmissions themselves
were completed.So, we need to test the SLOT<3:0> bits in the DCISTAT register.
While testing we will ensure that TXBUF0 and TXBUF1 shadow registers have been
fully transmitted on TimeSlot0 two times each. This will guarantee that
initialization of the codec is complete
-----------------------------------------------------------------------------*/
   temp1 = 0x0f00;						//Set up a mask for the SLOT bits
   do
   {									//Read the DCISTAT register
     temp2 = DCISTAT;					//Logical-AND to extract SLOT bits
     temp2 &= temp1;
   } while ( temp2 ); 					//Wait until SLOT bits reach 0b0000
 								        //Did TXBUF0 get transmitted?

	 do
   {									//Read the DCISTAT register
     temp2 = DCISTAT;					//Logical-AND to extract SLOT bits
     temp2 &= temp1;
   } while ( ! temp2 );					//Wait until SLOT bits reach non-zero
          								//Did TXBUF1 get transmitted?

	 do
   {									//Read the DCISTAT register
     temp2 = DCISTAT;					//Logical-AND to extract SLOT bits
     temp2 &= temp1;
   } while ( temp2 ); 					//Wait until SLOT bits reach 0b0000
          								//Did TXBUF0 get transmitted?

	 do
   {									//Read the DCISTAT register
     temp2= DCISTAT;					//Logical-AND to extract SLOT bits
     temp2 &= temp1;
   } while ( ! temp2 );					//Wait until SLOT bits reach 0b0000
        								//Did TXBUF0 get transmitted?

	 while ( ! _ROV );					//Testing overflow bit

   temp1 = RXBUF0;						//Dummy reads to clear
   temp1 = RXBUF1;						//overflow conditions

	 _DCIEN = 0x00;						//Disable the DCI module

/*-----------------------------------------------------------------------------
Now re-initialize some aspects of the DCI communication for normal interrupt
driven operation based on user settings done in dci and codecsetup structures.
-----------------------------------------------------------------------------*/

   DCICON1 = DCICON1VAL;    		    //Set mode.
										//Data txmit/rx setup.
										//Data change setup.
              							//Tristate/set low output CSDO pin when
                                        //not txing.
										//Frame sync genrtd by dsPIC DCI/SI3000.
										//Clock is output from DCI/SI 3000.
										//Ensure module is disabled for now
   DCICON2 = DCICON2VAL;			    //Set Data word size .(bits 3:0)
										//Set data frame size.(bits 8:5)
   DCICON3 = g711.bcg1;                 //Set DCI bit clock generator.
   RSCON = RSCONVAL;                    //Set receive slot enable bits.
   TSCON = TSCONVAL;                    //Set transmit slot enable bits.
   codecdata.countFill = 0x0000;        //Clear counter that keeps track ofdata
                                        //filled into ping pong buffers.
   codecdata.countLoad = 0x0000;        //Clear counter that keeps track ofdata
                                        //retrieved from ping pong buffers.

   codecdata.fBlockdone = 0x00;			//Clear flag that indicates whether or
 										//not one sample ping pong buffer
    _DCIEN = 0x01;                      //has been filled.
 }


else
{

/******************************************************************************

     Cofiguration of DCI peripheral for setting up SI 3000 codec Registers.

******************************************************************************/

   DCICON1 = 0x0000;      			   //Ensure DCI module is placed in known
   DCICON2 = 0x0000;                   //state.
   DCICON3 = 0x0000;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合狠狠综合久久综合88| 风流少妇一区二区| 欧美片在线播放| 亚洲成人黄色影院| 欧美日韩免费一区二区三区视频| 一区二区三区在线观看欧美| 91成人免费网站| 午夜激情一区二区三区| 91麻豆精品国产91久久久久久久久| 三级在线观看一区二区| 精品国产乱子伦一区| 国产一区二区三区免费播放| 亚洲国产精品av| 91免费视频大全| 亚洲成人免费观看| 精品剧情在线观看| 高清在线成人网| 亚洲一区二区精品视频| 欧美一区二区三区喷汁尤物| 高清不卡在线观看| 亚洲另类在线制服丝袜| 欧美日韩国产三级| 国产乱码精品一区二区三区忘忧草| 中文字幕一区二区在线观看| 欧美日韩一区 二区 三区 久久精品| 麻豆视频观看网址久久| 欧美国产亚洲另类动漫| 欧美亚洲免费在线一区| 国产一区二区视频在线播放| 日韩理论片网站| 在线观看av一区二区| 国内精品写真在线观看| 亚洲日本乱码在线观看| 欧美一区二区大片| 99久久婷婷国产精品综合| 日韩中文字幕一区二区三区| 欧美激情艳妇裸体舞| 欧美日韩小视频| 福利视频网站一区二区三区| 亚洲v中文字幕| 中文字幕欧美国产| 4438成人网| 99久久伊人网影院| 麻豆精品在线观看| 亚洲午夜久久久久| 国产女同性恋一区二区| 欧美肥胖老妇做爰| 91网页版在线| 91福利区一区二区三区| 久久精品国产99| 午夜视黄欧洲亚洲| 国产精品久久久久久久岛一牛影视| 日韩欧美激情一区| 欧日韩精品视频| 不卡在线观看av| 激情六月婷婷久久| 日韩精品一二三区| 亚洲欧美日韩久久| 国产亚洲欧美激情| 日韩一区二区三区高清免费看看| 色综合天天性综合| 国产成人在线观看| 激情图片小说一区| 免费欧美在线视频| 亚洲第一激情av| 亚洲一区二区欧美激情| 一色屋精品亚洲香蕉网站| 国产欧美综合在线观看第十页 | 亚洲人成电影网站色mp4| 日韩精品一区在线| 欧美视频一区二| 色噜噜狠狠成人网p站| 高清不卡一二三区| 国产成人夜色高潮福利影视| 久色婷婷小香蕉久久| 日韩一区精品字幕| 热久久久久久久| 日韩电影一区二区三区四区| 日韩精品一区第一页| 亚洲一区二区欧美| 亚洲国产综合91精品麻豆| 一区二区三区中文字幕精品精品| 国产精品网友自拍| 国产精品网站在线观看| 国产精品国产三级国产有无不卡| 欧美激情中文不卡| 国产精品成人一区二区艾草| 国产精品久久久久一区二区三区共| 国产欧美日韩麻豆91| 国产欧美日韩精品一区| 中文久久乱码一区二区| 国产精品三级av| 日韩一区在线看| 亚洲欧美激情在线| 亚洲国产精品一区二区www| 亚洲国产wwwccc36天堂| 日韩二区在线观看| 激情偷乱视频一区二区三区| 成人丝袜高跟foot| 99国产精品一区| 欧美老女人在线| 精品国产污网站| 国产精品麻豆网站| 亚洲一区二区五区| 久久精品国产99国产| 高清不卡一二三区| 在线观看亚洲成人| 日韩一级片网址| 久久九九全国免费| 亚洲欧美日韩中文字幕一区二区三区| 亚洲第一成年网| 国产一区二区精品在线观看| 成人a级免费电影| 欧美日韩中字一区| 精品国产欧美一区二区| 国产精品国产三级国产三级人妇 | 精品电影一区二区三区| 欧美国产亚洲另类动漫| 夜夜精品视频一区二区 | 天堂va蜜桃一区二区三区漫画版| 日韩电影免费一区| av在线综合网| 777欧美精品| 国产日韩精品一区二区浪潮av| 一区二区在线观看视频| 蜜乳av一区二区| 91一区在线观看| 日韩欧美电影在线| 国产欧美精品区一区二区三区| 亚洲福利视频导航| 成人18精品视频| 日韩免费观看高清完整版在线观看| 亚洲欧美在线另类| 美女精品自拍一二三四| 91黄色免费网站| 337p粉嫩大胆色噜噜噜噜亚洲| 夜夜精品浪潮av一区二区三区| 国产毛片精品视频| 欧美精选午夜久久久乱码6080| 亚洲v日本v欧美v久久精品| 国产一区二区视频在线播放| 欧美色爱综合网| 国产精品家庭影院| 国产精品一区久久久久| 欧美另类变人与禽xxxxx| 国产精品久久久久一区二区三区| 久草这里只有精品视频| 欧美亚洲一区二区在线| 国产精品久久久久影院亚瑟| 精品一区二区在线视频| 678五月天丁香亚洲综合网| 亚洲毛片av在线| 丁香婷婷综合五月| 精品卡一卡二卡三卡四在线| 日韩高清国产一区在线| 欧美色倩网站大全免费| 中文字幕一区二区日韩精品绯色| 国模大尺度一区二区三区| 欧美一区在线视频| 日韩在线一二三区| 色婷婷综合中文久久一本| 日本一区二区久久| 国产美女在线观看一区| 欧美成人猛片aaaaaaa| 日韩国产欧美在线播放| 欧美日韩一级二级| 亚洲一区二区三区爽爽爽爽爽| 色又黄又爽网站www久久| 一区精品在线播放| 99re这里只有精品视频首页| 中文字幕一区免费在线观看| 99精品1区2区| 亚洲人成网站在线| 色婷婷国产精品久久包臀 | 一色屋精品亚洲香蕉网站| 成人性生交大合| 国产精品视频一二三区| 国产99精品国产| 欧美激情一区不卡| k8久久久一区二区三区| 亚洲四区在线观看| 91蜜桃传媒精品久久久一区二区| 一区在线中文字幕| 在线国产电影不卡| 五月天婷婷综合| 日韩免费高清视频| 国产成人精品aa毛片| 中文字幕一区二区三| 91国在线观看| 成人性生交大合| 成人免费在线播放视频| 色偷偷88欧美精品久久久| 午夜a成v人精品| 欧美一区二区三区性视频| 精品一区二区三区免费播放| 欧美激情在线一区二区三区| 色婷婷综合五月| 蜜桃传媒麻豆第一区在线观看| 国产网站一区二区| 色综合久久久久综合体 |