aic23test.c

来自「CHP 2 - Real-Time Digital Signal Process」· C语言 代码 · 共 68 行

C
68
字号
// 
//  Project: Experiment 2.10.7 Use AIC23 via McBSP - Chapter 2 
//  File name: aic23Test.c   
//  Function(s): main()    
//               dispID()    
//
//  Description: Experiment 2.10.7 initializes the C55x DSK McBSP and AIC23.
//               McBSP1 is for AIC23 controlling SPI and McBSP2 is the data SPI.
//               It reads data and plays audio back via on AIC23 to a speaker
//
//  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 <stdio.h>
#include "mcbsp.h"
#include "aic23.h"


#define   DATASIZE  12320
#define   FALSHMEMDATA 0 
#if FALSHMEMDATA 
// Flash memory data
#define   flashData 0x200000    // If data has been programmed by flash example already
#else
// Local memory data
short flashData[DATASIZE]={     // Else use data from SRAM
#include "dtmf18005551234.dat"
};
#endif

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


void main()
{
  short i,data;            
  unsigned short *flashPtr;
    
  // Initialize McBSP1 as AIC23 SPI control channel
  mcbsp1Init(); 
    
  // Initialize the AIC23  
  aic23Init();

  // Initialize McBSP2 as AIC23 SPI data channel       
  mcbsp2Init();           
                     
  flashPtr = (unsigned short *)flashData;                 
  // Playback data via AIC23
  for (i=0; i<DATASIZE; i++)
  {
    data = *flashPtr++;
    while (!aic23Tx(data));      // Send data to left channel
    while (!aic23Tx(data));      // Send data to right channel 
  }
        
  // Power down the AIC23 and reset McBSP
  aic23Powerdown();   
  mcbspReset(1);
  mcbspReset(2);
}

⌨️ 快捷键说明

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