📄 main.c
字号:
#include "g723_5410cfg.h"
int read_from_host(int *in);
int input_buf[128]; /* use to save A/D data */
int process_buf[128]; /* use to processing function saving data */
int wave_buf[128]; /* use to save D/A data */
main()
{
}
void save_to_host(int *in)
{
PIP_Handle pipe;
Uns size;
int *addr;
int i;
pipe = HST_getpipe(&HST0); /* 获得数据管道的句柄 */
if(PIP_getWriterNumFrames(pipe) <= 0)
return;
PIP_alloc(pipe); /* 从主机通道指定的数据管道中取得一个数据帧 */
size = PIP_getWriterSize(pipe);
addr = PIP_getWriterAddr(pipe);
for(i=0;i<size;i++)
*addr++ = *in++;
PIP_put(pipe); /* 释放这个数据帧 */
}
int read_from_host(int *in)
{
PIP_Handle pipe;
Uns size;
int *addr;
int i;
pipe = HST_getpipe(&HST1); /* 获得数据管道的句柄 */
if(PIP_getReaderNumFrames(pipe) <= 0)
return(-1);
PIP_get(pipe); /* 从主机通道指定的数据管道中取得一个数据帧 */
size = PIP_getReaderSize(pipe);
addr = PIP_getReaderAddr(pipe);
for(i=0;i<size;i++)
*in++ = *addr++;
PIP_free(pipe); /* 释放这个数据帧 */
return(0);
}
void processing(int *in,int *out)
{ int i;
if(read_from_host(in)<0) // 利用HST通道回放采样数据 !
return;
in+=127; // 每帧数据反序输出 !
for(i=0;i<128;i++)
*out++ = *in-- ; // processing input data !
out-=128;
save_to_host(out); // 利用HST通道记录采样数据 !
}
void receive()
{
SWI_post(&SWI0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -