diff --git a/src/audio/audio_stream.c b/src/audio/audio_stream.c index 27a64731d45c..0308e036755c 100644 --- a/src/audio/audio_stream.c +++ b/src/audio/audio_stream.c @@ -49,7 +49,8 @@ static size_t audio_stream_get_data_available(struct sof_source *source) } static int audio_stream_get_data(struct sof_source *source, size_t req_size, - void **data_ptr, void **buffer_start, size_t *buffer_size) + void const **data_ptr, void const **buffer_start, + size_t *buffer_size) { struct audio_stream *audio_stream = container_of(source, struct audio_stream, source_api); struct comp_buffer *buffer = container_of(audio_stream, struct comp_buffer, stream); diff --git a/src/audio/sink_source_utils.c b/src/audio/sink_source_utils.c index 5a0d17608be4..3b79c8c2d5e1 100644 --- a/src/audio/sink_source_utils.c +++ b/src/audio/sink_source_utils.c @@ -15,9 +15,9 @@ int source_to_sink_copy(struct sof_source *source, struct sof_sink *sink, bool free, size_t size) { - uint8_t *src_ptr; - uint8_t *src_begin; - uint8_t *src_end; + uint8_t const *src_ptr; + uint8_t const *src_begin; + uint8_t const *src_end; uint8_t *dst_ptr; uint8_t *dst_begin; uint8_t *dst_end; @@ -32,8 +32,8 @@ int source_to_sink_copy(struct sof_source *source, return -ENOSPC; ret = source_get_data(source, size, - (void **)&src_ptr, - (void **)&src_begin, + (void const **)&src_ptr, + (void const **)&src_begin, &src_size); if (ret) return ret; diff --git a/src/audio/source_api_helper.c b/src/audio/source_api_helper.c index 1483fb6603c9..f71cf5bdc7e1 100644 --- a/src/audio/source_api_helper.c +++ b/src/audio/source_api_helper.c @@ -21,7 +21,7 @@ size_t source_get_data_available(struct sof_source *source) } int source_get_data(struct sof_source *source, size_t req_size, - void **data_ptr, void **buffer_start, size_t *buffer_size) + void const **data_ptr, void const **buffer_start, size_t *buffer_size) { int ret; diff --git a/src/audio/src/src.c b/src/audio/src/src.c index 65b8ae965abd..752f0f7a1825 100644 --- a/src/audio/src/src.c +++ b/src/audio/src/src.c @@ -94,7 +94,7 @@ struct comp_data { uint32_t sink_rate; uint32_t source_rate; int32_t *sbuf_w_ptr; - int32_t *sbuf_r_ptr; + int32_t const *sbuf_r_ptr; int sbuf_avail; int data_shift; int source_frames; @@ -353,7 +353,8 @@ static int src_2s(struct comp_data *cd, int s2_blk_out; uint32_t n_read = 0, n_written = 0; int ret; - uint8_t *buffer_start; + uint8_t const *source_buffer_start; + uint8_t *sink_buffer_start; void *sbuf_end_addr = &cd->delay_lines[cd->param.sbuf_length]; size_t sbuf_size = cd->param.sbuf_length * sizeof(int32_t); /* chan sink == chan src therefore we only need to use one*/ @@ -366,18 +367,18 @@ static int src_2s(struct comp_data *cd, uint32_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink); ret = source_get_data(source, source_frag_size, - &s1.x_rptr, (void **)&buffer_start, &s1.x_size); + &s1.x_rptr, (void const **)&source_buffer_start, &s1.x_size); if (ret) return ret; - s1.x_end_addr = buffer_start + s1.x_size; + s1.x_end_addr = source_buffer_start + s1.x_size; ret = sink_get_buffer(sink, sink_frag_size, - &s2.y_wptr, (void **)&buffer_start, &s2.y_size); + &s2.y_wptr, (void **)&sink_buffer_start, &s2.y_size); if (ret) { source_release_data(source, 0); return ret; } - s2.y_end_addr = buffer_start + s2.y_size; + s2.y_end_addr = sink_buffer_start + s2.y_size; s1.y_end_addr = sbuf_end_addr; s1.y_size = sbuf_size; @@ -448,23 +449,24 @@ static int src_1s(struct comp_data *cd, struct sof_source *source, { struct src_stage_prm s1; int ret; - uint8_t *buffer_start; + uint8_t const *source_buffer_start; + uint8_t *sink_buffer_start; uint32_t source_frag_size = cd->param.blk_in * source_get_frame_bytes(source); uint32_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink); ret = source_get_data(source, source_frag_size, - &s1.x_rptr, (void **)&buffer_start, &s1.x_size); + &s1.x_rptr, (void const **)&source_buffer_start, &s1.x_size); if (ret) return ret; - s1.x_end_addr = buffer_start + s1.x_size; + s1.x_end_addr = source_buffer_start + s1.x_size; ret = sink_get_buffer(sink, sink_frag_size, - &s1.y_wptr, (void **)&buffer_start, &s1.y_size); + &s1.y_wptr, (void **)&sink_buffer_start, &s1.y_size); if (ret) { source_release_data(source, 0); return ret; } - s1.y_end_addr = buffer_start + s1.y_size; + s1.y_end_addr = sink_buffer_start + s1.y_size; s1.times = cd->param.stage1_times; s1.state = &cd->src.state1; diff --git a/src/include/sof/audio/source_api.h b/src/include/sof/audio/source_api.h index 785b15167b17..e4bd132a8ada 100644 --- a/src/include/sof/audio/source_api.h +++ b/src/include/sof/audio/source_api.h @@ -94,7 +94,7 @@ size_t source_get_data_frames_available(struct sof_source *source); * @retval -ENODATA if req_size is bigger than available data */ int source_get_data(struct sof_source *source, size_t req_size, - void **data_ptr, void **buffer_start, size_t *buffer_size); + void const **data_ptr, void const **buffer_start, size_t *buffer_size); /** * Releases fragment previously obtained by source_get_data() diff --git a/src/include/sof/audio/source_api_implementation.h b/src/include/sof/audio/source_api_implementation.h index 4977c81e86d2..5f2a9ffb4803 100644 --- a/src/include/sof/audio/source_api_implementation.h +++ b/src/include/sof/audio/source_api_implementation.h @@ -33,7 +33,7 @@ struct source_ops { * see comment of source_get_data_available() */ int (*get_data)(struct sof_source *source, size_t req_size, - void **data_ptr, void **buffer_start, size_t *buffer_size); + void const **data_ptr, void const **buffer_start, size_t *buffer_size); /** * see comment of source_release_data() diff --git a/src/include/sof/audio/src/src.h b/src/include/sof/audio/src/src.h index 6fa936fc74eb..b86f0440fe5d 100644 --- a/src/include/sof/audio/src/src.h +++ b/src/include/sof/audio/src/src.h @@ -61,8 +61,8 @@ struct polyphase_src { struct src_stage_prm { int nch; int times; - void *x_rptr; - void *x_end_addr; + void const *x_rptr; + void const *x_end_addr; size_t x_size; void *y_wptr; void *y_addr;