summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLim-LinYuanbo <[email protected]>2021-08-15 14:50:31 +0800
committerGitHub <[email protected]>2021-08-15 14:50:31 +0800
commit7c5f552103f82d37d694c6d2c1c60e35a4503f72 (patch)
treeeef14793c2f0f196ead869341afbe06ab9b7944e /src
parent0e28321c2cfe8273234135a78ce78ac0c4d1d505 (diff)
parentfea12e0903bf0d2e6efed7aa6838c28d1006e1f5 (diff)
Merge branch 'RT-Thread:master' into master
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig4
-rw-r--r--src/cpu.c18
-rw-r--r--src/idle.c4
-rwxr-xr-xsrc/ipc.c102
-rw-r--r--src/kservice.c4
-rw-r--r--src/memheap.c2
-rw-r--r--src/object.c9
-rw-r--r--src/scheduler.c14
-rw-r--r--src/signal.c8
-rw-r--r--src/thread.c48
10 files changed, 110 insertions, 103 deletions
diff --git a/src/Kconfig b/src/Kconfig
index a987daab46..71abd9cf4f 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -131,6 +131,10 @@ config RT_KSERVICE_USING_TINY_SIZE
bool "Enable kservice to use tiny size"
default n
+config RT_USING_ASM_MEMCPY
+ bool
+ default n
+
endmenu
menuconfig RT_DEBUG
diff --git a/src/cpu.c b/src/cpu.c
index a7d56ba999..fc1fed5a06 100644
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -11,13 +11,13 @@
#include <rtthread.h>
#ifdef RT_USING_SMP
-static struct rt_cpu rt_cpus[RT_CPUS_NR];
+static struct rt_cpu _cpus[RT_CPUS_NR];
rt_hw_spinlock_t _cpus_lock;
/*
* disable scheduler
*/
-static void rt_preempt_disable(void)
+static void _cpu_preempt_disable(void)
{
register rt_base_t level;
struct rt_thread *current_thread;
@@ -42,7 +42,7 @@ static void rt_preempt_disable(void)
/*
* enable scheduler
*/
-static void rt_preempt_enable(void)
+static void _cpu_preempt_enable(void)
{
register rt_base_t level;
struct rt_thread *current_thread;
@@ -73,7 +73,7 @@ RTM_EXPORT(rt_spin_lock_init)
void rt_spin_lock(struct rt_spinlock *lock)
{
- rt_preempt_disable();
+ _cpu_preempt_disable();
rt_hw_spin_lock(&lock->lock);
}
RTM_EXPORT(rt_spin_lock)
@@ -81,7 +81,7 @@ RTM_EXPORT(rt_spin_lock)
void rt_spin_unlock(struct rt_spinlock *lock)
{
rt_hw_spin_unlock(&lock->lock);
- rt_preempt_enable();
+ _cpu_preempt_enable();
}
RTM_EXPORT(rt_spin_unlock)
@@ -89,7 +89,7 @@ rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
{
unsigned long level;
- rt_preempt_disable();
+ _cpu_preempt_disable();
level = rt_hw_local_irq_disable();
rt_hw_spin_lock(&lock->lock);
@@ -103,7 +103,7 @@ void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
rt_hw_spin_unlock(&lock->lock);
rt_hw_local_irq_enable(level);
- rt_preempt_enable();
+ _cpu_preempt_enable();
}
RTM_EXPORT(rt_spin_unlock_irqrestore)
@@ -112,12 +112,12 @@ RTM_EXPORT(rt_spin_unlock_irqrestore)
*/
struct rt_cpu *rt_cpu_self(void)
{
- return &rt_cpus[rt_hw_cpu_id()];
+ return &_cpus[rt_hw_cpu_id()];
}
struct rt_cpu *rt_cpu_index(int index)
{
- return &rt_cpus[index];
+ return &_cpus[index];
}
/**
diff --git a/src/idle.c b/src/idle.c
index a571e487cf..ec625cb4a1 100644
--- a/src/idle.c
+++ b/src/idle.c
@@ -139,7 +139,7 @@ rt_err_t rt_thread_idle_delhook(void (*hook)(void))
#ifdef RT_USING_MODULE
/* Return whether there is defunctional thread to be deleted. */
-rt_inline int _has_defunct_thread(void)
+rt_inline int _idle_has_defunct_thread(void)
{
/* The rt_list_isempty has prototype of "int rt_list_isempty(const rt_list_t *l)".
* So the compiler has a good reason that the _rt_thread_defunct list does
@@ -207,7 +207,7 @@ static void rt_defunct_execute(void)
#ifdef RT_USING_MODULE
/* check whether list is empty */
- if (!_has_defunct_thread())
+ if (!_idle_has_defunct_thread())
{
rt_hw_interrupt_enable(lock);
break;
diff --git a/src/ipc.c b/src/ipc.c
index 8acfd831d7..57ac453a68 100755
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -68,7 +68,7 @@ extern void (*rt_object_put_hook)(struct rt_object *object);
*
* @warning This function can be called from all IPC initialization and creation.
*/
-rt_inline rt_err_t rt_ipc_object_init(struct rt_ipc_object *ipc)
+rt_inline rt_err_t _ipc_object_init(struct rt_ipc_object *ipc)
{
/* initialize ipc object */
rt_list_init(&(ipc->suspend_thread));
@@ -106,9 +106,9 @@ rt_inline rt_err_t rt_ipc_object_init(struct rt_ipc_object *ipc)
* rt_sem_take(), rt_mutex_take(), rt_event_recv(), rt_mb_send_wait(),
* rt_mb_recv(), rt_mq_recv(), rt_mq_send_wait()
*/
-rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list,
- struct rt_thread *thread,
- rt_uint8_t flag)
+rt_inline rt_err_t _ipc_list_suspend(rt_list_t *list,
+ struct rt_thread *thread,
+ rt_uint8_t flag)
{
/* suspend thread */
rt_thread_suspend(thread);
@@ -175,7 +175,7 @@ rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list,
* rt_sem_release(), rt_mutex_release(), rt_mb_send_wait(), rt_mq_send_wait(),
* rt_mb_urgent(), rt_mb_recv(), rt_mq_urgent(), rt_mq_recv(),
*/
-rt_inline rt_err_t rt_ipc_list_resume(rt_list_t *list)
+rt_inline rt_err_t _ipc_list_resume(rt_list_t *list)
{
struct rt_thread *thread;
@@ -204,7 +204,7 @@ rt_inline rt_err_t rt_ipc_list_resume(rt_list_t *list)
* When the return value is any other values, it means this operation failed.
*
*/
-rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list)
+rt_inline rt_err_t _ipc_list_resume_all(rt_list_t *list)
{
struct rt_thread *thread;
register rt_ubase_t temp;
@@ -292,7 +292,7 @@ rt_err_t rt_sem_init(rt_sem_t sem,
rt_object_init(&(sem->parent.parent), RT_Object_Class_Semaphore, name);
/* initialize ipc object */
- rt_ipc_object_init(&(sem->parent));
+ _ipc_object_init(&(sem->parent));
/* set initial value */
sem->value = (rt_uint16_t)value;
@@ -331,7 +331,7 @@ rt_err_t rt_sem_detach(rt_sem_t sem)
RT_ASSERT(rt_object_is_systemobject(&sem->parent.parent));
/* wakeup all suspended threads */
- rt_ipc_list_resume_all(&(sem->parent.suspend_thread));
+ _ipc_list_resume_all(&(sem->parent.suspend_thread));
/* detach semaphore object */
rt_object_detach(&(sem->parent.parent));
@@ -386,7 +386,7 @@ rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag)
return sem;
/* initialize ipc object */
- rt_ipc_object_init(&(sem->parent));
+ _ipc_object_init(&(sem->parent));
/* set initial value */
sem->value = value;
@@ -427,7 +427,7 @@ rt_err_t rt_sem_delete(rt_sem_t sem)
RT_ASSERT(rt_object_is_systemobject(&sem->parent.parent) == RT_FALSE);
/* wakeup all suspended threads */
- rt_ipc_list_resume_all(&(sem->parent.suspend_thread));
+ _ipc_list_resume_all(&(sem->parent.suspend_thread));
/* delete semaphore object */
rt_object_delete(&(sem->parent.parent));
@@ -513,7 +513,7 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time)
thread->name));
/* suspend thread */
- rt_ipc_list_suspend(&(sem->parent.suspend_thread),
+ _ipc_list_suspend(&(sem->parent.suspend_thread),
thread,
sem->parent.parent.flag);
@@ -607,7 +607,7 @@ rt_err_t rt_sem_release(rt_sem_t sem)
if (!rt_list_isempty(&sem->parent.suspend_thread))
{
/* resume the suspended thread */
- rt_ipc_list_resume(&(sem->parent.suspend_thread));
+ _ipc_list_resume(&(sem->parent.suspend_thread));
need_schedule = RT_TRUE;
}
else
@@ -667,7 +667,7 @@ rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg)
level = rt_hw_interrupt_disable();
/* resume all waiting thread */
- rt_ipc_list_resume_all(&sem->parent.suspend_thread);
+ _ipc_list_resume_all(&sem->parent.suspend_thread);
/* set new value */
sem->value = (rt_uint16_t)value;
@@ -730,7 +730,7 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag)
rt_object_init(&(mutex->parent.parent), RT_Object_Class_Mutex, name);
/* initialize ipc object */
- rt_ipc_object_init(&(mutex->parent));
+ _ipc_object_init(&(mutex->parent));
mutex->value = 1;
mutex->owner = RT_NULL;
@@ -771,7 +771,7 @@ rt_err_t rt_mutex_detach(rt_mutex_t mutex)
RT_ASSERT(rt_object_is_systemobject(&mutex->parent.parent));
/* wakeup all suspended threads */
- rt_ipc_list_resume_all(&(mutex->parent.suspend_thread));
+ _ipc_list_resume_all(&(mutex->parent.suspend_thread));
/* detach mutex object */
rt_object_detach(&(mutex->parent.parent));
@@ -813,7 +813,7 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag)
return mutex;
/* initialize ipc object */
- rt_ipc_object_init(&(mutex->parent));
+ _ipc_object_init(&(mutex->parent));
mutex->value = 1;
mutex->owner = RT_NULL;
@@ -856,7 +856,7 @@ rt_err_t rt_mutex_delete(rt_mutex_t mutex)
RT_ASSERT(rt_object_is_systemobject(&mutex->parent.parent) == RT_FALSE);
/* wakeup all suspended threads */
- rt_ipc_list_resume_all(&(mutex->parent.suspend_thread));
+ _ipc_list_resume_all(&(mutex->parent.suspend_thread));
/* delete mutex object */
rt_object_delete(&(mutex->parent.parent));
@@ -985,7 +985,7 @@ __again:
}
/* suspend current thread */
- rt_ipc_list_suspend(&(mutex->parent.suspend_thread),
+ _ipc_list_suspend(&(mutex->parent.suspend_thread),
thread,
mutex->parent.parent.flag);
@@ -1150,7 +1150,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
}
/* resume thread */
- rt_ipc_list_resume(&(mutex->parent.suspend_thread));
+ _ipc_list_resume(&(mutex->parent.suspend_thread));
need_schedule = RT_TRUE;
}
@@ -1269,7 +1269,7 @@ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag)
event->parent.parent.flag = flag;
/* initialize ipc object */
- rt_ipc_object_init(&(event->parent));
+ _ipc_object_init(&(event->parent));
/* initialize event */
event->set = 0;
@@ -1305,7 +1305,7 @@ rt_err_t rt_event_detach(rt_event_t event)
RT_ASSERT(rt_object_is_systemobject(&event->parent.parent));
/* resume all suspended thread */
- rt_ipc_list_resume_all(&(event->parent.suspend_thread));
+ _ipc_list_resume_all(&(event->parent.suspend_thread));
/* detach event object */
rt_object_detach(&(event->parent.parent));
@@ -1358,7 +1358,7 @@ rt_event_t rt_event_create(const char *name, rt_uint8_t flag)
event->parent.parent.flag = flag;
/* initialize ipc object */
- rt_ipc_object_init(&(event->parent));
+ _ipc_object_init(&(event->parent));
/* initialize event */
event->set = 0;
@@ -1396,7 +1396,7 @@ rt_err_t rt_event_delete(rt_event_t event)
RT_DEBUG_NOT_IN_INTERRUPT;
/* resume all suspended thread */
- rt_ipc_list_resume_all(&(event->parent.suspend_thread));
+ _ipc_list_resume_all(&(event->parent.suspend_thread));
/* delete event object */
rt_object_delete(&(event->parent.parent));
@@ -1628,7 +1628,7 @@ rt_err_t rt_event_recv(rt_event_t event,
thread->event_info = option;
/* put thread to suspended thread list */
- rt_ipc_list_suspend(&(event->parent.suspend_thread),
+ _ipc_list_suspend(&(event->parent.suspend_thread),
thread,
event->parent.parent.flag);
@@ -1700,7 +1700,7 @@ rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg)
level = rt_hw_interrupt_disable();
/* resume all waiting thread */
- rt_ipc_list_resume_all(&event->parent.suspend_thread);
+ _ipc_list_resume_all(&event->parent.suspend_thread);
/* initialize event set */
event->set = 0;
@@ -1781,7 +1781,7 @@ rt_err_t rt_mb_init(rt_mailbox_t mb,
mb->parent.parent.flag = flag;
/* initialize ipc object */
- rt_ipc_object_init(&(mb->parent));
+ _ipc_object_init(&(mb->parent));
/* initialize mailbox */
mb->msg_pool = (rt_ubase_t *)msgpool;
@@ -1824,9 +1824,9 @@ rt_err_t rt_mb_detach(rt_mailbox_t mb)
RT_ASSERT(rt_object_is_systemobject(&mb->parent.parent));
/* resume all suspended thread */
- rt_ipc_list_resume_all(&(mb->parent.suspend_thread));
+ _ipc_list_resume_all(&(mb->parent.suspend_thread));
/* also resume all mailbox private suspended thread */
- rt_ipc_list_resume_all(&(mb->suspend_sender_thread));
+ _ipc_list_resume_all(&(mb->suspend_sender_thread));
/* detach mailbox object */
rt_object_detach(&(mb->parent.parent));
@@ -1882,7 +1882,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
mb->parent.parent.flag = flag;
/* initialize ipc object */
- rt_ipc_object_init(&(mb->parent));
+ _ipc_object_init(&(mb->parent));
/* initialize mailbox */
mb->size = size;
@@ -1934,10 +1934,10 @@ rt_err_t rt_mb_delete(rt_mailbox_t mb)
RT_ASSERT(rt_object_is_systemobject(&mb->parent.parent) == RT_FALSE);
/* resume all suspended thread */
- rt_ipc_list_resume_all(&(mb->parent.suspend_thread));
+ _ipc_list_resume_all(&(mb->parent.suspend_thread));
/* also resume all mailbox private suspended thread */
- rt_ipc_list_resume_all(&(mb->suspend_sender_thread));
+ _ipc_list_resume_all(&(mb->suspend_sender_thread));
/* free mailbox pool */
RT_KERNEL_FREE(mb->msg_pool);
@@ -2020,7 +2020,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
RT_DEBUG_IN_THREAD_CONTEXT;
/* suspend current thread */
- rt_ipc_list_suspend(&(mb->suspend_sender_thread),
+ _ipc_list_suspend(&(mb->suspend_sender_thread),
thread,
mb->parent.parent.flag);
@@ -2087,7 +2087,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
/* resume suspended thread */
if (!rt_list_isempty(&mb->parent.suspend_thread))
{
- rt_ipc_list_resume(&(mb->parent.suspend_thread));
+ _ipc_list_resume(&(mb->parent.suspend_thread));
/* enable interrupt */
rt_hw_interrupt_enable(temp);
@@ -2183,7 +2183,7 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
/* resume suspended thread */
if (!rt_list_isempty(&mb->parent.suspend_thread))
{
- rt_ipc_list_resume(&(mb->parent.suspend_thread));
+ _ipc_list_resume(&(mb->parent.suspend_thread));
/* enable interrupt */
rt_hw_interrupt_enable(temp);
@@ -2266,7 +2266,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
RT_DEBUG_IN_THREAD_CONTEXT;
/* suspend current thread */
- rt_ipc_list_suspend(&(mb->parent.suspend_thread),
+ _ipc_list_suspend(&(mb->parent.suspend_thread),
thread,
mb->parent.parent.flag);
@@ -2329,7 +2329,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
/* resume suspended thread */
if (!rt_list_isempty(&(mb->suspend_sender_thread)))
{
- rt_ipc_list_resume(&(mb->suspend_sender_thread));
+ _ipc_list_resume(&(mb->suspend_sender_thread));
/* enable interrupt */
rt_hw_interrupt_enable(temp);
@@ -2379,9 +2379,9 @@ rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg)
level = rt_hw_interrupt_disable();
/* resume all waiting thread */
- rt_ipc_list_resume_all(&(mb->parent.suspend_thread));
+ _ipc_list_resume_all(&(mb->parent.suspend_thread));
/* also resume all mailbox private suspended thread */
- rt_ipc_list_resume_all(&(mb->suspend_sender_thread));
+ _ipc_list_resume_all(&(mb->suspend_sender_thread));
/* re-init mailbox */
mb->entry = 0;
@@ -2478,7 +2478,7 @@ rt_err_t rt_mq_init(rt_mq_t mq,
mq->parent.parent.flag = flag;
/* initialize ipc object */
- rt_ipc_object_init(&(mq->parent));
+ _ipc_object_init(&(mq->parent));
/* set message pool */
mq->msg_pool = msgpool;
@@ -2538,9 +2538,9 @@ rt_err_t rt_mq_detach(rt_mq_t mq)
RT_ASSERT(rt_object_is_systemobject(&mq->parent.parent));
/* resume all suspended thread */
- rt_ipc_list_resume_all(&mq->parent.suspend_thread);
+ _ipc_list_resume_all(&mq->parent.suspend_thread);
/* also resume all message queue private suspended thread */
- rt_ipc_list_resume_all(&(mq->suspend_sender_thread));
+ _ipc_list_resume_all(&(mq->suspend_sender_thread));
/* detach message queue object */
rt_object_detach(&(mq->parent.parent));
@@ -2602,7 +2602,7 @@ rt_mq_t rt_mq_create(const char *name,
mq->parent.parent.flag = flag;
/* initialize ipc object */
- rt_ipc_object_init(&(mq->parent));
+ _ipc_object_init(&(mq->parent));
/* initialize message queue */
@@ -2673,9 +2673,9 @@ rt_err_t rt_mq_delete(rt_mq_t mq)
RT_ASSERT(rt_object_is_systemobject(&mq->parent.parent) == RT_FALSE);
/* resume all suspended thread */
- rt_ipc_list_resume_all(&(mq->parent.suspend_thread));
+ _ipc_list_resume_all(&(mq->parent.suspend_thread));
/* also resume all message queue private suspended thread */
- rt_ipc_list_resume_all(&(mq->suspend_sender_thread));
+ _ipc_list_resume_all(&(mq->suspend_sender_thread));
/* free message queue pool */
RT_KERNEL_FREE(mq->msg_pool);
@@ -2776,7 +2776,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
RT_DEBUG_IN_THREAD_CONTEXT;
/* suspend current thread */
- rt_ipc_list_suspend(&(mq->suspend_sender_thread),
+ _ipc_list_suspend(&(mq->suspend_sender_thread),
thread,
mq->parent.parent.flag);
@@ -2862,7 +2862,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
/* resume suspended thread */
if (!rt_list_isempty(&mq->parent.suspend_thread))
{
- rt_ipc_list_resume(&(mq->parent.suspend_thread));
+ _ipc_list_resume(&(mq->parent.suspend_thread));
/* enable interrupt */
rt_hw_interrupt_enable(temp);
@@ -2991,7 +2991,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
/* resume suspended thread */
if (!rt_list_isempty(&mq->parent.suspend_thread))
{
- rt_ipc_list_resume(&(mq->parent.suspend_thread));
+ _ipc_list_resume(&(mq->parent.suspend_thread));
/* enable interrupt */
rt_hw_interrupt_enable(temp);
@@ -3081,7 +3081,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
}
/* suspend current thread */
- rt_ipc_list_suspend(&(mq->parent.suspend_thread),
+ _ipc_list_suspend(&(mq->parent.suspend_thread),
thread,
mq->parent.parent.flag);
@@ -3157,7 +3157,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
/* resume suspended thread */
if (!rt_list_isempty(&(mq->suspend_sender_thread)))
{
- rt_ipc_list_resume(&(mq->suspend_sender_thread));
+ _ipc_list_resume(&(mq->suspend_sender_thread));
/* enable interrupt */
rt_hw_interrupt_enable(temp);
@@ -3208,9 +3208,9 @@ rt_err_t rt_mq_control(rt_mq_t mq, int cmd, void *arg)
level = rt_hw_interrupt_disable();
/* resume all waiting thread */
- rt_ipc_list_resume_all(&mq->parent.suspend_thread);
+ _ipc_list_resume_all(&mq->parent.suspend_thread);
/* also resume all message queue private suspended thread */
- rt_ipc_list_resume_all(&(mq->suspend_sender_thread));
+ _ipc_list_resume_all(&(mq->suspend_sender_thread));
/* release all message in the queue */
while (mq->msg_queue_head != RT_NULL)
diff --git a/src/kservice.c b/src/kservice.c
index 128a9f4f54..91872492fb 100644
--- a/src/kservice.c
+++ b/src/kservice.c
@@ -198,6 +198,7 @@ RT_WEAK void *rt_memset(void *s, int c, rt_ubase_t count)
}
RTM_EXPORT(rt_memset);
+#ifndef RT_USING_ASM_MEMCPY
/**
* This function will copy memory content from source address to destination
* address.
@@ -208,7 +209,7 @@ RTM_EXPORT(rt_memset);
*
* @return the address of destination memory
*/
-RT_WEAK void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
+void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
{
#ifdef RT_KSERVICE_USING_TINY_SIZE
char *tmp = (char *)dst, *s = (char *)src;
@@ -280,6 +281,7 @@ RT_WEAK void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
#endif /* RT_KSERVICE_USING_TINY_SIZE */
}
RTM_EXPORT(rt_memcpy);
+#endif /* RT_USING_ASM_MEMCPY */
#ifndef RT_KSERVICE_USING_STDLIB
diff --git a/src/memheap.c b/src/memheap.c
index d77c95601e..d0801d721b 100644
--- a/src/memheap.c
+++ b/src/memheap.c
@@ -438,7 +438,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)
next_ptr->pool_ptr = heap;
#ifdef RT_USING_MEMTRACE
- rt_memset(next_ptr->owner_thread_name, ' ', sizeof(next_ptr->owner_thread_name));
+ rt_memset((void *)next_ptr->owner_thread_name, ' ', sizeof(next_ptr->owner_thread_name));
#endif /* RT_USING_MEMTRACE */
next_ptr->prev = header_ptr;
diff --git a/src/object.c b/src/object.c
index ff96037c52..718b0aa5b2 100644
--- a/src/object.c
+++ b/src/object.c
@@ -23,7 +23,7 @@
#endif /* RT_USING_MODULE */
/*
- * define object_info for the number of rt_object_container items.
+ * define object_info for the number of _object_container items.
*/
enum rt_object_info_type
{
@@ -60,8 +60,9 @@ enum rt_object_info_type
};
#define _OBJ_CONTAINER_LIST_INIT(c) \
- {&(rt_object_container[c].object_list), &(rt_object_container[c].object_list)}
-static struct rt_object_information rt_object_container[RT_Object_Info_Unknown] =
+ {&(_object_container[c].object_list), &(_object_container[c].object_list)}
+
+static struct rt_object_information _object_container[RT_Object_Info_Unknown] =
{
/* initialize object container - thread */
{RT_Object_Class_Thread, _OBJ_CONTAINER_LIST_INIT(RT_Object_Info_Thread), sizeof(struct rt_thread)},
@@ -211,7 +212,7 @@ rt_object_get_information(enum rt_object_class_type type)
int index;
for (index = 0; index < RT_Object_Info_Unknown; index ++)
- if (rt_object_container[index].type == type) return &rt_object_container[index];
+ if (_object_container[index].type == type) return &_object_container[index];
return RT_NULL;
}
diff --git a/src/scheduler.c b/src/scheduler.c
index 353fdad5cb..bb431e2efe 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -23,7 +23,7 @@
* 2013-12-21 Grissiom add rt_critical_level
* 2018-11-22 Jesven remove the current task from ready queue
* add per cpu ready queue
- * add _get_highest_priority_thread to find highest priority task
+ * add _scheduler_get_highest_priority_thread to find highest priority task
* rt_schedule_insert_thread won't insert current task to ready queue
* in smp version, rt_hw_context_switch_interrupt maybe switch to
* new task directly
@@ -119,7 +119,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
* get the highest priority thread in ready queue
*/
#ifdef RT_USING_SMP
-static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio)
+static struct rt_thread* _scheduler_get_highest_priority_thread(rt_ubase_t *highest_prio)
{
register struct rt_thread *highest_priority_thread;
register rt_ubase_t highest_ready_priority, local_highest_ready_priority;
@@ -155,7 +155,7 @@ static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio)
return highest_priority_thread;
}
#else
-static struct rt_thread* _get_highest_priority_thread(rt_ubase_t *highest_prio)
+static struct rt_thread* _scheduler_get_highest_priority_thread(rt_ubase_t *highest_prio)
{
register struct rt_thread *highest_priority_thread;
register rt_ubase_t highest_ready_priority;
@@ -241,7 +241,7 @@ void rt_system_scheduler_start(void)
register struct rt_thread *to_thread;
rt_ubase_t highest_ready_priority;
- to_thread = _get_highest_priority_thread(&highest_ready_priority);
+ to_thread = _scheduler_get_highest_priority_thread(&highest_ready_priority);
#ifdef RT_USING_SMP
to_thread->oncpu = rt_hw_cpu_id();
@@ -329,7 +329,7 @@ void rt_schedule(void)
if (rt_thread_ready_priority_group != 0 || pcpu->priority_group != 0)
{
- to_thread = _get_highest_priority_thread(&highest_ready_priority);
+ to_thread = _scheduler_get_highest_priority_thread(&highest_ready_priority);
current_thread->oncpu = RT_CPU_DETACHED;
if ((current_thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_RUNNING)
{
@@ -429,7 +429,7 @@ void rt_schedule(void)
/* need_insert_from_thread: need to insert from_thread to ready queue */
int need_insert_from_thread = 0;
- to_thread = _get_highest_priority_thread(&highest_ready_priority);
+ to_thread = _scheduler_get_highest_priority_thread(&highest_ready_priority);
if ((rt_current_thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_RUNNING)
{
@@ -582,7 +582,7 @@ void rt_scheduler_do_irq_switch(void *context)
if (rt_thread_ready_priority_group != 0 || pcpu->priority_group != 0)
{
- to_thread = _get_highest_priority_thread(&highest_ready_priority);
+ to_thread = _scheduler_get_highest_priority_thread(&highest_ready_priority);
current_thread->oncpu = RT_CPU_DETACHED;
if ((current_thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_RUNNING)
{
diff --git a/src/signal.c b/src/signal.c
index bb7706d9ef..c5ae2a709a 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -35,7 +35,7 @@ struct siginfo_node
struct rt_slist_node list;
};
-static struct rt_mempool *_rt_siginfo_pool;
+static struct rt_mempool *_siginfo_pool;
static void _signal_deliver(rt_thread_t tid);
void rt_thread_handle_sig(rt_bool_t clean_state);
@@ -538,7 +538,7 @@ int rt_thread_kill(rt_thread_t tid, int sig)
}
rt_hw_interrupt_enable(level);
- si_node = (struct siginfo_node *) rt_mp_alloc(_rt_siginfo_pool, 0);
+ si_node = (struct siginfo_node *) rt_mp_alloc(_siginfo_pool, 0);
if (si_node)
{
rt_slist_init(&(si_node->list));
@@ -576,8 +576,8 @@ int rt_thread_kill(rt_thread_t tid, int sig)
int rt_system_signal_init(void)
{
- _rt_siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node));
- if (_rt_siginfo_pool == RT_NULL)
+ _siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node));
+ if (_siginfo_pool == RT_NULL)
{
LOG_E("create memory pool for signal info failed.");
RT_ASSERT(0);
diff --git a/src/thread.c b/src/thread.c
index 60e6ab91d1..7e0c10bfef 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -77,7 +77,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
#endif /* RT_USING_HOOK */
/* must be invoke witch rt_hw_interrupt_disable */
-static void _rt_thread_cleanup_execute(rt_thread_t thread)
+static void _thread_cleanup_execute(rt_thread_t thread)
{
register rt_base_t level;
#ifdef RT_USING_MODULE
@@ -101,7 +101,7 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread)
rt_hw_interrupt_enable(level);
}
-static void _rt_thread_exit(void)
+static void _thread_exit(void)
{
struct rt_thread *thread;
register rt_base_t level;
@@ -112,7 +112,7 @@ static void _rt_thread_exit(void)
/* disable interrupt */
level = rt_hw_interrupt_disable();
- _rt_thread_cleanup_execute(thread);
+ _thread_cleanup_execute(thread);
/* remove from schedule */
rt_schedule_remove_thread(thread);
@@ -139,14 +139,14 @@ static void _rt_thread_exit(void)
rt_hw_interrupt_enable(level);
}
-static rt_err_t _rt_thread_init(struct rt_thread *thread,
- const char *name,
- void (*entry)(void *parameter),
- void *parameter,
- void *stack_start,
- rt_uint32_t stack_size,
- rt_uint8_t priority,
- rt_uint32_t tick)
+static rt_err_t _thread_init(struct rt_thread *thread,
+ const char *name,
+ void (*entry)(void *parameter),
+ void *parameter,
+ void *stack_start,
+ rt_uint32_t stack_size,
+ rt_uint8_t priority,
+ rt_uint32_t tick)
{
/* init thread list */
rt_list_init(&(thread->tlist));
@@ -163,11 +163,11 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
#ifdef ARCH_CPU_STACK_GROWS_UPWARD
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
(void *)((char *)thread->stack_addr),
- (void *)_rt_thread_exit);
+ (void *)_thread_exit);
#else
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
(rt_uint8_t *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)),
- (void *)_rt_thread_exit);
+ (void *)_thread_exit);
#endif /* ARCH_CPU_STACK_GROWS_UPWARD */
/* priority init */
@@ -274,14 +274,14 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
/* initialize thread object */
rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);
- return _rt_thread_init(thread,
- name,
- entry,
- parameter,
- stack_start,
- stack_size,
- priority,
- tick);
+ return _thread_init(thread,
+ name,
+ entry,
+ parameter,
+ stack_start,
+ stack_size,
+ priority,
+ tick);
}
RTM_EXPORT(rt_thread_init);
@@ -376,7 +376,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
rt_schedule_remove_thread(thread);
}
- _rt_thread_cleanup_execute(thread);
+ _thread_cleanup_execute(thread);
/* release thread timer */
rt_timer_detach(&(thread->thread_timer));
@@ -440,7 +440,7 @@ rt_thread_t rt_thread_create(const char *name,
return RT_NULL;
}
- _rt_thread_init(thread,
+ _thread_init(thread,
name,
entry,
parameter,
@@ -479,7 +479,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
rt_schedule_remove_thread(thread);
}
- _rt_thread_cleanup_execute(thread);
+ _thread_cleanup_execute(thread);
/* release thread timer */
rt_timer_detach(&(thread->thread_timer));