📄 codec_c.c
字号:
//******************************************************************************
// SJTU DSP Tech. Center
// Copyright (c) 2002 SJTU DSP Tech. Center. All Rights Reserved.
// History:
// Date Authors Changes
// 2003/08/30 Fu Xuan Created.
//******************************************************************************
#include "codec_c.h"
//******************************************************************************
//* MAIN
//******************************************************************************
void main()
{
//light the LEDs for a short time
leds_on();
delay(1000);
leds_off();
delay(1000);
//initialize McBSP
init_mcbsp();
//initialize DMA
init_dma();
//initialize CODEC reg_1=0x01, reg_2=0x10, reg_3=0x00, reg_4=0xC8
init_codec(0x0101, 0x0210, 0x0300, 0x04C8);
//start capture and play
input_pingpong_flag=0;
output_pingpong_flag=0;
dmac0_int_flag=0;
dmac4_int_flag=0;
enable_codec();
while(1)
{ //test trans finish
if(dmac4_int_flag)
dmac4_int_flag=0;
//test receive finish
if(dmac0_int_flag)
{ //here, have receive data, then process
dmac0_int_flag=0;
if(input_pingpong_flag)
in_buf = in_data_pong;
else
in_buf = in_data_ping;
if(output_pingpong_flag)
out_buf = out_data_pong;
else
out_buf = out_data_ping;
//do samples processing
processing(in_buf, out_buf, data_size);
}
}
return;
}
//==================================================
void delay(s16 period)
{
int i, j;
for(i=0; i<period; i++)
{
for(j=0; j<period>>1; j++);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -