RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
Other useful kernel service
+ Other useful kernel service 的协作图:

宏定义

#define RT_HW_BACKTRACE_FRAME_GET_SELF(frame)
 
#define _MEM_INIT(...)
 
#define _MEM_MALLOC(...)
 
#define _MEM_REALLOC(...)
 
#define _MEM_FREE(...)
 
#define _MEM_INFO(...)
 
#define rt_container_of(ptr, type, member)
 
#define RT_LIST_OBJECT_INIT(object)
 
#define rt_list_entry(node, type, member)
 
#define rt_list_for_each(pos, head)
 
#define rt_list_for_each_safe(pos, n, head)
 
#define rt_list_for_each_entry(pos, head, member)
 
#define rt_list_for_each_entry_safe(pos, n, head, member)
 
#define rt_list_first_entry(ptr, type, member)
 
#define RT_SLIST_OBJECT_INIT(object)
 
#define rt_slist_entry(node, type, member)
 
#define rt_slist_for_each(pos, head)
 
#define rt_slist_for_each_entry(pos, head, member)
 
#define rt_slist_first_entry(ptr, type, member)
 
#define rt_slist_tail_entry(ptr, type, member)
 
#define rt_kprintf(...)
 
#define rt_kputs(str)
 
#define RT_ASSERT(EX)
 
#define RT_DEBUG_NOT_IN_INTERRUPT
 
#define RT_DEBUG_IN_THREAD_CONTEXT
 
#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check)
 
#define rt_sched_thread_is_binding(thread)
 

函数

rt_weak void rt_hw_us_delay (rt_uint32_t us)
 
rt_weak void rt_hw_cpu_reset (void)
 
rt_weak void rt_hw_cpu_shutdown (void)
 
rt_weak rt_err_t rt_hw_backtrace_frame_get (rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
 
rt_weak rt_err_t rt_hw_backtrace_frame_unwind (rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
 
rt_weak const char * rt_hw_cpu_arch (void)
 
void rt_show_version (void)
 
 RTM_EXPORT (rt_show_version)
 
rt_weak rt_err_t rt_backtrace (void)
 
rt_weak rt_err_t rt_backtrace_frame (rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
 
rt_weak rt_err_t rt_backtrace_formatted_print (rt_ubase_t *buffer, long buflen)
 
rt_weak rt_err_t rt_backtrace_to_buffer (rt_thread_t thread, struct rt_hw_backtrace_frame *frame, long skip, rt_ubase_t *buffer, long buflen)
 
rt_err_t rt_backtrace_thread (rt_thread_t thread)
 
rt_inline void _heap_lock_init (void)
 
rt_inline rt_base_t _heap_lock (void)
 
rt_inline void _heap_unlock (rt_base_t level)
 
void rt_system_heap_init_generic (void *begin_addr, void *end_addr)
 
rt_weak void rt_system_heap_init (void *begin_addr, void *end_addr)
 
rt_weak void * rt_malloc (rt_size_t size)
 
 RTM_EXPORT (rt_malloc)
 
rt_weak void * rt_realloc (void *ptr, rt_size_t newsize)
 
 RTM_EXPORT (rt_realloc)
 
rt_weak void * rt_calloc (rt_size_t count, rt_size_t size)
 
 RTM_EXPORT (rt_calloc)
 
rt_weak void rt_free (void *ptr)
 
 RTM_EXPORT (rt_free)
 
rt_weak void rt_memory_info (rt_size_t *total, rt_size_t *used, rt_size_t *max_used)
 
 RTM_EXPORT (rt_memory_info)
 
rt_weak void * rt_malloc_align (rt_size_t size, rt_size_t align)
 
 RTM_EXPORT (rt_malloc_align)
 
rt_weak void rt_free_align (void *ptr)
 
 RTM_EXPORT (rt_free_align)
 
int __rt_ffs (int value)
 
rt_inline void rt_list_init (rt_list_t *l)
 
rt_inline void rt_list_insert_after (rt_list_t *l, rt_list_t *n)
 
rt_inline void rt_list_insert_before (rt_list_t *l, rt_list_t *n)
 
rt_inline void rt_list_remove (rt_list_t *n)
 
rt_inline int rt_list_isempty (const rt_list_t *l)
 
rt_inline unsigned int rt_list_len (const rt_list_t *l)
 
rt_inline void rt_slist_init (rt_slist_t *l)
 
rt_inline void rt_slist_append (rt_slist_t *l, rt_slist_t *n)
 
rt_inline void rt_slist_insert (rt_slist_t *l, rt_slist_t *n)
 
rt_inline unsigned int rt_slist_len (const rt_slist_t *l)
 
rt_inline rt_slist_trt_slist_pop (rt_slist_t *l)
 
rt_inline rt_slist_trt_slist_remove (rt_slist_t *l, rt_slist_t *n)
 
rt_inline rt_slist_trt_slist_first (rt_slist_t *l)
 
rt_inline rt_slist_trt_slist_tail (rt_slist_t *l)
 
rt_inline rt_slist_trt_slist_next (rt_slist_t *n)
 
rt_inline int rt_slist_isempty (rt_slist_t *l)
 
unsigned long __rt_ffsl (unsigned long value)
 
unsigned long __rt_clz (unsigned long value)
 
rt_inline rt_bool_t rt_in_thread_context (void)
 
rt_inline rt_bool_t rt_scheduler_is_available (void)
 

变量

const rt_uint8_t __lowest_bit_bitmap []
 
void rt_realloc_set_entry_hook (void(*hook)(void **ptr, rt_size_t size))
 
void rt_realloc_set_exit_hook (void(*hook)(void **ptr, rt_size_t size))
 
void rt_free_sethook (void(*hook)(void **ptr))
 

详细描述

other useful service in the kernel

宏定义说明

◆ RT_HW_BACKTRACE_FRAME_GET_SELF

#define RT_HW_BACKTRACE_FRAME_GET_SELF ( frame)
值:
do { \
(frame)->fp = 0; \
(frame)->pc = 0; \
} while (0)
注解
can be overridden by cpuport.h which is defined by a specific arch

在文件 kservice.c101 行定义.

101 #define RT_HW_BACKTRACE_FRAME_GET_SELF(frame) do { \
102 (frame)->fp = 0; \
103 (frame)->pc = 0; \
104 } while (0)

◆ _MEM_INIT

#define _MEM_INIT ( ...)

在文件 kservice.c760 行定义.

◆ _MEM_MALLOC

#define _MEM_MALLOC ( ...)
值:
#define RT_NULL

在文件 kservice.c761 行定义.

◆ _MEM_REALLOC

#define _MEM_REALLOC ( ...)
值:

在文件 kservice.c762 行定义.

◆ _MEM_FREE

#define _MEM_FREE ( ...)

在文件 kservice.c763 行定义.

◆ _MEM_INFO

#define _MEM_INFO ( ...)

在文件 kservice.c764 行定义.

◆ rt_container_of

#define rt_container_of ( ptr,
type,
member )
值:
((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))

rt_container_of - return the start address of struct type, while ptr is the member of struct type.

在文件 rtservice.h36 行定义.

36#define rt_container_of(ptr, type, member) \
37 ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))

◆ RT_LIST_OBJECT_INIT

#define RT_LIST_OBJECT_INIT ( object)
值:
{ &(object), &(object) }

initialize a list object

在文件 rtservice.h43 行定义.

◆ rt_list_entry

#define rt_list_entry ( node,
type,
member )
值:
rt_container_of(node, type, member)
#define rt_container_of(ptr, type, member)

get the struct for this entry

参数
nodethe entry point
typethe type of structure
memberthe name of list in structure

在文件 rtservice.h129 行定义.

129#define rt_list_entry(node, type, member) \
130 rt_container_of(node, type, member)

◆ rt_list_for_each

#define rt_list_for_each ( pos,
head )
值:
for (pos = (head)->next; pos != (head); pos = pos->next)

rt_list_for_each - iterate over a list

参数
posthe rt_list_t * to use as a loop cursor.
headthe head for your list.

在文件 rtservice.h137 行定义.

137#define rt_list_for_each(pos, head) \
138 for (pos = (head)->next; pos != (head); pos = pos->next)

◆ rt_list_for_each_safe

#define rt_list_for_each_safe ( pos,
n,
head )
值:
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)

rt_list_for_each_safe - iterate over a list safe against removal of list entry

参数
posthe rt_list_t * to use as a loop cursor.
nanother rt_list_t * to use as temporary storage
headthe head for your list.

在文件 rtservice.h146 行定义.

146#define rt_list_for_each_safe(pos, n, head) \
147 for (pos = (head)->next, n = pos->next; pos != (head); \
148 pos = n, n = pos->next)

◆ rt_list_for_each_entry

#define rt_list_for_each_entry ( pos,
head,
member )
值:
for (pos = rt_list_entry((head)->next, rt_typeof(*pos), member); \
&pos->member != (head); \
pos = rt_list_entry(pos->member.next, rt_typeof(*pos), member))
#define rt_list_entry(node, type, member)
get the struct for this entry

rt_list_for_each_entry - iterate over list of given type

参数
posthe type * to use as a loop cursor.
headthe head for your list.
memberthe name of the list_struct within the struct.

在文件 rtservice.h156 行定义.

156#define rt_list_for_each_entry(pos, head, member) \
157 for (pos = rt_list_entry((head)->next, rt_typeof(*pos), member); \
158 &pos->member != (head); \
159 pos = rt_list_entry(pos->member.next, rt_typeof(*pos), member))

◆ rt_list_for_each_entry_safe

#define rt_list_for_each_entry_safe ( pos,
n,
head,
member )
值:
for (pos = rt_list_entry((head)->next, rt_typeof(*pos), member), \
n = rt_list_entry(pos->member.next, rt_typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = rt_list_entry(n->member.next, rt_typeof(*n), member))

rt_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry

参数
posthe type * to use as a loop cursor.
nanother type * to use as temporary storage
headthe head for your list.
memberthe name of the list_struct within the struct.

在文件 rtservice.h168 行定义.

168#define rt_list_for_each_entry_safe(pos, n, head, member) \
169 for (pos = rt_list_entry((head)->next, rt_typeof(*pos), member), \
170 n = rt_list_entry(pos->member.next, rt_typeof(*pos), member); \
171 &pos->member != (head); \
172 pos = n, n = rt_list_entry(n->member.next, rt_typeof(*n), member))

◆ rt_list_first_entry

#define rt_list_first_entry ( ptr,
type,
member )
值:
rt_list_entry((ptr)->next, type, member)

rt_list_first_entry - get the first element from a list

参数
ptrthe list head to take the element from.
typethe type of the struct this is embedded in.
memberthe name of the list_struct within the struct.

Note, that list is expected to be not empty.

在文件 rtservice.h182 行定义.

182#define rt_list_first_entry(ptr, type, member) \
183 rt_list_entry((ptr)->next, type, member)

◆ RT_SLIST_OBJECT_INIT

#define RT_SLIST_OBJECT_INIT ( object)
值:

在文件 rtservice.h185 行定义.

◆ rt_slist_entry

#define rt_slist_entry ( node,
type,
member )
值:
rt_container_of(node, type, member)

get the struct for this single list node

参数
nodethe entry point
typethe type of structure
memberthe name of list in structure

在文件 rtservice.h282 行定义.

282#define rt_slist_entry(node, type, member) \
283 rt_container_of(node, type, member)

◆ rt_slist_for_each

#define rt_slist_for_each ( pos,
head )
值:
for (pos = (head)->next; pos != RT_NULL; pos = pos->next)

rt_slist_for_each - iterate over a single list

参数
posthe rt_slist_t * to use as a loop cursor.
headthe head for your single list.

在文件 rtservice.h290 行定义.

290#define rt_slist_for_each(pos, head) \
291 for (pos = (head)->next; pos != RT_NULL; pos = pos->next)

◆ rt_slist_for_each_entry

#define rt_slist_for_each_entry ( pos,
head,
member )
值:
for (pos = ((head)->next == (RT_NULL) ? (RT_NULL) : rt_slist_entry((head)->next, rt_typeof(*pos), member)); \
pos != (RT_NULL) && &pos->member != (RT_NULL); \
pos = (pos->member.next == (RT_NULL) ? (RT_NULL) : rt_slist_entry(pos->member.next, rt_typeof(*pos), member)))
#define rt_slist_entry(node, type, member)
get the struct for this single list node

rt_slist_for_each_entry - iterate over single list of given type

参数
posthe type * to use as a loop cursor.
headthe head for your single list.
memberthe name of the list_struct within the struct.

在文件 rtservice.h299 行定义.

299#define rt_slist_for_each_entry(pos, head, member) \
300 for (pos = ((head)->next == (RT_NULL) ? (RT_NULL) : rt_slist_entry((head)->next, rt_typeof(*pos), member)); \
301 pos != (RT_NULL) && &pos->member != (RT_NULL); \
302 pos = (pos->member.next == (RT_NULL) ? (RT_NULL) : rt_slist_entry(pos->member.next, rt_typeof(*pos), member)))

◆ rt_slist_first_entry

#define rt_slist_first_entry ( ptr,
type,
member )
值:
rt_slist_entry((ptr)->next, type, member)

rt_slist_first_entry - get the first element from a slist

参数
ptrthe slist head to take the element from.
typethe type of the struct this is embedded in.
memberthe name of the slist_struct within the struct.

Note, that slist is expected to be not empty.

在文件 rtservice.h312 行定义.

312#define rt_slist_first_entry(ptr, type, member) \
313 rt_slist_entry((ptr)->next, type, member)

◆ rt_slist_tail_entry

#define rt_slist_tail_entry ( ptr,
type,
member )
值:
rt_slist_entry(rt_slist_tail(ptr), type, member)
rt_inline rt_slist_t * rt_slist_tail(rt_slist_t *l)

rt_slist_tail_entry - get the tail element from a slist

参数
ptrthe slist head to take the element from.
typethe type of the struct this is embedded in.
memberthe name of the slist_struct within the struct.

Note, that slist is expected to be not empty.

在文件 rtservice.h323 行定义.

323#define rt_slist_tail_entry(ptr, type, member) \
324 rt_slist_entry(rt_slist_tail(ptr), type, member)

◆ rt_kprintf

#define rt_kprintf ( ...)

在文件 rtthread.h771 行定义.

◆ rt_kputs

#define rt_kputs ( str)

在文件 rtthread.h772 行定义.

◆ RT_ASSERT

#define RT_ASSERT ( EX)
值:
{RT_UNUSED(EX);}
#define RT_UNUSED(x)

在文件 rtthread.h812 行定义.

◆ RT_DEBUG_NOT_IN_INTERRUPT

#define RT_DEBUG_NOT_IN_INTERRUPT

在文件 rtthread.h866 行定义.

◆ RT_DEBUG_IN_THREAD_CONTEXT

#define RT_DEBUG_IN_THREAD_CONTEXT

在文件 rtthread.h867 行定义.

◆ RT_DEBUG_SCHEDULER_AVAILABLE

#define RT_DEBUG_SCHEDULER_AVAILABLE ( need_check)

在文件 rtthread.h868 行定义.

◆ rt_sched_thread_is_binding

#define rt_sched_thread_is_binding ( thread)
值:
#define RT_TRUE

在文件 rtthread.h894 行定义.

函数说明

◆ rt_hw_us_delay()

rt_weak void rt_hw_us_delay ( rt_uint32_t us)

在文件 kservice.c65 行定义.

66{
67 (void) us;
68 LOG_W("rt_hw_us_delay() doesn't support for this board."
69 "Please consider implementing rt_hw_us_delay() in another file.");
70}
#define LOG_W(...)

引用了 LOG_W.

◆ rt_hw_cpu_reset()

rt_weak void rt_hw_cpu_reset ( void )

在文件 kservice.c72 行定义.

73{
74 LOG_W("rt_hw_cpu_reset() doesn't support for this board."
75 "Please consider implementing rt_hw_cpu_reset() in another file.");
76 return;
77}

引用了 LOG_W.

◆ rt_hw_cpu_shutdown()

rt_weak void rt_hw_cpu_shutdown ( void )

在文件 kservice.c79 行定义.

80{
81 LOG_I("CPU shutdown...");
82 LOG_W("Using default rt_hw_cpu_shutdown()."
83 "Please consider implementing rt_hw_cpu_shutdown() in another file.");
85 RT_ASSERT(0);
86 return;
87}
#define RT_ASSERT(EX)
#define LOG_I(...)
rt_base_t rt_hw_interrupt_disable(void)

引用了 LOG_I, LOG_W, RT_ASSERT , 以及 rt_hw_interrupt_disable().

+ 函数调用图:

◆ rt_hw_backtrace_frame_get()

rt_weak rt_err_t rt_hw_backtrace_frame_get ( rt_thread_t thread,
struct rt_hw_backtrace_frame * frame )

Get the inner most frame of target thread

参数
threadthe thread which frame belongs to
framethe specified frame to be unwound
返回
rt_err_t 0 is succeed, otherwise a failure

在文件 kservice.c117 行定义.

118{
119 RT_UNUSED(thread);
120 RT_UNUSED(frame);
121
122 LOG_W("%s is not implemented", __func__);
123 return -RT_ENOSYS;
124}

引用了 LOG_W , 以及 RT_UNUSED.

+ 这是这个函数的调用关系图:

◆ rt_hw_backtrace_frame_unwind()

rt_weak rt_err_t rt_hw_backtrace_frame_unwind ( rt_thread_t thread,
struct rt_hw_backtrace_frame * frame )

Unwind the target frame

参数
threadthe thread which frame belongs to
framethe specified frame to be unwound
返回
rt_err_t 0 is succeed, otherwise a failure

在文件 kservice.c133 行定义.

134{
135 RT_UNUSED(thread);
136 RT_UNUSED(frame);
137
138 LOG_W("%s is not implemented", __func__);
139 return -RT_ENOSYS;
140}

引用了 LOG_W , 以及 RT_UNUSED.

+ 这是这个函数的调用关系图:

◆ rt_hw_cpu_arch()

rt_weak const char * rt_hw_cpu_arch ( void )

在文件 kservice.c142 行定义.

143{
144 return "unknown";
145}

◆ rt_show_version()

void rt_show_version ( void )

This function will show the version of rt-thread rtos

在文件 kservice.c150 行定义.

151{
152 rt_kprintf("\n \\ | /\n");
153#if defined(RT_USING_SMART)
154 rt_kprintf("- RT - Thread Smart Operating System\n");
155#elif defined(RT_USING_NANO)
156 rt_kprintf("- RT - Thread Nano Operating System\n");
157#else
158 rt_kprintf("- RT - Thread Operating System\n");
159#endif
160 rt_kprintf(" / | \\ %d.%d.%d build %s %s\n",
162 rt_kprintf(" 2006 - 2024 Copyright by RT-Thread team\n");
163}
#define RT_VERSION_PATCH
定义 rtdef.h:86
#define RT_VERSION_MAJOR
定义 rtdef.h:84
#define RT_VERSION_MINOR
定义 rtdef.h:85
#define rt_kprintf(...)
signed int rt_int32_t

引用了 rt_kprintf, RT_VERSION_MAJOR, RT_VERSION_MINOR , 以及 RT_VERSION_PATCH.

+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [1/8]

RTM_EXPORT ( rt_show_version )

引用了 rt_show_version().

+ 函数调用图:

◆ rt_backtrace()

rt_err_t rt_backtrace ( void )

Print backtrace of current thread to system console device

返回
rt_err_t 0 is success, otherwise a failure

在文件 kservice.c394 行定义.

395{
396 struct rt_hw_backtrace_frame frame;
397 rt_thread_t thread = rt_thread_self();
398
400 if (!frame.fp)
401 return -RT_EINVAL;
402
403 /* we don't want this frame to be printed which is nearly garbage info */
404 rt_hw_backtrace_frame_unwind(thread, &frame);
405
406 return rt_backtrace_frame(thread, &frame);
407}
#define RT_HW_BACKTRACE_FRAME_GET_SELF(frame)
rt_weak rt_err_t rt_hw_backtrace_frame_unwind(rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
Unwind the target frame
rt_weak rt_err_t rt_backtrace_frame(rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
Print backtrace from frame to system console device
rt_thread_t rt_thread_self(void)
This function will return self thread object.
struct rt_thread * rt_thread_t

引用了 rt_hw_backtrace_frame::fp, rt_backtrace_frame(), RT_HW_BACKTRACE_FRAME_GET_SELF, rt_hw_backtrace_frame_unwind() , 以及 rt_thread_self().

+ 函数调用图:

◆ rt_backtrace_frame()

rt_err_t rt_backtrace_frame ( rt_thread_t thread,
struct rt_hw_backtrace_frame * frame )

Print backtrace from frame to system console device

参数
threadthe thread which frame belongs to
framewhere backtrace starts from
返回
rt_err_t 0 is success, otherwise a failure

在文件 kservice.c416 行定义.

417{
418 long nesting = 0;
419
420 rt_kprintf("please use: addr2line -e rtthread.elf -a -f\n");
421
422 while (nesting < RT_BACKTRACE_LEVEL_MAX_NR)
423 {
424 rt_kprintf(" 0x%lx", (rt_ubase_t)frame->pc);
425 if (rt_hw_backtrace_frame_unwind(thread, frame))
426 {
427 break;
428 }
429 nesting++;
430 }
431 rt_kprintf("\n");
432 return RT_EOK;
433}
rt_uint32_t rt_ubase_t

引用了 rt_hw_backtrace_frame::pc, rt_hw_backtrace_frame_unwind() , 以及 rt_kprintf.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ rt_backtrace_formatted_print()

rt_err_t rt_backtrace_formatted_print ( rt_ubase_t * buffer,
long buflen )

Print backtrace from buffer to system console

参数
bufferwhere traced frames saved
buflennumber of items in buffer
返回
rt_err_t 0 is success, otherwise a failure

在文件 kservice.c442 行定义.

443{
444 rt_kprintf("please use: addr2line -e rtthread.elf -a -f\n");
445
446 for (rt_size_t i = 0; i < buflen && buffer[i] != 0; i++)
447 {
448 rt_kprintf(" 0x%lx", (rt_ubase_t)buffer[i]);
449 }
450
451 rt_kprintf("\n");
452 return RT_EOK;
453}
rt_ubase_t rt_size_t

引用了 rt_kprintf.

◆ rt_backtrace_to_buffer()

rt_err_t rt_backtrace_to_buffer ( rt_thread_t thread,
struct rt_hw_backtrace_frame * frame,
long skip,
rt_ubase_t * buffer,
long buflen )

Print backtrace from frame to the given buffer

参数
threadthe thread which frame belongs to
framewhere backtrace starts from. NULL if it's the current one
skipthe number of frames to discarded counted from calling function. Noted that the inner most frame is always discarded and not counted, which is obviously reasonable since that's this function itself.
bufferwhere traced frames saved
buflenmax number of items can be saved in buffer. If there are no more than buflen items to be saved, there will be a NULL after the last saved item in the buffer.
返回
rt_err_t 0 is success, otherwise a failure

在文件 kservice.c470 行定义.

475{
476 long nesting = 0;
477 struct rt_hw_backtrace_frame cur_frame;
478
479 if (!thread)
480 return -RT_EINVAL;
481
483
484 if (!frame)
485 {
486 frame = &cur_frame;
488 if (!frame->fp)
489 return -RT_EINVAL;
490 }
491
492 /* discard frames as required. The inner most is always threw. */
493 do {
494 rt_hw_backtrace_frame_unwind(thread, frame);
495 } while (skip-- > 0);
496
497 while (nesting < buflen)
498 {
499 *buffer++ = (rt_ubase_t)frame->pc;
500 if (rt_hw_backtrace_frame_unwind(thread, frame))
501 {
502 break;
503 }
504 nesting++;
505 }
506
507 if (nesting < buflen)
508 *buffer = RT_NULL;
509
510 return RT_EOK;
511}
rt_uint8_t rt_object_get_type(rt_object_t object)
This function will return the type of object without RT_Object_Class_Static flag.
@ RT_Object_Class_Thread
struct rt_object parent

引用了 rt_hw_backtrace_frame::fp, rt_thread::parent, rt_hw_backtrace_frame::pc, RT_ASSERT, RT_HW_BACKTRACE_FRAME_GET_SELF, rt_hw_backtrace_frame_unwind(), RT_NULL, RT_Object_Class_Thread , 以及 rt_object_get_type().

+ 函数调用图:

◆ rt_backtrace_thread()

rt_err_t rt_backtrace_thread ( rt_thread_t thread)

Print backtrace of a thread to system console device

参数
threadwhich call stack is traced
返回
rt_err_t 0 is success, otherwise a failure

在文件 kservice.c519 行定义.

520{
521 rt_err_t rc;
522 struct rt_hw_backtrace_frame frame;
523 if (thread)
524 {
525 rc = rt_hw_backtrace_frame_get(thread, &frame);
526 if (rc == RT_EOK)
527 {
528 rc = rt_backtrace_frame(thread, &frame);
529 }
530 }
531 else
532 {
533 rc = -RT_EINVAL;
534 }
535 return rc;
536}
rt_weak rt_err_t rt_hw_backtrace_frame_get(rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
Get the inner most frame of target thread
rt_base_t rt_err_t

引用了 rt_backtrace_frame() , 以及 rt_hw_backtrace_frame_get().

+ 函数调用图:

◆ rt_realloc_set_entry_hook()

void rt_realloc_set_entry_hook ( void(* hook )(void **ptr, rt_size_t size))

This function will set a hook function, which will be invoked when a memory block is allocated from heap memory.

参数
hookthe hook function.

在文件 kservice.c613 行定义.

614{
615 rt_realloc_entry_hook = hook;
616}

◆ rt_realloc_set_exit_hook()

void rt_realloc_set_exit_hook ( void(* hook )(void **ptr, rt_size_t size))

This function will set a hook function, which will be invoked when a memory block is allocated from heap memory.

参数
hookthe hook function.

在文件 kservice.c624 行定义.

625{
626 rt_realloc_exit_hook = hook;
627}

◆ rt_free_sethook()

void rt_free_sethook ( void(* hook )(void **ptr))

This function will set a hook function, which will be invoked when a memory block is released to heap memory.

参数
hookthe hook function

在文件 kservice.c635 行定义.

636{
637 rt_free_hook = hook;
638}

◆ _heap_lock_init()

rt_inline void _heap_lock_init ( void )

在文件 kservice.c650 行定义.

651{
652#if defined(RT_USING_HEAP_ISR)
653 rt_spin_lock_init(&_heap_spinlock);
654#elif defined(RT_USING_MUTEX)
655 rt_mutex_init(&_lock, "heap", RT_IPC_FLAG_PRIO);
656#endif
657}
#define RT_IPC_FLAG_PRIO
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag)
Initialize a static mutex object.
定义 ipc.c:1007

引用了 RT_IPC_FLAG_PRIO, rt_mutex_init() , 以及 rt_spin_lock_init().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ _heap_lock()

rt_inline rt_base_t _heap_lock ( void )

在文件 kservice.c659 行定义.

660{
661#if defined(RT_USING_HEAP_ISR)
662 return rt_spin_lock_irqsave(&_heap_spinlock);
663#elif defined(RT_USING_MUTEX)
664 if (rt_thread_self())
665 return rt_mutex_take(&_lock, RT_WAITING_FOREVER);
666 else
667 return RT_EOK;
668#else
670 return RT_EOK;
671#endif
672}
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
This function will disable the local interrupt and then lock the spinlock, will lock the thread sched...
#define RT_WAITING_FOREVER
rt_base_t rt_enter_critical(void)
This function will lock the thread scheduler.
rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time)
定义 ipc.c:1537

引用了 rt_enter_critical(), rt_mutex_take(), rt_spin_lock_irqsave(), rt_thread_self() , 以及 RT_WAITING_FOREVER.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ _heap_unlock()

rt_inline void _heap_unlock ( rt_base_t level)

在文件 kservice.c674 行定义.

675{
676#if defined(RT_USING_HEAP_ISR)
677 rt_spin_unlock_irqrestore(&_heap_spinlock, level);
678#elif defined(RT_USING_MUTEX)
679 RT_ASSERT(level == RT_EOK);
680 if (rt_thread_self())
681 rt_mutex_release(&_lock);
682#else
684#endif
685}
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
This function will unlock the spinlock and then restore current cpu interrupt status,...
void rt_exit_critical(void)
This function will unlock the thread scheduler.
rt_err_t rt_mutex_release(rt_mutex_t mutex)
This function will release a mutex. If there is thread suspended on the mutex, the thread will be res...
定义 ipc.c:1589

引用了 RT_ASSERT, rt_exit_critical(), rt_mutex_release(), rt_spin_unlock_irqrestore() , 以及 rt_thread_self().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ rt_system_heap_init_generic()

void rt_system_heap_init_generic ( void * begin_addr,
void * end_addr )

This function will do the generic system heap initialization.

参数
begin_addrthe beginning address of system page.
end_addrthe end address of system page.

在文件 kservice.c774 行定义.

775{
776 rt_uintptr_t begin_align = RT_ALIGN((rt_uintptr_t)begin_addr, RT_ALIGN_SIZE);
777 rt_uintptr_t end_align = RT_ALIGN_DOWN((rt_uintptr_t)end_addr, RT_ALIGN_SIZE);
778
779 RT_ASSERT(end_align > begin_align);
780
781 /* Initialize system memory heap */
782 _MEM_INIT("heap", (void *)begin_align, end_align - begin_align);
783 /* Initialize multi thread contention lock */
785}
#define RT_ALIGN(size, align)
#define RT_ALIGN_DOWN(size, align)
rt_inline void _heap_lock_init(void)
#define _MEM_INIT(...)
rt_base_t rt_uintptr_t

引用了 _heap_lock_init(), _MEM_INIT, RT_ALIGN, RT_ALIGN_DOWN , 以及 RT_ASSERT.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ rt_system_heap_init()

rt_weak void rt_system_heap_init ( void * begin_addr,
void * end_addr )

This function will init system heap. User can override this API to complete other works, like heap sanitizer initialization.

参数
begin_addrthe beginning address of system page.
end_addrthe end address of system page.

在文件 kservice.c795 行定义.

796{
797 rt_system_heap_init_generic(begin_addr, end_addr);
798}
void rt_system_heap_init_generic(void *begin_addr, void *end_addr)
This function will do the generic system heap initialization.

引用了 rt_system_heap_init_generic().

+ 函数调用图:

◆ rt_malloc()

rt_weak void * rt_malloc ( rt_size_t size)

Allocate a block of memory with a minimum of 'size' bytes.

参数
sizeis the minimum size of the requested block in bytes.
返回
the pointer to allocated memory or NULL if no free memory was found.

在文件 kservice.c807 行定义.

808{
809 rt_base_t level;
810 void *ptr;
811
812 /* Enter critical zone */
813 level = _heap_lock();
814 /* allocate memory block from system heap */
815 ptr = _MEM_MALLOC(size);
816 /* Exit critical zone */
817 _heap_unlock(level);
818 /* call 'rt_malloc' hook */
819 RT_OBJECT_HOOK_CALL(rt_malloc_hook, (&ptr, size));
820 return ptr;
821}
#define RT_OBJECT_HOOK_CALL(func, argv)
rt_inline rt_base_t _heap_lock(void)
#define _MEM_MALLOC(...)
rt_inline void _heap_unlock(rt_base_t level)
rt_int32_t rt_base_t

引用了 _heap_lock(), _heap_unlock(), _MEM_MALLOC , 以及 RT_OBJECT_HOOK_CALL.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [2/8]

RTM_EXPORT ( rt_malloc )

引用了 rt_malloc().

+ 函数调用图:

◆ rt_realloc()

rt_weak void * rt_realloc ( void * ptr,
rt_size_t newsize )

This function will change the size of previously allocated memory block.

参数
ptris the pointer to memory allocated by rt_malloc.
newsizeis the required new size.
返回
the changed memory block address.

在文件 kservice.c833 行定义.

834{
835 rt_base_t level;
836 void *nptr;
837
838 /* Entry hook */
839 RT_OBJECT_HOOK_CALL(rt_realloc_entry_hook, (&ptr, newsize));
840 /* Enter critical zone */
841 level = _heap_lock();
842 /* Change the size of previously allocated memory block */
843 nptr = _MEM_REALLOC(ptr, newsize);
844 /* Exit critical zone */
845 _heap_unlock(level);
846 /* Exit hook */
847 RT_OBJECT_HOOK_CALL(rt_realloc_exit_hook, (&nptr, newsize));
848 return nptr;
849}
#define _MEM_REALLOC(...)

引用了 _heap_lock(), _heap_unlock(), _MEM_REALLOC , 以及 RT_OBJECT_HOOK_CALL.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [3/8]

RTM_EXPORT ( rt_realloc )

引用了 rt_realloc().

+ 函数调用图:

◆ rt_calloc()

rt_weak void * rt_calloc ( rt_size_t count,
rt_size_t size )

This function will contiguously allocate enough space for count objects that are size bytes of memory each and returns a pointer to the allocated memory.

注解
The allocated memory is filled with bytes of value zero.
参数
countis the number of objects to allocate.
sizeis the size of one object to allocate.
返回
pointer to allocated memory / NULL pointer if there is an error.

在文件 kservice.c865 行定义.

866{
867 void *p;
868
869 /* allocate 'count' objects of size 'size' */
870 p = rt_malloc(count * size);
871 /* zero the memory */
872 if (p)
873 {
874 rt_memset(p, 0, count * size);
875 }
876 return p;
877}
rt_weak void * rt_malloc(rt_size_t size)
Allocate a block of memory with a minimum of 'size' bytes.

引用了 rt_malloc().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [4/8]

RTM_EXPORT ( rt_calloc )

引用了 rt_calloc().

+ 函数调用图:

◆ rt_free()

rt_weak void rt_free ( void * ptr)

This function will release the previously allocated memory block by rt_malloc. The released memory block is taken back to system heap.

参数
ptrthe address of memory which will be released.

在文件 kservice.c886 行定义.

887{
888 rt_base_t level;
889
890 /* call 'rt_free' hook */
891 RT_OBJECT_HOOK_CALL(rt_free_hook, (&ptr));
892 /* NULL check */
893 if (ptr == RT_NULL) return;
894 /* Enter critical zone */
895 level = _heap_lock();
896 _MEM_FREE(ptr);
897 /* Exit critical zone */
898 _heap_unlock(level);
899}
#define _MEM_FREE(...)

引用了 _heap_lock(), _heap_unlock(), _MEM_FREE, RT_NULL , 以及 RT_OBJECT_HOOK_CALL.

+ 函数调用图:

◆ RTM_EXPORT() [5/8]

RTM_EXPORT ( rt_free )

引用了 rt_free().

+ 函数调用图:

◆ rt_memory_info()

rt_weak void rt_memory_info ( rt_size_t * total,
rt_size_t * used,
rt_size_t * max_used )

This function will caculate the total memory, the used memory, and the max used memory.

参数
totalis a pointer to get the total size of the memory.
usedis a pointer to get the size of memory used.
max_usedis a pointer to get the maximum memory used.

在文件 kservice.c912 行定义.

915{
916 rt_base_t level;
917
918 /* Enter critical zone */
919 level = _heap_lock();
920 _MEM_INFO(total, used, max_used);
921 /* Exit critical zone */
922 _heap_unlock(level);
923}
#define _MEM_INFO(...)

引用了 _heap_lock(), _heap_unlock() , 以及 _MEM_INFO.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [6/8]

RTM_EXPORT ( rt_memory_info )

引用了 rt_memory_info().

+ 函数调用图:

◆ rt_malloc_align()

rt_weak void * rt_malloc_align ( rt_size_t size,
rt_size_t align )

This function allocates a memory block, which address is aligned to the specified alignment size.

参数
sizeis the allocated memory block size.
alignis the alignment size.
返回
The memory block address was returned successfully, otherwise it was returned empty RT_NULL.

在文件 kservice.c965 行定义.

966{
967 void *ptr = RT_NULL;
968 void *align_ptr = RT_NULL;
969 int uintptr_size = 0;
970 rt_size_t align_size = 0;
971
972 /* sizeof pointer */
973 uintptr_size = sizeof(void*);
974 uintptr_size -= 1;
975
976 /* align the alignment size to uintptr size byte */
977 align = ((align + uintptr_size) & ~uintptr_size);
978
979 /* get total aligned size */
980 align_size = ((size + uintptr_size) & ~uintptr_size) + align;
981 /* allocate memory block from heap */
982 ptr = rt_malloc(align_size);
983 if (ptr != RT_NULL)
984 {
985 /* the allocated memory block is aligned */
986 if (((rt_uintptr_t)ptr & (align - 1)) == 0)
987 {
988 align_ptr = (void *)((rt_uintptr_t)ptr + align);
989 }
990 else
991 {
992 align_ptr = (void *)(((rt_uintptr_t)ptr + (align - 1)) & ~(align - 1));
993 }
994
995 /* set the pointer before alignment pointer to the real pointer */
996 *((rt_uintptr_t *)((rt_uintptr_t)align_ptr - sizeof(void *))) = (rt_uintptr_t)ptr;
997
998 ptr = align_ptr;
999 }
1000
1001 return ptr;
1002}

引用了 rt_malloc() , 以及 RT_NULL.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [7/8]

RTM_EXPORT ( rt_malloc_align )

引用了 rt_malloc_align().

+ 函数调用图:

◆ rt_free_align()

rt_weak void rt_free_align ( void * ptr)

This function release the memory block, which is allocated by rt_malloc_align function and address is aligned.

参数
ptris the memory block pointer.

在文件 kservice.c1011 行定义.

1012{
1013 void *real_ptr = RT_NULL;
1014
1015 /* NULL check */
1016 if (ptr == RT_NULL) return;
1017 real_ptr = (void *) * (rt_uintptr_t *)((rt_uintptr_t)ptr - sizeof(void *));
1018 rt_free(real_ptr);
1019}
rt_weak void rt_free(void *ptr)
This function will release the previously allocated memory block by rt_malloc. The released memory bl...

引用了 rt_free() , 以及 RT_NULL.

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ RTM_EXPORT() [8/8]

RTM_EXPORT ( rt_free_align )

引用了 __lowest_bit_bitmap , 以及 rt_free_align().

+ 函数调用图:

◆ __rt_ffs()

int __rt_ffs ( int value)

This function finds the first bit set (beginning with the least significant bit) in value and return the index of that bit.

Bits are numbered starting at 1 (the least significant bit). A return value of zero from any of these functions means that the argument was zero.

参数
valueis the value to find the first bit set in.
返回
Return the index of the first bit set. If value is 0, then this function shall return 0.

在文件 kservice.c1083 行定义.

1084{
1085 if (value == 0)
1086 {
1087 return 0;
1088 }
1089
1090 if (value & 0xff)
1091 {
1092 return __lowest_bit_bitmap[value & 0xff] + 1;
1093 }
1094
1095 if (value & 0xff00)
1096 {
1097 return __lowest_bit_bitmap[(value & 0xff00) >> 8] + 9;
1098 }
1099
1100 if (value & 0xff0000)
1101 {
1102 return __lowest_bit_bitmap[(value & 0xff0000) >> 16] + 17;
1103 }
1104
1105 return __lowest_bit_bitmap[(value & 0xff000000) >> 24] + 25;
1106}
const rt_uint8_t __lowest_bit_bitmap[]

引用了 __lowest_bit_bitmap.

+ 这是这个函数的调用关系图:

◆ rt_list_init()

rt_inline void rt_list_init ( rt_list_t * l)

initialize a list

参数
llist to be initialized

在文件 rtservice.h50 行定义.

51{
52 l->next = l->prev = l;
53}
struct rt_list_node * next
struct rt_list_node * prev

引用了 rt_list_node::next , 以及 rt_list_node::prev.

+ 这是这个函数的调用关系图:

◆ rt_list_insert_after()

rt_inline void rt_list_insert_after ( rt_list_t * l,
rt_list_t * n )

insert a node after a list

参数
llist to insert it
nnew node to be inserted

在文件 rtservice.h61 行定义.

62{
63 l->next->prev = n;
64 n->next = l->next;
65
66 l->next = n;
67 n->prev = l;
68}

引用了 rt_list_node::next , 以及 rt_list_node::prev.

+ 这是这个函数的调用关系图:

◆ rt_list_insert_before()

rt_inline void rt_list_insert_before ( rt_list_t * l,
rt_list_t * n )

insert a node before a list

参数
nnew node to be inserted
llist to insert it

在文件 rtservice.h76 行定义.

77{
78 l->prev->next = n;
79 n->prev = l->prev;
80
81 l->prev = n;
82 n->next = l;
83}

引用了 rt_list_node::next , 以及 rt_list_node::prev.

+ 这是这个函数的调用关系图:

◆ rt_list_remove()

rt_inline void rt_list_remove ( rt_list_t * n)

remove node from list.

参数
nthe node to remove from the list.

在文件 rtservice.h89 行定义.

90{
91 n->next->prev = n->prev;
92 n->prev->next = n->next;
93
94 n->next = n->prev = n;
95}

引用了 rt_list_node::next , 以及 rt_list_node::prev.

+ 这是这个函数的调用关系图:

◆ rt_list_isempty()

rt_inline int rt_list_isempty ( const rt_list_t * l)

tests whether a list is empty

参数
lthe list to test.

在文件 rtservice.h101 行定义.

102{
103 return l->next == l;
104}

引用了 rt_list_node::next.

+ 这是这个函数的调用关系图:

◆ rt_list_len()

rt_inline unsigned int rt_list_len ( const rt_list_t * l)

get the list length

参数
lthe list to get.

在文件 rtservice.h110 行定义.

111{
112 unsigned int len = 0;
113 const rt_list_t *p = l;
114 while (p->next != l)
115 {
116 p = p->next;
117 len ++;
118 }
119
120 return len;
121}
struct rt_list_node rt_list_t

引用了 rt_list_node::next.

+ 这是这个函数的调用关系图:

◆ rt_slist_init()

rt_inline void rt_slist_init ( rt_slist_t * l)

initialize a single list

参数
lthe single list to be initialized

在文件 rtservice.h192 行定义.

193{
194 l->next = RT_NULL;
195}
struct rt_slist_node * next

引用了 rt_slist_node::next , 以及 RT_NULL.

◆ rt_slist_append()

rt_inline void rt_slist_append ( rt_slist_t * l,
rt_slist_t * n )

在文件 rtservice.h197 行定义.

198{
199 struct rt_slist_node *node;
200
201 node = l;
202 while (node->next) node = node->next;
203
204 /* append the node to the tail */
205 node->next = n;
206 n->next = RT_NULL;
207}

引用了 rt_slist_node::next , 以及 RT_NULL.

◆ rt_slist_insert()

rt_inline void rt_slist_insert ( rt_slist_t * l,
rt_slist_t * n )

在文件 rtservice.h209 行定义.

210{
211 n->next = l->next;
212 l->next = n;
213}

引用了 rt_slist_node::next.

◆ rt_slist_len()

rt_inline unsigned int rt_slist_len ( const rt_slist_t * l)

在文件 rtservice.h215 行定义.

216{
217 unsigned int len = 0;
218 const rt_slist_t *list = l->next;
219 while (list != RT_NULL)
220 {
221 list = list->next;
222 len ++;
223 }
224
225 return len;
226}
struct rt_slist_node rt_slist_t

引用了 rt_slist_node::next , 以及 RT_NULL.

◆ rt_slist_pop()

rt_inline rt_slist_t * rt_slist_pop ( rt_slist_t * l)

在文件 rtservice.h228 行定义.

229{
230 struct rt_slist_node *node = l;
231
232 /* remove node */
233 node = node->next;
234 if (node != (rt_slist_t *)0)
235 {
236 ((struct rt_slist_node *)l)->next = node->next;
237 }
238
239 return node;
240}

引用了 rt_slist_node::next.

◆ rt_slist_remove()

rt_inline rt_slist_t * rt_slist_remove ( rt_slist_t * l,
rt_slist_t * n )

在文件 rtservice.h242 行定义.

243{
244 /* remove slist head */
245 struct rt_slist_node *node = l;
246 while (node->next && node->next != n) node = node->next;
247
248 /* remove node */
249 if (node->next != (rt_slist_t *)0) node->next = node->next->next;
250
251 return l;
252}

引用了 rt_slist_node::next.

◆ rt_slist_first()

rt_inline rt_slist_t * rt_slist_first ( rt_slist_t * l)

在文件 rtservice.h254 行定义.

255{
256 return l->next;
257}

引用了 rt_slist_node::next.

◆ rt_slist_tail()

rt_inline rt_slist_t * rt_slist_tail ( rt_slist_t * l)

在文件 rtservice.h259 行定义.

260{
261 while (l->next) l = l->next;
262
263 return l;
264}

引用了 rt_slist_node::next.

◆ rt_slist_next()

rt_inline rt_slist_t * rt_slist_next ( rt_slist_t * n)

在文件 rtservice.h266 行定义.

267{
268 return n->next;
269}

引用了 rt_slist_node::next.

◆ rt_slist_isempty()

rt_inline int rt_slist_isempty ( rt_slist_t * l)

在文件 rtservice.h271 行定义.

272{
273 return l->next == RT_NULL;
274}

引用了 rt_slist_node::next , 以及 RT_NULL.

◆ __rt_ffsl()

unsigned long __rt_ffsl ( unsigned long value)

◆ __rt_clz()

unsigned long __rt_clz ( unsigned long value)

◆ rt_in_thread_context()

rt_inline rt_bool_t rt_in_thread_context ( void )

在文件 rtthread.h871 行定义.

872{
873 return rt_thread_self() != RT_NULL && rt_interrupt_get_nest() == 0;
874}
rt_uint8_t rt_interrupt_get_nest(void)
This function will return the nest of interrupt.
定义 irq.c:136

引用了 rt_interrupt_get_nest(), RT_NULL , 以及 rt_thread_self().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ rt_scheduler_is_available()

rt_inline rt_bool_t rt_scheduler_is_available ( void )

在文件 rtthread.h877 行定义.

878{
879 return rt_critical_level() == 0 && rt_in_thread_context();
880}
rt_inline rt_bool_t rt_in_thread_context(void)
rt_uint16_t rt_critical_level(void)
Get the scheduler lock level.

引用了 rt_critical_level() , 以及 rt_in_thread_context().

+ 函数调用图:
+ 这是这个函数的调用关系图:

变量说明

◆ __lowest_bit_bitmap

const rt_uint8_t __lowest_bit_bitmap[]
初始值:
=
{
0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
}

在文件 kservice.c1051 行定义.

1052{
1053 /* 00 */ 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1054 /* 10 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1055 /* 20 */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1056 /* 30 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1057 /* 40 */ 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1058 /* 50 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1059 /* 60 */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1060 /* 70 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1061 /* 80 */ 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1062 /* 90 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1063 /* A0 */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1064 /* B0 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1065 /* C0 */ 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1066 /* D0 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1067 /* E0 */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
1068 /* F0 */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
1069};