-
Notifications
You must be signed in to change notification settings - Fork 7.7k
bluetooth: audio: add bt_audio_get_chan_count #72849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bluetooth: audio: add bt_audio_get_chan_count #72849
Conversation
Hello @bbaa-demant, and thank you very much for your first pull request to the Zephyr project! |
@bbaa-demant Please add a closing keyword for the issue so that this PR gets linked to it. Did you consider the POPCOUNT as suggested by #69617 (comment)? Please also go through samples/tests to see where this function is duplicated, and replace the individual implementations with the one introduced by this PR |
I am not sure if the POPCOUNT (or __builtin_popcount) works with other toolchains beside gcc, (count_bits could be also an option). I will investigate it... |
@Thalley I think your comments have been resolved in my last commit (5 days ago)... |
Yeah, sorry, a lot of Github notifications has gone lost last week :s |
We could also consider adding a public API for counting bits in a value and have the optimization of the compiler exist in that. |
* | ||
* @param chan_allocation The channel allocation | ||
* | ||
* @retval The number of channels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @retval The number of channels. | |
* @return The number of channels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the implementation and for the quick updates.
I have a single comment left with some minor formatting that isn't required, but may be better.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look like you accidentally added a merge commit rather than rebased on main
Yes, but not accidentally! I needed to restart the builds/checks because there was an error (unknown to me) related to documentation build... Thank you very much for your support. |
Hi @bbaa-demant! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 |
I have contributed the following PRs: zephyrproject-rtos/zephyr#80000 zephyrproject-rtos/zephyr#79360 zephyrproject-rtos/zephyr#78846 zephyrproject-rtos/zephyr#78751 zephyrproject-rtos/zephyr#74950 zephyrproject-rtos/zephyr#74946 zephyrproject-rtos/zephyr#73845 zephyrproject-rtos/zephyr#72849 and am attending the weekly LE Audio Zephyr meetings. (cherry picked from commit c903013) Original-Signed-off-by: Babak Arisian <bbaa@demant.com> GitOrigin-RevId: c903013 Cr-Build-Id: 8732568629207591185 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8732568629207591185 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: Iab40058a1cc005e6454c07b4156fc271c0b84fca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5982745 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Implement a function bt_audio_get_chan_count that takes an enum bt_audio_location and returns the number of channels in that value.