summaryrefslogtreecommitdiff
path: root/components/drivers/audio/audio_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/drivers/audio/audio_pipe.c')
-rw-r--r--components/drivers/audio/audio_pipe.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/components/drivers/audio/audio_pipe.c b/components/drivers/audio/audio_pipe.c
index d6975e962c..d7c37009b6 100644
--- a/components/drivers/audio/audio_pipe.c
+++ b/components/drivers/audio/audio_pipe.c
@@ -24,8 +24,8 @@ static void _rt_pipe_resume_writer(struct rt_audio_pipe *pipe)
/* get suspended thread */
thread = rt_list_entry(pipe->suspended_write_list.next,
- struct rt_thread,
- tlist);
+ struct rt_thread,
+ tlist);
/* resume the write thread */
rt_thread_resume(thread);
@@ -66,7 +66,8 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
- do {
+ do
+ {
level = rt_hw_interrupt_disable();
read_nbytes = rt_ringbuffer_get(&(pipe->ringbuffer), (rt_uint8_t *)buffer, size);
if (read_nbytes == 0)
@@ -85,7 +86,8 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
rt_hw_interrupt_enable(level);
break;
}
- } while (read_nbytes == 0);
+ }
+ while (read_nbytes == 0);
return read_nbytes;
}
@@ -104,8 +106,8 @@ static void _rt_pipe_resume_reader(struct rt_audio_pipe *pipe)
/* get suspended thread */
thread = rt_list_entry(pipe->suspended_read_list.next,
- struct rt_thread,
- tlist);
+ struct rt_thread,
+ tlist);
/* resume the read thread */
rt_thread_resume(thread);
@@ -128,7 +130,7 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
RT_ASSERT(pipe != RT_NULL);
if ((pipe->flag & RT_PIPE_FLAG_FORCE_WR) ||
- !(pipe->flag & RT_PIPE_FLAG_BLOCK_WR))
+ !(pipe->flag & RT_PIPE_FLAG_BLOCK_WR))
{
level = rt_hw_interrupt_disable();
@@ -151,7 +153,8 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
- do {
+ do
+ {
level = rt_hw_interrupt_disable();
write_nbytes = rt_ringbuffer_put(&(pipe->ringbuffer), (const rt_uint8_t *)buffer, size);
if (write_nbytes == 0)
@@ -171,7 +174,8 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
rt_hw_interrupt_enable(level);
break;
}
- } while (write_nbytes == 0);
+ }
+ while (write_nbytes == 0);
return write_nbytes;
}
@@ -183,7 +187,7 @@ static rt_err_t rt_pipe_control(rt_device_t dev, int cmd, void *args)
pipe = (struct rt_audio_pipe *)dev;
if (cmd == PIPE_CTRL_GET_SPACE && args)
- *(rt_size_t*)args = rt_ringbuffer_space_len(&pipe->ringbuffer);
+ *(rt_size_t *)args = rt_ringbuffer_space_len(&pipe->ringbuffer);
return RT_EOK;
}
@@ -212,10 +216,10 @@ const static struct rt_device_ops audio_pipe_ops =
* @return the operation status, RT_EOK on successful
*/
rt_err_t rt_audio_pipe_init(struct rt_audio_pipe *pipe,
- const char *name,
- rt_int32_t flag,
- rt_uint8_t *buf,
- rt_size_t size)
+ const char *name,
+ rt_int32_t flag,
+ rt_uint8_t *buf,
+ rt_size_t size)
{
RT_ASSERT(pipe);
RT_ASSERT(buf);