diff options
| author | Meco Man <[email protected]> | 2021-12-30 19:38:20 -0500 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2022-01-09 00:23:18 +0800 |
| commit | f89a162ea3be6536c340c0010aab41cffe9bfac9 (patch) | |
| tree | 38c0c03a5c5ba348d9b657ad8e7ecb6f938ddf23 /components/drivers/audio | |
| parent | bb1084556ff9395e6e5d908edfef9cab6f6fa4dc (diff) | |
[core] 使用rt_memcpy rt_memset代替memcpy memset
Diffstat (limited to 'components/drivers/audio')
| -rw-r--r-- | components/drivers/audio/audio.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/drivers/audio/audio.c b/components/drivers/audio/audio.c index f9d42aeb5c..edef7d0eeb 100644 --- a/components/drivers/audio/audio.c +++ b/components/drivers/audio/audio.c @@ -52,14 +52,14 @@ static rt_err_t _audio_send_replay_frame(struct rt_audio_device *audio) rt_completion_done(&audio->replay->cmp); /* send zero frames */ - memset(&buf_info->buffer[audio->replay->pos], 0, dst_size); + rt_memset(&buf_info->buffer[audio->replay->pos], 0, dst_size); audio->replay->pos += dst_size; audio->replay->pos %= buf_info->total_size; } else { - memset(&buf_info->buffer[audio->replay->pos], 0, dst_size); + rt_memset(&buf_info->buffer[audio->replay->pos], 0, dst_size); /* copy data from memory pool to hardware device fifo */ while (index < dst_size) @@ -77,7 +77,7 @@ static rt_err_t _audio_send_replay_frame(struct rt_audio_device *audio) } remain_bytes = MIN((dst_size - index), (src_size - audio->replay->read_index)); - memcpy(&buf_info->buffer[audio->replay->pos], + rt_memcpy(&buf_info->buffer[audio->replay->pos], &data[audio->replay->read_index], remain_bytes); index += remain_bytes; @@ -229,7 +229,7 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) if (replay == RT_NULL) return -RT_ENOMEM; - memset(replay, 0, sizeof(struct rt_audio_replay)); + 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); @@ -258,7 +258,7 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) if (record == RT_NULL) return -RT_ENOMEM; - memset(record, 0, sizeof(struct rt_audio_record)); + rt_memset(record, 0, sizeof(struct rt_audio_record)); /* init pipe for record*/ buffer = rt_malloc(RT_AUDIO_RECORD_PIPE_SIZE); @@ -393,12 +393,12 @@ static rt_size_t _audio_dev_write(struct rt_device *dev, rt_off_t pos, const voi if (audio->replay->write_index % block_size == 0) { audio->replay->write_data = rt_mp_alloc(audio->replay->mp, RT_WAITING_FOREVER); - memset(audio->replay->write_data, 0, block_size); + rt_memset(audio->replay->write_data, 0, block_size); } /* copy data to replay memory pool */ remain_bytes = MIN((block_size - audio->replay->write_index), (size - index)); - memcpy(&audio->replay->write_data[audio->replay->write_index], &ptr[index], remain_bytes); + rt_memcpy(&audio->replay->write_data[audio->replay->write_index], &ptr[index], remain_bytes); index += remain_bytes; audio->replay->write_index += remain_bytes; |
