提交 ef5c47e6 编写于 作者: D dzzxzz@gmail.com

fixed the coding style in components/drivers/src

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2529 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 f29cfc5e
......@@ -60,7 +60,8 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
/* suspend thread */
rt_thread_suspend(thread);
/* add to suspended list */
rt_list_insert_before(&(completion->suspended_list), &(thread->tlist));
rt_list_insert_before(&(completion->suspended_list),
&(thread->tlist));
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
......@@ -69,7 +70,9 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
if (timeout > 0)
{
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout);
rt_timer_control(&(thread->thread_timer),
RT_TIMER_CTRL_SET_TIME,
&timeout);
rt_timer_start(&(thread->thread_timer));
}
/* enable interrupt */
......@@ -110,7 +113,9 @@ void rt_completion_done(struct rt_completion *completion)
struct rt_thread *thread;
/* get thread entry */
thread = rt_list_entry(completion->suspended_list.next, struct rt_thread, tlist);
thread = rt_list_entry(completion->suspended_list.next,
struct rt_thread,
tlist);
/* resume it */
rt_thread_resume(thread);
......
......@@ -94,7 +94,9 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
if (timeout > 0)
{
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout);
rt_timer_control(&(thread->thread_timer),
RT_TIMER_CTRL_SET_TIME,
&timeout);
rt_timer_start(&(thread->thread_timer));
}
......@@ -119,7 +121,9 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
/* there is at least one thread in suspended list */
/* get thread entry */
thread = rt_list_entry(queue->suspended_pop_list.next, struct rt_thread, tlist);
thread = rt_list_entry(queue->suspended_pop_list.next,
struct rt_thread,
tlist);
/* resume it */
rt_thread_resume(thread);
......@@ -183,7 +187,9 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
if (timeout > 0)
{
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout);
rt_timer_control(&(thread->thread_timer),
RT_TIMER_CTRL_SET_TIME,
&timeout);
rt_timer_start(&(thread->thread_timer));
}
......@@ -196,7 +202,8 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
/* thread is waked up */
result = thread->error;
level = rt_hw_interrupt_disable();
if (result != RT_EOK) goto __exit;
if (result != RT_EOK)
goto __exit;
}
*data_ptr = queue->queue[queue->get_index & mask].data_ptr;
......@@ -209,11 +216,16 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
{
queue->waiting_lwm = RT_FALSE;
/* there is at least one thread in suspended list and less than low water mark */
/*
* there is at least one thread in suspended list
* and less than low water mark
*/
if (!rt_list_isempty(&(queue->suspended_push_list)))
{
/* get thread entry */
thread = rt_list_entry(queue->suspended_push_list.next, struct rt_thread, tlist);
thread = rt_list_entry(queue->suspended_push_list.next,
struct rt_thread,
tlist);
/* resume it */
rt_thread_resume(thread);
......@@ -284,7 +296,9 @@ void rt_data_queue_reset(struct rt_data_queue *queue)
temp = rt_hw_interrupt_disable();
/* get next suspend thread */
thread = rt_list_entry(queue->suspended_pop_list.next, struct rt_thread, tlist);
thread = rt_list_entry(queue->suspended_pop_list.next,
struct rt_thread,
tlist);
/* set error code to RT_ERROR */
thread->error = -RT_ERROR;
......@@ -306,7 +320,9 @@ void rt_data_queue_reset(struct rt_data_queue *queue)
temp = rt_hw_interrupt_disable();
/* get next suspend thread */
thread = rt_list_entry(queue->suspended_push_list.next, struct rt_thread, tlist);
thread = rt_list_entry(queue->suspended_push_list.next,
struct rt_thread,
tlist);
/* set error code to RT_ERROR */
thread->error = -RT_ERROR;
......
......@@ -42,7 +42,8 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
{
rt_thread_suspend(thread);
/* waiting on suspended read list */
rt_list_insert_before(&(pipe->suspended_read_list), &(thread->tlist));
rt_list_insert_before(&(pipe->suspended_read_list),
&(thread->tlist));
rt_hw_interrupt_enable(level);
rt_schedule();
......@@ -53,7 +54,8 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
{
/* 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);
......@@ -102,7 +104,8 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
/* pipe full, waiting on suspended write list */
rt_thread_suspend(thread);
/* waiting on suspended read list */
rt_list_insert_before(&(pipe->suspended_write_list), &(thread->tlist));
rt_list_insert_before(&(pipe->suspended_write_list),
&(thread->tlist));
rt_hw_interrupt_enable(level);
rt_schedule();
......@@ -113,7 +116,8 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
{
/* 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);
......
......@@ -60,9 +60,11 @@ rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb,
}
else
{
memcpy(&rb->buffer_ptr[write_position], ptr,
memcpy(&rb->buffer_ptr[write_position],
ptr,
rb->buffer_size - write_position);
memcpy(&rb->buffer_ptr[0], &ptr[rb->buffer_size - write_position],
memcpy(&rb->buffer_ptr[0],
&ptr[rb->buffer_size - write_position],
length - (rb->buffer_size - write_position));
}
rb->write_index += length;
......@@ -126,9 +128,11 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb,
else
{
/* copy first and second */
memcpy(ptr, &rb->buffer_ptr[read_position],
memcpy(ptr,
&rb->buffer_ptr[read_position],
rb->buffer_size - read_position);
memcpy(&ptr[rb->buffer_size - read_position], &rb->buffer_ptr[0],
memcpy(&ptr[rb->buffer_size - read_position],
&rb->buffer_ptr[0],
length - rb->buffer_size + read_position);
}
rb->read_index += length;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册