mirror of https://github.com/thesofproject/sof.git
buffer: Move functions using trace system to buffer.c
Then trace location in output trace file is correct. Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
parent
fb838de413
commit
137c90bbc6
|
@ -99,6 +99,16 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void buffer_zero(struct comp_buffer *buffer)
|
||||||
|
{
|
||||||
|
buf_dbg(buffer, "stream_zero()");
|
||||||
|
|
||||||
|
bzero(buffer->stream.addr, buffer->stream.size);
|
||||||
|
if (buffer->caps & SOF_MEM_CAPS_DMA)
|
||||||
|
dcache_writeback_region(buffer->stream.addr,
|
||||||
|
buffer->stream.size);
|
||||||
|
}
|
||||||
|
|
||||||
int buffer_set_size(struct comp_buffer *buffer, uint32_t size)
|
int buffer_set_size(struct comp_buffer *buffer, uint32_t size)
|
||||||
{
|
{
|
||||||
void *new_ptr = NULL;
|
void *new_ptr = NULL;
|
||||||
|
@ -131,6 +141,35 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int buffer_set_params(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
|
bool force_update)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!params) {
|
||||||
|
buf_err(buffer, "buffer_set_params(): !params");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer->hw_params_configured && !force_update)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ret = audio_stream_set_params(&buffer->stream, params);
|
||||||
|
if (ret < 0) {
|
||||||
|
buf_err(buffer, "buffer_set_params(): audio_stream_set_params failed");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->buffer_fmt = params->buffer_fmt;
|
||||||
|
for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++)
|
||||||
|
buffer->chmap[i] = params->chmap[i];
|
||||||
|
|
||||||
|
buffer->hw_params_configured = true;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
uint32_t flag)
|
uint32_t flag)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,6 +158,7 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t align);
|
||||||
struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc);
|
struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc);
|
||||||
int buffer_set_size(struct comp_buffer *buffer, uint32_t size);
|
int buffer_set_size(struct comp_buffer *buffer, uint32_t size);
|
||||||
void buffer_free(struct comp_buffer *buffer);
|
void buffer_free(struct comp_buffer *buffer);
|
||||||
|
void buffer_zero(struct comp_buffer *buffer);
|
||||||
|
|
||||||
/* called by a component after producing data into this buffer */
|
/* called by a component after producing data into this buffer */
|
||||||
void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes);
|
void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes);
|
||||||
|
@ -165,6 +166,9 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes);
|
||||||
/* called by a component after consuming data from this buffer */
|
/* called by a component after consuming data from this buffer */
|
||||||
void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes);
|
void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes);
|
||||||
|
|
||||||
|
int buffer_set_params(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
|
bool force_update);
|
||||||
|
|
||||||
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
uint32_t flag);
|
uint32_t flag);
|
||||||
|
|
||||||
|
@ -224,16 +228,6 @@ static inline void buffer_unlock(struct comp_buffer *buffer, uint32_t flags)
|
||||||
spin_unlock_irq(lock, flags);
|
spin_unlock_irq(lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void buffer_zero(struct comp_buffer *buffer)
|
|
||||||
{
|
|
||||||
buf_dbg(buffer, "stream_zero()");
|
|
||||||
|
|
||||||
bzero(buffer->stream.addr, buffer->stream.size);
|
|
||||||
if (buffer->caps & SOF_MEM_CAPS_DMA)
|
|
||||||
dcache_writeback_region(buffer->stream.addr,
|
|
||||||
buffer->stream.size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void buffer_reset_pos(struct comp_buffer *buffer, void *data)
|
static inline void buffer_reset_pos(struct comp_buffer *buffer, void *data)
|
||||||
{
|
{
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
@ -269,34 +263,4 @@ static inline void buffer_reset_params(struct comp_buffer *buffer, void *data)
|
||||||
buffer_unlock(buffer, flags);
|
buffer_unlock(buffer, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int buffer_set_params(struct comp_buffer *buffer,
|
|
||||||
struct sof_ipc_stream_params *params,
|
|
||||||
bool force_update)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!params) {
|
|
||||||
buf_err(buffer, "buffer_set_params(): !params");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buffer->hw_params_configured && !force_update)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ret = audio_stream_set_params(&buffer->stream, params);
|
|
||||||
if (ret < 0) {
|
|
||||||
buf_err(buffer, "buffer_set_params(): audio_stream_set_params failed");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer->buffer_fmt = params->buffer_fmt;
|
|
||||||
for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++)
|
|
||||||
buffer->chmap[i] = params->chmap[i];
|
|
||||||
|
|
||||||
buffer->hw_params_configured = true;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __SOF_AUDIO_BUFFER_H__ */
|
#endif /* __SOF_AUDIO_BUFFER_H__ */
|
||||||
|
|
|
@ -48,4 +48,10 @@ struct sof *sof_get(void)
|
||||||
return &sof;
|
return &sof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int buffer_set_params(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
|
bool force_update)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -131,6 +131,20 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void buffer_zero(struct comp_buffer *buffer)
|
||||||
|
{
|
||||||
|
(void)buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int buffer_set_params(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
|
bool force_update)
|
||||||
|
{
|
||||||
|
(void)buffer;
|
||||||
|
(void)params;
|
||||||
|
(void)force_update;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
|
||||||
uint32_t flag)
|
uint32_t flag)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue