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

📄 led.c

📁 /* DSK6713 功能:无任何键按下时4个灯闪烁并放音8s(事先存好在 flash 0x90020000--0x90040000里)可在led2程序中修改内容 * 当第一个键按下时LED
💻 C
字号:

/*
 *  DSP/BIOS is configured using the DSP/BIOS configuration tool.  Settings
 *  for this example are stored in a configuration file called led.cdb.  At
 *  compile time, Code Composer will auto-generate DSP/BIOS related files
 *  based on these settings.  A header file called ledcfg.h contains the
 *  results of the autogeneration and must be included for proper operation.
 *  The name of the file is taken from led.cdb and adding cfg.h.
 */
#include "ledcfg.h"

/*
 *  The 6713 DSK Board Support Library is divided into several modules, each
 *  of which has its own include file.  The file dsk6713.h must be included
 *  in every program that uses the BSL.  This example also includes
 *  dsk6713_led.h and dsk6713_dip.h because it uses the LED and DIP modules.
 */
#include "dsk6713.h"
#include "dsk6713_led.h"
#include "dsk6713_dip.h"
#include "dsk6713_aic23.h"
#include"dsk6713_flash.h"
#include<math.h>


#define FLASH_ADDR     0x90020000
#define FLASH_ADDR_MAX 0x90040000            

Uint32 flashaddress;
Uint32 data32;
Uint16 data16;
Uint8  data8;
  
  /* Codec configuration settings */
DSK6713_AIC23_Config config1 = { \
    0x0017,  /* 0 DSK6713_AIC23_LEFTINVOL  Left line input channel volume */ \
    0x0017,  /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
    0x01f9,  /* 2 DSK6713_AIC23_LEFTHPVOL  Left channel headphone volume */  \
    0x01f9,  /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
    0x0015,  /* 4 DSK6713_AIC23_ANAPATH    Analog audio path control:mic */      \
    0x0000,  /* 5 DSK6713_AIC23_DIGPATH    Digital audio path control */     \
    0x0000,  /* 6 DSK6713_AIC23_POWERDOWN  Power down control */             \
    0x0043,  /* 7 DSK6713_AIC23_DIGIF      Digital audio interface format */ \
    0x000d,  /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control 8khz*/            \
    0x0001   /* 9 DSK6713_AIC23_DIGACT     Digital interface activation */   \
  };


/*
 *  main() - Main code routine, initializes BSL and runs LED application
 */
 
void main()
{   DSK6713_AIC23_CodecHandle hCodec;
     
    /* Initialize the board support library, must be first BSL call */
    DSK6713_init();
    
    
     /*  Start the codec */
    
     hCodec = DSK6713_AIC23_openCodec(0, &config1);
     
    /* Initialize the LED switch modules of the BSL */
    DSK6713_LED_init();
   
   
   
    //flashaddress=FLASH_ADDR_MAX;     
    flashaddress=FLASH_ADDR;
    DSK6713_FLASH_erase(FLASH_ADDR, DSK6713_FLASH_PAGESIZE*4);
   
    
   DSK6713_LED_on(0);
   
   while(1)
       {
                   
             while (!DSK6713_AIC23_read(hCodec,&data32));
             data16=data32;             
             
             data8=data16/256;
             
             //copy one 8bit from data1 to flashaddess 
              DSK6713_FLASH_write((Uint32)&data8, flashaddress,1);
              while (!DSK6713_AIC23_write(hCodec,data16));                          
           
             //flashaddress--;
              flashaddress++;
             if( flashaddress==0x9003d000) flashaddress=0x9003e000;
             //if(flashaddress-FLASH_ADDR==0)break;  
             if(flashaddress-FLASH_ADDR_MAX==0)break;             
                       	                      
        }
        
   DSK6713_LED_off(0);
   
   
   //flashaddress=FLASH_ADDR_MAX;
   flashaddress=FLASH_ADDR;
   DSK6713_LED_on(3);
   
   while(1)
       {                           
             DSK6713_FLASH_read(flashaddress, (Uint32)&data8, 1);
             data16=data8*256; 
             
             while (!DSK6713_AIC23_write(hCodec,data16));
                        
             //flashaddress--;
             flashaddress++;
             
             if( flashaddress==0x9003d000) flashaddress=0x9003e000;
             //if(flashaddress-FLASH_ADDR==0)break;
             if(flashaddress-FLASH_ADDR_MAX==0)break; 
                        
                       	                      
        }
        
      DSK6713_LED_off(3);     
    

      DSK6713_AIC23_closeCodec(hCodec);
     
     
     
   
       
} //main结束          
                  
                            

⌨️ 快捷键说明

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