iomcbsp.c

来自「TMS320C5416 IOBBSP接口控制程序」· C语言 代码 · 共 31 行

C
31
字号
#include "iomcbspcfg.h"
#include <dsk5416.h>
#include <dsk5416_pcm3002.h>

DSK5416_PCM3002_Config setup = {

    0x1ff,      // Set-Up Reg 0 - Left channel DAC attenuation
    0x1ff,      // Set-Up Reg 1 - Right channel DAC attenuation
    0x0,        // Set-Up Reg 2 - Various ctl e.g. power-down modes
    0x0         // Set-Up Reg 3 - Codec data format control
};
 
void main ()
{
    DSK5416_PCM3002_CodecHandle hCodec;
    Int16 data;
    // Initialize the board support library
    DSK5416_init();
    // Start the codec
    hCodec = DSK5416_PCM3002_openCodec(0, &setup);
    // Set codec frequency to 8KHz
    DSK5416_PCM3002_setFreq(hCodec, 8000);
	// Endless loop IO audio codec
 	while(1){
 		// Read 16 bits of codec data, loop to retry if data port is busy
 		while(!DSK5416_PCM3002_read16(hCodec, &data));
 		// Write 16 bits to the codec, loop to retry if data port is busy
 		while(!DSK5416_PCM3002_write16(hCodec, data));
	}
}

⌨️ 快捷键说明

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