Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
混口饭吃,
rt-thread
提交
d586417b
R
rt-thread
项目概览
混口饭吃,
/
rt-thread
与 Fork 源项目一致
Fork自
Mr_Pangza / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d586417b
编写于
9月 10, 2021
作者:
S
Sherman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kservice] 完善 API 注释
上级
45440d24
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
146 addition
and
80 deletion
+146
-80
src/kservice.c
src/kservice.c
+146
-80
未找到文件。
src/kservice.c
浏览文件 @
d586417b
...
@@ -43,8 +43,8 @@ static volatile int __rt_errno;
...
@@ -43,8 +43,8 @@ static volatile int __rt_errno;
static
rt_device_t
_console_device
=
RT_NULL
;
static
rt_device_t
_console_device
=
RT_NULL
;
#endif
#endif
/*
/*
*
* This function
will get errno
* This function
gets the global errno for the current thread.
*
*
* @return errno
* @return errno
*/
*/
...
@@ -66,10 +66,10 @@ rt_err_t rt_get_errno(void)
...
@@ -66,10 +66,10 @@ rt_err_t rt_get_errno(void)
}
}
RTM_EXPORT
(
rt_get_errno
);
RTM_EXPORT
(
rt_get_errno
);
/*
/*
*
* This function
will set errno
* This function
sets the global errno for the current thread.
*
*
* @param error
the errno shall be set
* @param error
is the errno shall be set.
*/
*/
void
rt_set_errno
(
rt_err_t
error
)
void
rt_set_errno
(
rt_err_t
error
)
{
{
...
@@ -96,9 +96,9 @@ void rt_set_errno(rt_err_t error)
...
@@ -96,9 +96,9 @@ void rt_set_errno(rt_err_t error)
RTM_EXPORT
(
rt_set_errno
);
RTM_EXPORT
(
rt_set_errno
);
/**
/**
* This function returns errno.
* This function returns
the address of the current thread
errno.
*
*
* @return
the errno in the system
* @return
The errno address.
*/
*/
int
*
_rt_errno
(
void
)
int
*
_rt_errno
(
void
)
{
{
...
@@ -116,13 +116,16 @@ int *_rt_errno(void)
...
@@ -116,13 +116,16 @@ int *_rt_errno(void)
RTM_EXPORT
(
_rt_errno
);
RTM_EXPORT
(
_rt_errno
);
/**
/**
* This function will set the content of memory to specified value
* This function will set the content of memory to specified value.
*
* @param s is the address of source memory, point to the memory block to be filled.
*
* @param c is the value to be set. The value is passed in int form, but the function
* uses the unsigned character form of the value when filling the memory block.
*
*
* @param s the address of source memory
* @param count number of bytes to be set.
* @param c the value shall be set in content
* @param count the copied length
*
*
* @return
the address of source memory
* @return
The address of source memory.
*/
*/
RT_WEAK
void
*
rt_memset
(
void
*
s
,
int
c
,
rt_ubase_t
count
)
RT_WEAK
void
*
rt_memset
(
void
*
s
,
int
c
,
rt_ubase_t
count
)
{
{
...
@@ -200,14 +203,15 @@ RTM_EXPORT(rt_memset);
...
@@ -200,14 +203,15 @@ RTM_EXPORT(rt_memset);
#ifndef RT_USING_ASM_MEMCPY
#ifndef RT_USING_ASM_MEMCPY
/**
/**
* This function will copy memory content from source address to destination
* This function will copy memory content from source address to destination address.
* address.
*
*
* @param dst the address of destination memory
* @param dst is the address of destination memory, points to the copied content.
* @param src the address of source memory
* @param count the copied length
*
*
* @return the address of destination memory
* @param src is the address of source memory, pointing to the data source to be copied.
*
* @param count is the copied length.
*
* @return The address of destination memory
*/
*/
void
*
rt_memcpy
(
void
*
dst
,
const
void
*
src
,
rt_ubase_t
count
)
void
*
rt_memcpy
(
void
*
dst
,
const
void
*
src
,
rt_ubase_t
count
)
{
{
...
@@ -287,13 +291,16 @@ RTM_EXPORT(rt_memcpy);
...
@@ -287,13 +291,16 @@ RTM_EXPORT(rt_memcpy);
/**
/**
* This function will move memory content from source address to destination
* This function will move memory content from source address to destination
* address.
* address. If the destination memory does not overlap with the source memory,
* the function is the same as memcpy().
*
* @param dst is the address of destination memory, points to the copied content.
*
*
* @param dest the address of destination memory
* @param src is the address of source memory, point to the data source to be copied.
* @param src the address of source memory
* @param n the copied length
*
*
* @return the address of destination memory
* @param count is the copied length.
*
* @return The address of destination memory.
*/
*/
void
*
rt_memmove
(
void
*
dest
,
const
void
*
src
,
rt_ubase_t
n
)
void
*
rt_memmove
(
void
*
dest
,
const
void
*
src
,
rt_ubase_t
n
)
{
{
...
@@ -318,13 +325,18 @@ void *rt_memmove(void *dest, const void *src, rt_ubase_t n)
...
@@ -318,13 +325,18 @@ void *rt_memmove(void *dest, const void *src, rt_ubase_t n)
RTM_EXPORT
(
rt_memmove
);
RTM_EXPORT
(
rt_memmove
);
/**
/**
* This function will compare two areas of memory
* This function will compare two areas of memory.
*
* @param cs is a block of memory.
*
* @param ct is another block of memory.
*
*
* @param cs one area of memory
* @param count is the size of the area.
* @param ct another area of memory
* @param count the size of the area
*
*
* @return the result
* @return Compare the results:
* If the result < 0, cs is smaller than ct.
* If the result > 0, cs is greater than ct.
* If the result = 0, cs is equal to ct.
*/
*/
RT_WEAK
rt_int32_t
rt_memcmp
(
const
void
*
cs
,
const
void
*
ct
,
rt_ubase_t
count
)
RT_WEAK
rt_int32_t
rt_memcmp
(
const
void
*
cs
,
const
void
*
ct
,
rt_ubase_t
count
)
{
{
...
@@ -340,12 +352,14 @@ RT_WEAK rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count)
...
@@ -340,12 +352,14 @@ RT_WEAK rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count)
RTM_EXPORT
(
rt_memcmp
);
RTM_EXPORT
(
rt_memcmp
);
/**
/**
* This function will return the first occurrence of a string.
* This function will return the first occurrence of a string, without the
* terminator '\0'.
*
*
* @param s1 the source string
* @param s1 is the source string.
* @param s2 the find string
*
*
* @return the first occurrence of a s2 in s1, or RT_NULL if no found.
* @param s2 is the find string.
*
* @return The first occurrence of a s2 in s1, or RT_NULL if no found.
*/
*/
char
*
rt_strstr
(
const
char
*
s1
,
const
char
*
s2
)
char
*
rt_strstr
(
const
char
*
s1
,
const
char
*
s2
)
{
{
...
@@ -370,10 +384,14 @@ RTM_EXPORT(rt_strstr);
...
@@ -370,10 +384,14 @@ RTM_EXPORT(rt_strstr);
/**
/**
* This function will compare two strings while ignoring differences in case
* This function will compare two strings while ignoring differences in case
*
*
* @param a the string to be compared
* @param a is the string to be compared.
* @param b the string to be compared
*
* @param b is the string to be compared.
*
*
* @return the result
* @return Compare the results:
* If the result < 0, a is smaller than a.
* If the result > 0, a is greater than a.
* If the result = 0, a is equal to a.
*/
*/
rt_int32_t
rt_strcasecmp
(
const
char
*
a
,
const
char
*
b
)
rt_int32_t
rt_strcasecmp
(
const
char
*
a
,
const
char
*
b
)
{
{
...
@@ -397,11 +415,13 @@ RTM_EXPORT(rt_strcasecmp);
...
@@ -397,11 +415,13 @@ RTM_EXPORT(rt_strcasecmp);
/**
/**
* This function will copy string no more than n bytes.
* This function will copy string no more than n bytes.
*
*
* @param
dst the string to copy
* @param
dst points to the address used to store the copied content.
*
@param src the string to be copied
*
* @param
n the maximum copied length
* @param
src is the string to be copied.
*
*
* @return the result
* @param n is the maximum copied length.
*
* @return The address where the copied content is stored.
*/
*/
char
*
rt_strncpy
(
char
*
dst
,
const
char
*
src
,
rt_ubase_t
n
)
char
*
rt_strncpy
(
char
*
dst
,
const
char
*
src
,
rt_ubase_t
n
)
{
{
...
@@ -427,13 +447,18 @@ char *rt_strncpy(char *dst, const char *src, rt_ubase_t n)
...
@@ -427,13 +447,18 @@ char *rt_strncpy(char *dst, const char *src, rt_ubase_t n)
RTM_EXPORT
(
rt_strncpy
);
RTM_EXPORT
(
rt_strncpy
);
/**
/**
* This function will compare two strings with specified maximum length
* This function will compare two strings with specified maximum length.
*
* @param cs is the string to be compared.
*
* @param ct is the string to be compared.
*
*
* @param cs the string to be compared
* @param count is the maximum compare length.
* @param ct the string to be compared
* @param count the maximum compare length
*
*
* @return the result
* @return Compare the results:
* If the result < 0, cs is smaller than ct.
* If the result > 0, cs is greater than ct.
* If the result = 0, cs is equal to ct.
*/
*/
rt_int32_t
rt_strncmp
(
const
char
*
cs
,
const
char
*
ct
,
rt_ubase_t
count
)
rt_int32_t
rt_strncmp
(
const
char
*
cs
,
const
char
*
ct
,
rt_ubase_t
count
)
{
{
...
@@ -451,12 +476,16 @@ rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count)
...
@@ -451,12 +476,16 @@ rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count)
RTM_EXPORT
(
rt_strncmp
);
RTM_EXPORT
(
rt_strncmp
);
/**
/**
* This function will compare two strings without specified length
* This function will compare two strings without specified length
.
*
*
* @param cs the string to be compared
* @param cs is the string to be compared.
* @param ct the string to be compared
*
*
* @return the result
* @param ct is the string to be compared.
*
* @return Compare the results:
* If the result < 0, cs is smaller than ct.
* If the result > 0, cs is greater than ct.
* If the result = 0, cs is equal to ct.
*/
*/
rt_int32_t
rt_strcmp
(
const
char
*
cs
,
const
char
*
ct
)
rt_int32_t
rt_strcmp
(
const
char
*
cs
,
const
char
*
ct
)
{
{
...
@@ -477,9 +506,11 @@ RTM_EXPORT(rt_strcmp);
...
@@ -477,9 +506,11 @@ RTM_EXPORT(rt_strcmp);
* first maxlen characters in the string pointed to by s and never
* first maxlen characters in the string pointed to by s and never
* beyond s+maxlen.
* beyond s+maxlen.
*
*
* @param s the string
* @param s is the string.
* @param maxlen the max size
*
* @return the length of string
* @param maxlen is the max size.
*
* @return The length of string.
*/
*/
rt_size_t
rt_strnlen
(
const
char
*
s
,
rt_ubase_t
maxlen
)
rt_size_t
rt_strnlen
(
const
char
*
s
,
rt_ubase_t
maxlen
)
{
{
...
@@ -496,9 +527,9 @@ RTM_EXPORT(rt_strnlen);
...
@@ -496,9 +527,9 @@ RTM_EXPORT(rt_strnlen);
* This function will return the length of a string, which terminate will
* This function will return the length of a string, which terminate will
* null character.
* null character.
*
*
* @param s the string
* @param
s i
s the string
*
*
* @return
the length of string
* @return
The length of string.
*/
*/
rt_size_t
rt_strlen
(
const
char
*
s
)
rt_size_t
rt_strlen
(
const
char
*
s
)
{
{
...
@@ -517,9 +548,9 @@ RTM_EXPORT(rt_strlen);
...
@@ -517,9 +548,9 @@ RTM_EXPORT(rt_strlen);
/**
/**
* This function will duplicate a string.
* This function will duplicate a string.
*
*
* @param
s the string to be duplicated
* @param
s is the string to be duplicated.
*
*
* @return
the duplicated string pointer
* @return
The string address of the copy.
*/
*/
char
*
rt_strdup
(
const
char
*
s
)
char
*
rt_strdup
(
const
char
*
s
)
{
{
...
@@ -556,6 +587,13 @@ RTM_EXPORT(rt_show_version);
...
@@ -556,6 +587,13 @@ RTM_EXPORT(rt_show_version);
#define _ISDIGIT(c) ((unsigned)((c) - '0') < 10)
#define _ISDIGIT(c) ((unsigned)((c) - '0') < 10)
#ifdef RT_PRINTF_LONGLONG
#ifdef RT_PRINTF_LONGLONG
/**
* This function will duplicate a string.
*
* @param s the string to be duplicated
*
* @return the duplicated string pointer
*/
rt_inline
int
divide
(
long
long
*
n
,
int
base
)
rt_inline
int
divide
(
long
long
*
n
,
int
base
)
{
{
int
res
;
int
res
;
...
@@ -784,6 +822,19 @@ static char *print_number(char *buf,
...
@@ -784,6 +822,19 @@ static char *print_number(char *buf,
return
buf
;
return
buf
;
}
}
/**
* This function will fill a formatted string to buffer.
*
* @param buf is the buffer to save formatted string.
*
* @param size is the size of buffer.
*
* @param fmt is the format parameters.
*
* @param args is a list of variable parameters.
*
* @return The number of characters actually written to buffer.
*/
rt_int32_t
rt_vsnprintf
(
char
*
buf
,
rt_int32_t
rt_vsnprintf
(
char
*
buf
,
rt_size_t
size
,
rt_size_t
size
,
const
char
*
fmt
,
const
char
*
fmt
,
...
@@ -1051,11 +1102,15 @@ rt_int32_t rt_vsnprintf(char *buf,
...
@@ -1051,11 +1102,15 @@ rt_int32_t rt_vsnprintf(char *buf,
RTM_EXPORT
(
rt_vsnprintf
);
RTM_EXPORT
(
rt_vsnprintf
);
/**
/**
* This function will fill a formatted string to buffer
* This function will fill a formatted string to buffer
.
*
*
* @param buf the buffer to save formatted string
* @param buf is the buffer to save formatted string.
* @param size the size of buffer
*
* @param fmt the format
* @param size is the size of buffer.
*
* @param fmt is the format parameters.
*
* @return The number of characters actually written to buffer.
*/
*/
rt_int32_t
rt_snprintf
(
char
*
buf
,
rt_size_t
size
,
const
char
*
fmt
,
...)
rt_int32_t
rt_snprintf
(
char
*
buf
,
rt_size_t
size
,
const
char
*
fmt
,
...)
{
{
...
@@ -1071,11 +1126,15 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...)
...
@@ -1071,11 +1126,15 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...)
RTM_EXPORT
(
rt_snprintf
);
RTM_EXPORT
(
rt_snprintf
);
/**
/**
* This function will fill a formatted string to buffer
* This function will fill a formatted string to buffer.
*
* @param buf is the buffer to save formatted string.
*
* @param format is the format parameters.
*
*
* @param
buf the buffer to save formatted string
* @param
arg_ptr is a list of variable parameters.
*
@param arg_ptr the arg_ptr
*
* @
param format the format
* @
return The number of characters actually written to buffer.
*/
*/
rt_int32_t
rt_vsprintf
(
char
*
buf
,
const
char
*
format
,
va_list
arg_ptr
)
rt_int32_t
rt_vsprintf
(
char
*
buf
,
const
char
*
format
,
va_list
arg_ptr
)
{
{
...
@@ -1086,8 +1145,11 @@ RTM_EXPORT(rt_vsprintf);
...
@@ -1086,8 +1145,11 @@ RTM_EXPORT(rt_vsprintf);
/**
/**
* This function will fill a formatted string to buffer
* This function will fill a formatted string to buffer
*
*
* @param buf the buffer to save formatted string
* @param buf the buffer to save formatted string.
* @param format the format
*
* @param format is the format parameters.
*
* @return The number of characters actually written to buffer.
*/
*/
rt_int32_t
rt_sprintf
(
char
*
buf
,
const
char
*
format
,
...)
rt_int32_t
rt_sprintf
(
char
*
buf
,
const
char
*
format
,
...)
{
{
...
@@ -1108,7 +1170,7 @@ RTM_EXPORT(rt_sprintf);
...
@@ -1108,7 +1170,7 @@ RTM_EXPORT(rt_sprintf);
/**
/**
* This function returns the device using in console.
* This function returns the device using in console.
*
*
* @return
the device using in console or RT_NULL
* @return
Returns the console device pointer or RT_NULL.
*/
*/
rt_device_t
rt_console_get_device
(
void
)
rt_device_t
rt_console_get_device
(
void
)
{
{
...
@@ -1121,7 +1183,7 @@ RTM_EXPORT(rt_console_get_device);
...
@@ -1121,7 +1183,7 @@ RTM_EXPORT(rt_console_get_device);
* After set a device to console, all output of rt_kprintf will be
* After set a device to console, all output of rt_kprintf will be
* redirected to this new device.
* redirected to this new device.
*
*
* @param
name the name of new console device
* @param
name is the name of new console device.
*
*
* @return the old console device handler on successful, or RT_NULL on failure.
* @return the old console device handler on successful, or RT_NULL on failure.
*/
*/
...
@@ -1165,7 +1227,7 @@ RTM_EXPORT(rt_hw_console_output);
...
@@ -1165,7 +1227,7 @@ RTM_EXPORT(rt_hw_console_output);
/**
/**
* This function will put string to the console.
* This function will put string to the console.
*
*
* @param str the string output to the console.
* @param str
is
the string output to the console.
*/
*/
void
rt_kputs
(
const
char
*
str
)
void
rt_kputs
(
const
char
*
str
)
{
{
...
@@ -1186,9 +1248,9 @@ void rt_kputs(const char *str)
...
@@ -1186,9 +1248,9 @@ void rt_kputs(const char *str)
}
}
/**
/**
* This function will print a formatted string on system console
* This function will print a formatted string on system console
.
*
*
* @param fmt
the format
* @param fmt
is the format parameters.
*/
*/
RT_WEAK
void
rt_kprintf
(
const
char
*
fmt
,
...)
RT_WEAK
void
rt_kprintf
(
const
char
*
fmt
,
...)
{
{
...
@@ -1227,10 +1289,12 @@ RTM_EXPORT(rt_kprintf);
...
@@ -1227,10 +1289,12 @@ RTM_EXPORT(rt_kprintf);
* This function allocates a memory block, which address is aligned to the
* This function allocates a memory block, which address is aligned to the
* specified alignment size.
* specified alignment size.
*
*
* @param size the allocated memory block size
* @param size is the allocated memory block size.
* @param align the alignment size
*
*
* @return the allocated memory block on successful, otherwise returns RT_NULL
* @param align is the alignment size.
*
* @return The memory block address was returned successfully, otherwise it was
* returned empty RT_NULL.
*/
*/
RT_WEAK
void
*
rt_malloc_align
(
rt_size_t
size
,
rt_size_t
align
)
RT_WEAK
void
*
rt_malloc_align
(
rt_size_t
size
,
rt_size_t
align
)
{
{
...
@@ -1276,7 +1340,7 @@ RTM_EXPORT(rt_malloc_align);
...
@@ -1276,7 +1340,7 @@ RTM_EXPORT(rt_malloc_align);
* This function release the memory block, which is allocated by
* This function release the memory block, which is allocated by
* rt_malloc_align function and address is aligned.
* rt_malloc_align function and address is aligned.
*
*
* @param ptr
the memory block pointer
* @param ptr
is the memory block pointer.
*/
*/
RT_WEAK
void
rt_free_align
(
void
*
ptr
)
RT_WEAK
void
rt_free_align
(
void
*
ptr
)
{
{
...
@@ -1316,8 +1380,8 @@ const rt_uint8_t __lowest_bit_bitmap[] =
...
@@ -1316,8 +1380,8 @@ const rt_uint8_t __lowest_bit_bitmap[] =
* Bits are numbered starting at 1 (the least significant bit). A return value of
* 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.
* zero from any of these functions means that the argument was zero.
*
*
* @return
r
eturn the index of the first bit set. If value is 0, then this function
* @return
R
eturn the index of the first bit set. If value is 0, then this function
* shall return 0.
*
shall return 0.
*/
*/
int
__rt_ffs
(
int
value
)
int
__rt_ffs
(
int
value
)
{
{
...
@@ -1344,7 +1408,7 @@ void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
...
@@ -1344,7 +1408,7 @@ void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
/**
/**
* This function will set a hook function to RT_ASSERT(EX). It will run when the expression is false.
* This function will set a hook function to RT_ASSERT(EX). It will run when the expression is false.
*
*
* @param hook
the hook function
* @param hook
is the hook function.
*/
*/
void
rt_assert_set_hook
(
void
(
*
hook
)(
const
char
*
ex
,
const
char
*
func
,
rt_size_t
line
))
void
rt_assert_set_hook
(
void
(
*
hook
)(
const
char
*
ex
,
const
char
*
func
,
rt_size_t
line
))
{
{
...
@@ -1354,9 +1418,11 @@ void rt_assert_set_hook(void (*hook)(const char *ex, const char *func, rt_size_t
...
@@ -1354,9 +1418,11 @@ void rt_assert_set_hook(void (*hook)(const char *ex, const char *func, rt_size_t
/**
/**
* The RT_ASSERT function.
* The RT_ASSERT function.
*
*
* @param ex the assertion condition string
* @param ex is the assertion condition string.
* @param func the function name when assertion.
*
* @param line the file line number when assertion.
* @param func is the function name when assertion.
*
* @param line is the file line number when assertion.
*/
*/
void
rt_assert_handler
(
const
char
*
ex_string
,
const
char
*
func
,
rt_size_t
line
)
void
rt_assert_handler
(
const
char
*
ex_string
,
const
char
*
func
,
rt_size_t
line
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录