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

📄 main.c

📁 ADI 公司的DSP ADSP21262 EZ-KIT LITE开发板的全部源代码
💻 C
字号:
//main.c  
//
// This file initializes the system, and then synchronizes the sweeping of the LEDs
// with the playback of the audio sample.

#include "Sample Playback.h"




void main(void)
{    
    
    Csample* SamplePtr;
  
    FirstSample = (Csample*)malloc(sizeof(Csample));
        
    //initialize first sample descriptor (sweep sound)
    FirstSample->StartAddr     = 0x01040000;
    FirstSample->CurrentAddr   = 0x01040000;
    FirstSample->Bytes         =   111180;
    FirstSample->Next          = 0;
    
      
          
    // Connect SPORT2B to DAC4 of the 1836 
    InitDAI();
    
    // This function will configures the codec (the default example uses the
    // default settings including a 48kHz sample rate.)
    Init1835viaSPI();
    
    // Finally initialize Sport2B to transmits audio data 
    InitSPORT();

    // when the SPORT2 interrupt occurs, call play_sample_ISR.
    interrupts (SIG_SP2, play_sample_ISR);
    
    //In VDSP 3.0 SP1, there was an anomaly which caused the interrupt for odd-numbered
    // SPORTS to incorrectly be enabled any time the corresponding even-numbered SPORT
    // was enabled.  This work around disables that odd# interrupt.
    interrupts (SIG_SP1, SIG_IGN); 
    

    //start_sweep is global semaphore. The audio sample in the flash is accessed
    //as a circular buffer in software, so when the pointer reaches the end of the
    //sample it is reset to the beginning.  When this happens, start_sweep is also
    //reset to 1 to indicate that the sample is starting again.
    while(1)
    {        
          
         
        //Synchronize LED sweeping with sample wrapping
        if (start_sweep == 1){
            //reset semaphore
            start_sweep = 0;
            //and sweep LED's up and down [sweep(), which writes to a latch using
            //the PP, is constantly interrupted by the SP2 interrupt to fetch
            //samples from the flash.
            sweep();
        }
    }
    
}

⌨️ 快捷键说明

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