linguini1 commented on code in PR #18348:
URL: https://github.com/apache/nuttx/pull/18348#discussion_r2766101066
##########
audio/audio.c:
##########
@@ -649,6 +1130,97 @@ static int audio_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
}
break;
+ /* AUDIOIOC_GETAUDIOINFO - Get the last playing audio format
+ *
+ * ioctl argument - pointer to receive the audio info
+ */
+
+ case AUDIOIOC_GETAUDIOINFO:
+ {
+ if (lower->ops->ioctl == NULL ||
+ lower->ops->ioctl(lower, AUDIOIOC_GETAUDIOINFO, arg) < 0)
+ {
+ memcpy((void *)arg, &upper->info, sizeof(struct audio_info_s));
+ }
+
+ ret = OK;
+ }
+ break;
+
+ /* AUDIOIOC_GETSTATUS - Get lower driver state
+ *
+ * ioctl argument - pointer to receive the state
+ */
+
+ case AUDIOIOC_GETSTATUS:
+ {
+ memcpy((void *)arg, upper->status, sizeof(struct audio_status_s));
+ ret = OK;
+ }
+ 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;
+
+ /* AUDIOIOC_SETBUFFERINFO - Set buffer information
+ *
+ * ioctl argument - pointer to set the buffer information
+ */
+
+ case AUDIOIOC_SETBUFFERINFO:
Review Comment:
Would you be willing to write some documentation about what these IOCTL
commands do here:
https://nuttx.apache.org/docs/latest/components/audio/index.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]