fir: Mark source buffer as const in processing functions

Const keyword is added to explicitly indicate that nothing in given
source buffer can be changed in processing functions - read pointers also.
Moreover same thing needs to be done in *setup_circular functions
to achieve successful compilation.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-01-16 13:31:13 +01:00 committed by Liam Girdwood
parent 9a091a1320
commit be8c48bbeb
5 changed files with 48 additions and 30 deletions

View File

@ -70,7 +70,7 @@ struct comp_data {
size_t fir_delay_size; /**< allocated size */
bool config_ready; /**< set when fully received */
void (*eq_fir_func)(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
};
@ -181,7 +181,7 @@ static inline int set_fir_func(struct comp_dev *dev)
#if CONFIG_FORMAT_S16LE
static void eq_fir_s16_passthrough(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
@ -191,7 +191,7 @@ static void eq_fir_s16_passthrough(struct fir_state_32x16 fir[],
#if CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE
static void eq_fir_s32_passthrough(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{

View File

@ -83,7 +83,7 @@ void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift,
* sample per call.
*/
void eq_fir_2x_s32_hifiep(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
@ -124,7 +124,8 @@ void eq_fir_2x_s32_hifiep(struct fir_state_32x16 fir[],
}
/* FIR for any number of frames */
void eq_fir_s32_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s32_hifiep(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch)
{
struct fir_state_32x16 *f;
@ -160,7 +161,7 @@ void eq_fir_s32_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
#if CONFIG_FORMAT_S24LE
void eq_fir_2x_s24_hifiep(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
@ -205,7 +206,8 @@ void eq_fir_2x_s24_hifiep(struct fir_state_32x16 fir[],
}
/* FIR for any number of frames */
void eq_fir_s24_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s24_hifiep(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch)
{
struct fir_state_32x16 *f;
@ -243,7 +245,7 @@ void eq_fir_s24_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
#if CONFIG_FORMAT_S16LE
void eq_fir_2x_s16_hifiep(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
@ -288,7 +290,8 @@ void eq_fir_2x_s16_hifiep(struct fir_state_32x16 fir[],
}
/* FIR for any number of frames */
void eq_fir_s16_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s16_hifiep(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch)
{
struct fir_state_32x16 *f;

View File

@ -83,7 +83,8 @@ void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift,
* sample per call.
*/
void eq_fir_2x_s32_hifi3(struct fir_state_32x16 fir[],
struct comp_buffer *source, struct comp_buffer *sink,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
struct fir_state_32x16 *f;
@ -142,7 +143,8 @@ void eq_fir_2x_s32_hifi3(struct fir_state_32x16 fir[],
}
/* FIR for any number of frames */
void eq_fir_s32_hifi3(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s32_hifi3(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch)
{
struct fir_state_32x16 *f;
@ -200,7 +202,8 @@ void eq_fir_s32_hifi3(struct fir_state_32x16 fir[], struct comp_buffer *source,
#if CONFIG_FORMAT_S24LE
void eq_fir_2x_s24_hifi3(struct fir_state_32x16 fir[],
struct comp_buffer *source, struct comp_buffer *sink,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
struct fir_state_32x16 *f;
@ -264,7 +267,8 @@ void eq_fir_2x_s24_hifi3(struct fir_state_32x16 fir[],
}
}
void eq_fir_s24_hifi3(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s24_hifi3(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch)
{
struct fir_state_32x16 *f;
@ -327,7 +331,8 @@ void eq_fir_s24_hifi3(struct fir_state_32x16 fir[], struct comp_buffer *source,
#if CONFIG_FORMAT_S16LE
void eq_fir_2x_s16_hifi3(struct fir_state_32x16 fir[],
struct comp_buffer *source, struct comp_buffer *sink,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch)
{
struct fir_state_32x16 *f;
@ -395,7 +400,8 @@ void eq_fir_2x_s16_hifi3(struct fir_state_32x16 fir[],
}
}
void eq_fir_s16_hifi3(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s16_hifi3(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch)
{
struct fir_state_32x16 *f;

View File

@ -39,32 +39,35 @@ int fir_init_coef(struct fir_state_32x16 *fir,
void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data);
void eq_fir_s16_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s16_hifiep(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch);
void eq_fir_2x_s16_hifiep(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
void eq_fir_s24_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s24_hifiep(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch);
void eq_fir_2x_s24_hifiep(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
void eq_fir_s32_hifiep(struct fir_state_32x16 fir[], struct comp_buffer *source,
void eq_fir_s32_hifiep(struct fir_state_32x16 fir[],
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch);
void eq_fir_2x_s32_hifiep(struct fir_state_32x16 fir[],
struct comp_buffer *source,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
/* Setup circular buffer for FIR input data delay */
static inline void fir_hifiep_setup_circular(struct fir_state_32x16 *fir)
static inline void fir_hifiep_setup_circular(const struct fir_state_32x16 *fir)
{
AE_SETCBEGIN0(fir->delay);
AE_SETCEND0(fir->delay_end);

View File

@ -39,41 +39,47 @@ int fir_init_coef(struct fir_state_32x16 *fir,
void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data);
#if CONFIG_FORMAT_S16LE
void eq_fir_s16_hifi3(struct fir_state_32x16 *fir, struct comp_buffer *source,
void eq_fir_s16_hifi3(struct fir_state_32x16 *fir,
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch);
void eq_fir_2x_s16_hifi3(struct fir_state_32x16 *fir,
struct comp_buffer *source, struct comp_buffer *sink,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
#endif /* CONFIG_FORMAT_S16LE */
#if CONFIG_FORMAT_S24LE
void eq_fir_s24_hifi3(struct fir_state_32x16 *fir, struct comp_buffer *source,
void eq_fir_s24_hifi3(struct fir_state_32x16 *fir,
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch);
void eq_fir_2x_s24_hifi3(struct fir_state_32x16 *fir,
struct comp_buffer *source, struct comp_buffer *sink,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
#endif /* CONFIG_FORMAT_S24LE */
#if CONFIG_FORMAT_S32LE
void eq_fir_s32_hifi3(struct fir_state_32x16 *fir, struct comp_buffer *source,
void eq_fir_s32_hifi3(struct fir_state_32x16 *fir,
const struct comp_buffer *source,
struct comp_buffer *sink, int frames, int nch);
void eq_fir_2x_s32_hifi3(struct fir_state_32x16 *fir,
struct comp_buffer *source, struct comp_buffer *sink,
const struct comp_buffer *source,
struct comp_buffer *sink,
int frames, int nch);
#endif /* CONFIG_FORMAT_S32LE */
/* Setup circular buffer for FIR input data delay */
static inline void fir_core_setup_circular(struct fir_state_32x16 *fir)
static inline void fir_core_setup_circular(const struct fir_state_32x16 *fir)
{
AE_SETCBEGIN0(fir->delay);
AE_SETCEND0(fir->delay_end);
}
/* Setup circular for component buffer */
static inline void fir_comp_setup_circular(struct comp_buffer *buffer)
static inline void fir_comp_setup_circular(const struct comp_buffer *buffer)
{
AE_SETCBEGIN0(buffer->addr);
AE_SETCEND0(buffer->end_addr);