nuttx/audio: Add AUDIOIOC_RESETSTATUS ioctl

use AUDIOIOC_RESETSTATUS to reset application pointer

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
This commit is contained in:
yangyalei
2025-08-12 19:37:31 +08:00
committed by Alan C. Assis
parent f8ab192285
commit 8db9865a03
2 changed files with 29 additions and 0 deletions
+28
View File
@@ -1079,6 +1079,34 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
break;
/* AUDIOIOC_RESETSTATUS - Reset appl head
*
* ioctl argument - pointer to receive the state
*/
case AUDIOIOC_RESETSTATUS:
{
struct audio_buf_desc_s buf_desc;
int target;
buf_desc.numbytes = upper->apbs[0]->nmaxbytes;
buf_desc.u.pbuffer = NULL;
priv->head = upper->status->head;
target = MAX(upper->status->head,
upper->status->tail + upper->periods - 1);
if (priv->state == AUDIO_STATE_XRUN)
{
priv->state = AUDIO_STATE_RUNNING;
}
while (priv->head < target)
{
audio_enqueuebuffer(filep, &buf_desc);
}
}
break;
/* Any unrecognized IOCTL commands might be
* platform-specific ioctl commands
*/
+1
View File
@@ -119,6 +119,7 @@
#define AUDIOIOC_GETPOSITION _AUDIOIOC(21)
#define AUDIOIOC_GETAUDIOINFO _AUDIOIOC(22)
#define AUDIOIOC_GETSTATUS _AUDIOIOC(23)
#define AUDIOIOC_RESETSTATUS _AUDIOIOC(24)
/* Audio Device Types *******************************************************/