⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcbsp2init.c

📁 CHP 2 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen
💻 C
字号:
// 
//  Project: Experiment 2.10.6 Configure and Use McBSP- Chapter 2 
//  File name: mcbsp2Init.c   
//  Function(s): mcbsp2Init()        
//
//  Description: This function initialize the C5510 DSK McBSP2 registers
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//

#include "mcbsp.h"

#pragma CODE_SECTION(mcbsp2Init,    ".text:example:mcbsp2Init");

void mcbsp2Init(void)
{
  volatile short i;
  ioport volatile unsigned short*p;      

  mcbspReset(2);           // Set McBSP2 to default values first
            
  p = (ioport volatile unsigned short*)(McBSP_BASE+McBSP2_OFFSET);           
     
  *(p+RCR1) |= RFRLEN1_BIT  // RCR1: Set as one word per frame
            |  RWDLEN1_BIT; //       Select 16-bit data  
    
  *(p+XCR1) |= XFRLEN1_BIT  // XCR1: Set as one word per frame
            |  XWDLEN1_BIT; //       Select 16-bit data   

  *(p+PCR)  |= CLKXP_BIT    // PCR: Transmit clock at falling edge of CLKR
            |  CLKRP_BIT;   //      Receive clock at rising edge of CLKR
    
  *(p+SPCR2)|= SOFT_BIT     // SPCR2: Set SOFT bit
            |  GRST_BIT     //        Enable sample rate generator
            |  FRST_BIT;    //        Enable frame sync

  for (i=0; i<400; i++);    // Wait until it stabilized

  *(p+SPCR1)|= RRST_BIT;    // SPCR1: Enable the McBSP 2 receiver
  *(p+SPCR2)|= XRST_BIT;    // SPCR2: Enable the McBSP 2 transmitter
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -