diff --git a/components/drivers/audio/audio.c b/components/drivers/audio/audio.c index edef7d0eeb075a3a49a24feb0d6327afdb14a51d..601563cfec149c6cfd939f105beffa6889c1ef76 100644 --- a/components/drivers/audio/audio.c +++ b/components/drivers/audio/audio.c @@ -217,6 +217,7 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) RT_ASSERT(dev != RT_NULL); audio = (struct rt_audio_device *) dev; + char rt_name[RT_NAME_MAX * 2]; /* initialize replay & record */ audio->replay = RT_NULL; @@ -232,7 +233,8 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) rt_memset(replay, 0, sizeof(struct rt_audio_replay)); /* init memory pool for replay */ - replay->mp = rt_mp_create("adu_mp", RT_AUDIO_REPLAY_MP_BLOCK_COUNT, RT_AUDIO_REPLAY_MP_BLOCK_SIZE); + rt_snprintf(rt_name, sizeof(rt_name), "%s_adu_mp", audio->parent.parent.name); + replay->mp = rt_mp_create(rt_name, RT_AUDIO_REPLAY_MP_BLOCK_COUNT, RT_AUDIO_REPLAY_MP_BLOCK_SIZE); if (replay->mp == RT_NULL) { rt_free(replay); @@ -244,7 +246,8 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) rt_data_queue_init(&replay->queue, CFG_AUDIO_REPLAY_QUEUE_COUNT, 0, RT_NULL); /* init mutex lock for audio replay */ - rt_mutex_init(&replay->lock, "replay", RT_IPC_FLAG_PRIO); + rt_snprintf(rt_name, sizeof(rt_name), "%s_replay", audio->parent.parent.name); + rt_mutex_init(&replay->lock, rt_name, RT_IPC_FLAG_PRIO); replay->activated = RT_FALSE; audio->replay = replay; @@ -268,7 +271,8 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) LOG_E("malloc memory for for record pipe failed"); return -RT_ENOMEM; } - rt_audio_pipe_init(&record->pipe, "record", + rt_snprintf(rt_name, sizeof(rt_name), "%s_record", audio->parent.parent.name); + rt_audio_pipe_init(&record->pipe, rt_name, (rt_int32_t)(RT_PIPE_FLAG_FORCE_WR | RT_PIPE_FLAG_BLOCK_RD), buffer, RT_AUDIO_RECORD_PIPE_SIZE);