-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sof_api: sink: source: Move sink/source api headers to sof_api
Moved header files to the sof_api directory to separate an shared interface used by sof and native loadable modules. Signed-off-by: Adrian Warecki <[email protected]>
- Loading branch information
1 parent
c93f106
commit 9c25890
Showing
16 changed files
with
667 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* | ||
* Copyright(c) 2018 Intel Corporation. All rights reserved. | ||
* Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
* | ||
* Author: Liam Girdwood <[email protected]> | ||
* Keyon Jie <[email protected]> | ||
|
@@ -16,6 +16,7 @@ | |
#ifndef __IPC_STREAM_H__ | ||
#define __IPC_STREAM_H__ | ||
|
||
#include <sof_api/ipc/stream.h> | ||
#include <ipc/header.h> | ||
#include <stdint.h> | ||
|
||
|
@@ -48,18 +49,6 @@ | |
/* generic PCM flags for runtime settings */ | ||
#define SOF_PCM_FLAG_XRUN_STOP (1 << 0) /**< Stop on any XRUN */ | ||
|
||
/* stream PCM frame format */ | ||
enum sof_ipc_frame { | ||
SOF_IPC_FRAME_S16_LE = 0, | ||
SOF_IPC_FRAME_S24_4LE, | ||
SOF_IPC_FRAME_S32_LE, | ||
SOF_IPC_FRAME_FLOAT, | ||
/* other formats here */ | ||
SOF_IPC_FRAME_S24_3LE, | ||
SOF_IPC_FRAME_S24_4LE_MSB, | ||
SOF_IPC_FRAME_U8, | ||
}; | ||
|
||
/* stream buffer format */ | ||
enum sof_ipc_buffer_format { | ||
SOF_IPC_BUFFER_INTERLEAVED, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* | ||
* Copyright(c) 2020 Intel Corporation. All rights reserved. | ||
* Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
* | ||
* Author: Karol Trzcinski <[email protected]> | ||
*/ | ||
|
@@ -26,6 +26,7 @@ | |
#include <rtos/cache.h> | ||
#include <ipc/stream.h> | ||
#include <ipc4/base-config.h> | ||
#include <sof_api/audio/audio_stream.h> | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
@@ -34,43 +35,6 @@ | |
* @{ | ||
*/ | ||
|
||
/** | ||
* set of parameters describing audio stream | ||
* this structure is shared between audio_stream.h and sink/source interface | ||
* TODO: compressed formats | ||
*/ | ||
struct sof_audio_stream_params { | ||
enum sof_ipc_frame frame_fmt; /**< Sample data format */ | ||
enum sof_ipc_frame valid_sample_fmt; | ||
|
||
uint32_t rate; /**< Number of data frames per second [Hz] */ | ||
uint16_t channels; /**< Number of samples in each frame */ | ||
|
||
/** | ||
* align_frame_cnt indicates minimum number of frames that satisfies both byte | ||
* align and frame align requirements. E.g: Consider an algorithm that processes | ||
* in blocks of 3 frames configured to process 16-bit stereo using xtensa HiFi3 | ||
* SIMD. Therefore with 16-bit stereo we have a frame size of 4 bytes, and | ||
* SIMD intrinsic requirement of 8 bytes(2 frames) for HiFi3 and an algorithim | ||
* requirement of 3 frames. Hence the common processing block size has to align | ||
* with frame(1), intrinsic(2) and algorithm (3) giving us an optimum processing | ||
* block size of 6 frames. | ||
*/ | ||
uint16_t align_frame_cnt; | ||
|
||
/** | ||
* the free/available bytes of sink/source right shift align_shift_idx, the result | ||
* multiplied by align_frame_cnt is the frame count free/available that can meet | ||
* the align requirement. | ||
*/ | ||
uint16_t align_shift_idx; | ||
|
||
bool overrun_permitted; /**< indicates whether overrun is permitted */ | ||
bool underrun_permitted; /**< indicates whether underrun is permitted */ | ||
|
||
uint32_t buffer_fmt; /**< enum sof_ipc_buffer_format */ | ||
}; | ||
|
||
/** | ||
* Audio stream is a circular buffer aware of audio format of the data | ||
* in the buffer so provides API for reading and writing not only bytes, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* | ||
* Copyright(c) 2016 Intel Corporation. All rights reserved. | ||
* Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
* | ||
* Author: Seppo Ingalsuo <[email protected]> | ||
* Liam Girdwood <[email protected]> | ||
|
@@ -28,6 +28,7 @@ | |
|
||
#include <ipc/stream.h> | ||
#include <stdint.h> | ||
#include <sof_api/ipc/stream.h> | ||
|
||
/* Maximum and minimum values for 24 bit */ | ||
#define INT24_MAXVALUE 8388607 | ||
|
@@ -165,39 +166,4 @@ static inline int32_t sign_extend_s24(int32_t x) | |
return (x << 8) >> 8; | ||
} | ||
|
||
static inline uint32_t get_sample_bytes(enum sof_ipc_frame fmt) | ||
{ | ||
switch (fmt) { | ||
case SOF_IPC_FRAME_S16_LE: | ||
return 2; | ||
case SOF_IPC_FRAME_S24_3LE: | ||
return 3; | ||
case SOF_IPC_FRAME_U8: | ||
return 1; | ||
default: | ||
return 4; | ||
} | ||
} | ||
|
||
static inline uint32_t get_sample_bitdepth(enum sof_ipc_frame fmt) | ||
{ | ||
switch (fmt) { | ||
case SOF_IPC_FRAME_S16_LE: | ||
return 16; | ||
case SOF_IPC_FRAME_S24_4LE: | ||
case SOF_IPC_FRAME_S24_3LE: | ||
return 24; | ||
case SOF_IPC_FRAME_U8: | ||
return 8; | ||
default: | ||
return 32; | ||
} | ||
} | ||
|
||
static inline uint32_t get_frame_bytes(enum sof_ipc_frame fmt, | ||
uint32_t channels) | ||
{ | ||
return get_sample_bytes(fmt) * channels; | ||
} | ||
|
||
#endif /* __SOF_AUDIO_FORMAT_H__ */ |
Oops, something went wrong.