adc: add IOCTL commands ANIOC_RESET_FIFO and ANIOC_SAMPLES_ON_READ #4288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This commit adds two new IOCTL commnands for ADC driver. Command ANIOC_RESET_FIFO resets FIFO head and tail which causes the driver to wait for the new data to be received. Calling this command before reading ADC data in user space ensures that the read data are newly sampled.
Command ANIOC_SAMPLES_ON_READ return the number of read channels in the buffer. This can be useful in nonblocking mode when the application needs to get the samples received before the app was started.
Both IOCTL commands are used only in generic driver section only and do not have any effect on existing architecture specific drivers.
Impact
ADC driver, no impact for current applications.
Testing
Tested on Teensy 4.1