-
Notifications
You must be signed in to change notification settings - Fork 349
Add GET_BIT() and GET_BITS() macros to bit.h #4256
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
Add GET_BIT() and GET_BITS() macros to bit.h #4256
Conversation
lgirdwood
left a comment
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.
@singalsu can you check and see if these are the same naming and usages as Zephyr versions. We should align.
|
There's in Zephyr e.g. drivers/neural_net/intel_gna.h one with different way than mine. This shifts left and right other bits out of uint32 except requested one. Mine ANDs with bit mask and shift right the result, and works with other world lengths too. The macro params order is different. I could not spot anything similar from https://github.com/zephyrproject-rtos/zephyr with quick grep for BIT and GET. Edit: one more from drivers/ethernet/eth_smsc911x_priv.h with different way and different macro parameters. This might fail with 64 bit. |
|
Won't approve until I see the intended use case. |
132c1df to
35ba93b
Compare
|
@paulstelian97 The macros are used in this another PR file https://github.com/thesofproject/sof/blob/8d68ef2832b4fcdfabaccce00f95952a09a6b3a5/src/drivers/intel/dmic/dmic_nhlt.c . It was a proposal by Liam to make a separate PR for this. Edit: Sorry, not that file but the header it uses https://github.com/thesofproject/sof/blob/8d68ef2832b4fcdfabaccce00f95952a09a6b3a5/src/include/sof/drivers/dmic.h . See e.g. line 161 -> |
These macros are useful for decoding bit fields. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
35ba93b to
799230e
Compare
paulstelian97
left a comment
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.
I guess they look good now. An extra commit to use MASK in the pre-existing SET_BITS wouldn't be bad but I won't require it.
These macros are useful for decoding bit fields.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com