Merge pull request #4426 from mysterywolf/kernel
[kernel]auto formatted
This commit is contained in:
commit
49c410dfa4
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -111,7 +111,7 @@ rt_tick_t rt_tick_from_millisecond(rt_int32_t ms)
|
||||||
tick = RT_TICK_PER_SECOND * (ms / 1000);
|
tick = RT_TICK_PER_SECOND * (ms / 1000);
|
||||||
tick += (RT_TICK_PER_SECOND * (ms % 1000) + 999) / 1000;
|
tick += (RT_TICK_PER_SECOND * (ms % 1000) + 999) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the calculated tick */
|
/* return the calculated tick */
|
||||||
return tick;
|
return tick;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -211,7 +211,7 @@ static void rt_thread_idle_entry(void *parameter)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rt_thread_idle_excute();
|
rt_thread_idle_excute();
|
||||||
#ifdef RT_USING_PM
|
#ifdef RT_USING_PM
|
||||||
rt_system_power_manager();
|
rt_system_power_manager();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
20
src/ipc.c
20
src/ipc.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
* 2013-09-14 Grissiom add an option check in rt_event_recv
|
* 2013-09-14 Grissiom add an option check in rt_event_recv
|
||||||
* 2018-10-02 Bernard add 64bit support for mailbox
|
* 2018-10-02 Bernard add 64bit support for mailbox
|
||||||
* 2019-09-16 tyx add send wait support for message queue
|
* 2019-09-16 tyx add send wait support for message queue
|
||||||
* 2020-07-29 Meco Man fix thread->event_set/event_info when received an
|
* 2020-07-29 Meco Man fix thread->event_set/event_info when received an
|
||||||
* event without pending
|
* event without pending
|
||||||
* 2020-10-11 Meco Man add value overflow-check code
|
* 2020-10-11 Meco Man add value overflow-check code
|
||||||
* 2021-01-03 Meco Man add rt_mb_urgent()
|
* 2021-01-03 Meco Man add rt_mb_urgent()
|
||||||
|
@ -124,7 +124,7 @@ rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
|
@ -959,7 +959,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
||||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||||
return -RT_EFULL; /* value overflowed */
|
return -RT_EFULL; /* value overflowed */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear owner */
|
/* clear owner */
|
||||||
mutex->owner = RT_NULL;
|
mutex->owner = RT_NULL;
|
||||||
mutex->original_priority = 0xff;
|
mutex->original_priority = 0xff;
|
||||||
|
@ -1280,11 +1280,11 @@ rt_err_t rt_event_recv(rt_event_t event,
|
||||||
/* set received event */
|
/* set received event */
|
||||||
if (recved)
|
if (recved)
|
||||||
*recved = (event->set & set);
|
*recved = (event->set & set);
|
||||||
|
|
||||||
/* fill thread event info */
|
/* fill thread event info */
|
||||||
thread->event_set = (event->set & set);
|
thread->event_set = (event->set & set);
|
||||||
thread->event_info = option;
|
thread->event_info = option;
|
||||||
|
|
||||||
/* received event */
|
/* received event */
|
||||||
if (option & RT_EVENT_FLAG_CLEAR)
|
if (option & RT_EVENT_FLAG_CLEAR)
|
||||||
event->set &= ~set;
|
event->set &= ~set;
|
||||||
|
@ -1649,7 +1649,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
||||||
++ mb->in_offset;
|
++ mb->in_offset;
|
||||||
if (mb->in_offset >= mb->size)
|
if (mb->in_offset >= mb->size)
|
||||||
mb->in_offset = 0;
|
mb->in_offset = 0;
|
||||||
|
|
||||||
if(mb->entry < RT_MB_ENTRY_MAX)
|
if(mb->entry < RT_MB_ENTRY_MAX)
|
||||||
{
|
{
|
||||||
/* increase message entry */
|
/* increase message entry */
|
||||||
|
@ -1660,7 +1660,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
|
||||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||||
return -RT_EFULL; /* value overflowed */
|
return -RT_EFULL; /* value overflowed */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resume suspended thread */
|
/* resume suspended thread */
|
||||||
if (!rt_list_isempty(&mb->parent.suspend_thread))
|
if (!rt_list_isempty(&mb->parent.suspend_thread))
|
||||||
{
|
{
|
||||||
|
@ -2409,7 +2409,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
|
||||||
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
rt_hw_interrupt_enable(temp); /* enable interrupt */
|
||||||
return -RT_EFULL; /* value overflowed */
|
return -RT_EFULL; /* value overflowed */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resume suspended thread */
|
/* resume suspended thread */
|
||||||
if (!rt_list_isempty(&mq->parent.suspend_thread))
|
if (!rt_list_isempty(&mq->parent.suspend_thread))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -21,7 +21,7 @@ static void (*rt_interrupt_leave_hook)(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup Hook
|
* @ingroup Hook
|
||||||
* This function set a hook function when the system enter a interrupt
|
* This function set a hook function when the system enter a interrupt
|
||||||
*
|
*
|
||||||
* @note the hook function must be simple and never be blocked or suspend.
|
* @note the hook function must be simple and never be blocked or suspend.
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,7 @@ void rt_interrupt_enter_sethook(void (*hook)(void))
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @ingroup Hook
|
* @ingroup Hook
|
||||||
* This function set a hook function when the system exit a interrupt.
|
* This function set a hook function when the system exit a interrupt.
|
||||||
*
|
*
|
||||||
* @note the hook function must be simple and never be blocked or suspend.
|
* @note the hook function must be simple and never be blocked or suspend.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -456,7 +456,7 @@ RTM_EXPORT(rt_strncmp);
|
||||||
rt_int32_t rt_strcmp(const char *cs, const char *ct)
|
rt_int32_t rt_strcmp(const char *cs, const char *ct)
|
||||||
{
|
{
|
||||||
while (*cs && *cs == *ct)
|
while (*cs && *cs == *ct)
|
||||||
{
|
{
|
||||||
cs++;
|
cs++;
|
||||||
ct++;
|
ct++;
|
||||||
}
|
}
|
||||||
|
@ -1127,10 +1127,10 @@ rt_device_t rt_console_set_device(const char *name)
|
||||||
|
|
||||||
/* find new console device */
|
/* find new console device */
|
||||||
new_device = rt_device_find(name);
|
new_device = rt_device_find(name);
|
||||||
|
|
||||||
/* check whether it's a same device */
|
/* check whether it's a same device */
|
||||||
if (new_device == old_device) return RT_NULL;
|
if (new_device == old_device) return RT_NULL;
|
||||||
|
|
||||||
if (new_device != RT_NULL)
|
if (new_device != RT_NULL)
|
||||||
{
|
{
|
||||||
if (_console_device != RT_NULL)
|
if (_console_device != RT_NULL)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -489,7 +489,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
|
||||||
{
|
{
|
||||||
((struct heap_mem *)&heap_ptr[mem2->next])->prev = ptr2;
|
((struct heap_mem *)&heap_ptr[mem2->next])->prev = ptr2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem2 < lfree)
|
if (mem2 < lfree)
|
||||||
{
|
{
|
||||||
/* the splited struct is now the lowest */
|
/* the splited struct is now the lowest */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -130,7 +130,7 @@ rt_err_t rt_memheap_detach(struct rt_memheap *heap)
|
||||||
RT_ASSERT(heap);
|
RT_ASSERT(heap);
|
||||||
RT_ASSERT(rt_object_get_type(&heap->parent) == RT_Object_Class_MemHeap);
|
RT_ASSERT(rt_object_get_type(&heap->parent) == RT_Object_Class_MemHeap);
|
||||||
RT_ASSERT(rt_object_is_systemobject(&heap->parent));
|
RT_ASSERT(rt_object_is_systemobject(&heap->parent));
|
||||||
|
|
||||||
rt_sem_detach(&heap->lock);
|
rt_sem_detach(&heap->lock);
|
||||||
rt_object_detach(&(heap->parent));
|
rt_object_detach(&(heap->parent));
|
||||||
|
|
||||||
|
@ -765,7 +765,7 @@ void dump_used_memheap(struct rt_memheap *mh)
|
||||||
|
|
||||||
rt_kprintf("\nmemory heap address:\n");
|
rt_kprintf("\nmemory heap address:\n");
|
||||||
rt_kprintf("heap_ptr: 0x%08x\n", mh->start_addr);
|
rt_kprintf("heap_ptr: 0x%08x\n", mh->start_addr);
|
||||||
rt_kprintf("free : 0x%08x\n", mh->available_size);
|
rt_kprintf("free : 0x%08x\n", mh->available_size);
|
||||||
rt_kprintf("max_used: 0x%08x\n", mh->max_used_size);
|
rt_kprintf("max_used: 0x%08x\n", mh->max_used_size);
|
||||||
rt_kprintf("size : 0x%08x\n", mh->pool_size);
|
rt_kprintf("size : 0x%08x\n", mh->pool_size);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
10
src/object.c
10
src/object.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -200,7 +200,7 @@ void rt_object_put_sethook(void (*hook)(struct rt_object *object))
|
||||||
/**
|
/**
|
||||||
* This function will return the specified type of object information.
|
* This function will return the specified type of object information.
|
||||||
*
|
*
|
||||||
* @param type the type of object, which can be
|
* @param type the type of object, which can be
|
||||||
* RT_Object_Class_Thread/Semaphore/Mutex... etc
|
* RT_Object_Class_Thread/Semaphore/Mutex... etc
|
||||||
*
|
*
|
||||||
* @return the object type information or RT_NULL
|
* @return the object type information or RT_NULL
|
||||||
|
@ -220,7 +220,7 @@ RTM_EXPORT(rt_object_get_information);
|
||||||
/**
|
/**
|
||||||
* This function will return the length of object list in object container.
|
* This function will return the length of object list in object container.
|
||||||
*
|
*
|
||||||
* @param type the type of object, which can be
|
* @param type the type of object, which can be
|
||||||
* RT_Object_Class_Thread/Semaphore/Mutex... etc
|
* RT_Object_Class_Thread/Semaphore/Mutex... etc
|
||||||
* @return the length of object list
|
* @return the length of object list
|
||||||
*/
|
*/
|
||||||
|
@ -247,10 +247,10 @@ int rt_object_get_length(enum rt_object_class_type type)
|
||||||
RTM_EXPORT(rt_object_get_length);
|
RTM_EXPORT(rt_object_get_length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will copy the object pointer of the specified type,
|
* This function will copy the object pointer of the specified type,
|
||||||
* with the maximum size specified by maxlen.
|
* with the maximum size specified by maxlen.
|
||||||
*
|
*
|
||||||
* @param type the type of object, which can be
|
* @param type the type of object, which can be
|
||||||
* RT_Object_Class_Thread/Semaphore/Mutex... etc
|
* RT_Object_Class_Thread/Semaphore/Mutex... etc
|
||||||
* @param pointers the pointers will be saved to
|
* @param pointers the pointers will be saved to
|
||||||
* @param maxlen the maximum number of pointers can be saved
|
* @param maxlen the maximum number of pointers can be saved
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -270,10 +270,10 @@ void rt_system_scheduler_start(void)
|
||||||
#ifdef RT_USING_SMP
|
#ifdef RT_USING_SMP
|
||||||
/**
|
/**
|
||||||
* This function will handle IPI interrupt and do a scheduling in system;
|
* This function will handle IPI interrupt and do a scheduling in system;
|
||||||
*
|
*
|
||||||
* @param vector, the number of IPI interrupt for system scheduling
|
* @param vector, the number of IPI interrupt for system scheduling
|
||||||
* @param param, use RT_NULL
|
* @param param, use RT_NULL
|
||||||
*
|
*
|
||||||
* NOTE: this function should be invoke or register as ISR in BSP.
|
* NOTE: this function should be invoke or register as ISR in BSP.
|
||||||
*/
|
*/
|
||||||
void rt_scheduler_ipi_handler(int vector, void *param)
|
void rt_scheduler_ipi_handler(int vector, void *param)
|
||||||
|
@ -283,7 +283,7 @@ void rt_scheduler_ipi_handler(int vector, void *param)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will perform one scheduling. It will select one thread
|
* This function will perform one scheduling. It will select one thread
|
||||||
* with the highest priority level in global ready queue or local ready queue,
|
* with the highest priority level in global ready queue or local ready queue,
|
||||||
* then switch to it.
|
* then switch to it.
|
||||||
*/
|
*/
|
||||||
void rt_schedule(void)
|
void rt_schedule(void)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue