您好,我是参考这个帖子来完成的驱动移植,
http://blog.csdn.net/lobbve/archive/2009/04/13/4069211.aspx 完成移植后,cat test.wav > /dev/dsp 没有问题,cat /dev/dsp > test.wav 没有成功,无错误提示,
我的应用程序里,如下控制声卡,
ioctl(ca->fd, SNDCTL_DSP_RESET, 0);
p = bits; /* 16 bits */
ioctl(ca->fd, SNDCTL_DSP_SAMPLESIZE, &p);
p = stereo; /* number of channels */
ioctl(ca->fd, SNDCTL_DSP_CHANNELS, &p);
p = AFMT_S16_NE; /* choose LE or BE (endian) */
ioctl(ca->fd, SNDCTL_DSP_SETFMT, &p);
p = rate; /* rate in khz */
ioctl(ca->fd, SNDCTL_DSP_SPEED, &p);
ioctl(ca->fd, SNDCTL_DSP_GETBLKSIZE, &min_size);
if (min_size > blocksize) {
cond = 1;
p = min_size / blocksize;
while (cond) {
//int i = ioctl(ca->fd, SNDCTL_DSP_SUBDIVIDE, &p);
printf("the ioctl SNDCTL_DSP_SUBDIVIDE \n"); /* 由于不支持 SNDCTL_DSP_SUBDIVIDE ,用SNDCTL_DSP_SETFRAGMENT替换,这里可能使用该参数有问题? */
int i = ioctl(ca->fd, SNDCTL_DSP_SETFRAGMENT, &p);
printf("the ioctl SNDCTL_DSP_SETFRAGMENT i is %d\n",i); }
我是再做voip的语音传输部分,需要控制dsp缓冲区的块大小
如上控制之后,提示
dma0: loadbuffer:timeout loading buffer
dma enqueue failed.
请大家指教,十分感谢!