Skip to content
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

Rename IS_ALIGN() to SOF_IS_ALIGN() #8755

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ static int dai_set_sg_config(struct dai_data *dd, struct comp_dev *dev, uint32_t
period_count);
buf_size = period_count * period_bytes;
do {
if (IS_ALIGNED(buf_size, max_block_count)) {
if (SOF_IS_ALIGNED(buf_size, max_block_count)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it the plan then after zephyrproject-rtos/zephyr#67243 is merged to move to the "proper" Zephyr-provided IS_ALIGNED() and to rename back?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an alternative would be to take the Zephyr change with IS_ALIGNED in, then add IS_ALIGNED definition only for xtos builds in SOF, and call it a day.

The current ifdef can carry us until then.

Or we merge this, but I agree this is going against our long term plans. We want to use native Zephyr interfaces in generic SOF code whenever possible (e.g. #5794).

period_count = max_block_count;
period_bytes = buf_size / period_count;
break;
Expand Down
6 changes: 3 additions & 3 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ static void kpb_convert_24b_to_32b(const void *linear_source, int ioffset,
int i = 0;
ae_int24x2 d24 = AE_ZERO24();

if (!IS_ALIGNED((uintptr_t)out_ptr, 8)) {
if (!SOF_IS_ALIGNED((uintptr_t)out_ptr, 8)) {
AE_LA24_IP(d24, align_in, in);
ae_int32x2 d320 = d24;
int higher = AE_MOVAD32_H(d320);
Expand Down Expand Up @@ -1996,7 +1996,7 @@ static void kpb_convert_32b_to_24b(const struct audio_stream *source, int ioffse
ae_f24x2 vs = AE_ZERO24();
ae_valign align_out = AE_ZALIGN64();

if (!IS_ALIGNED((uintptr_t)sin, 8)) {
if (!SOF_IS_ALIGNED((uintptr_t)sin, 8)) {
AE_L32F24_XC(vs, (const ae_f24 *)sin, 4);
AE_SA24_IP(vs, align_out, sout);
n_samples--;
Expand Down Expand Up @@ -2154,7 +2154,7 @@ static void kpb_copy_24b_in_32b(const struct audio_stream *source, uint32_t ioff
ae_int32x2 *sout = (ae_int32x2 *)out;
ae_int32x2 vs = AE_ZERO32();

if (!IS_ALIGNED((uintptr_t)sin, 8)) {
if (!SOF_IS_ALIGNED((uintptr_t)sin, 8)) {
AE_L32_IP(vs, (const ae_int32 *)sin, 4);
AE_S32_L_IP(vs, (ae_int32 *)sout, 4);
n_samples--;
Expand Down
8 changes: 1 addition & 7 deletions src/include/sof/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
/* callers must check/use the return value */
#define __must_check __attribute__((warn_unused_result))

#ifdef __ZEPHYR__
#include <zephyr/sys/util.h>
#endif

/* Align the number to the nearest alignment value */
#ifndef IS_ALIGNED
#define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0)
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if zephyrproject-rtos/zephyr#67243 happens to be merged before this (yes, I know that it's currently blocked) and we move to a Zephyr version after it, this would break compilation. Why not just merge these two commits?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably should hold of until we can get the Zephyr interface merged in. We have the SMP interface in flight (plus the regression), so the air is getting too thick with incompatible combinations.

#define SOF_IS_ALIGNED(size, alignment) ((size) % (alignment) == 0)

/* Treat zero as a special case because it wraps around */
#define is_power_of_2(x) ((x) && !((x) & ((x) - 1)))
Expand Down
Loading