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

结构体

struct  rt_mailbox
 

类型定义

typedef struct rt_mailboxrt_mailbox_t
 

函数

rt_err_t rt_mb_init (rt_mailbox_t mb, const char *name, void *msgpool, rt_size_t size, rt_uint8_t flag)
 
 RTM_EXPORT (rt_mb_init)
 
rt_err_t rt_mb_detach (rt_mailbox_t mb)
 
 RTM_EXPORT (rt_mb_detach)
 
rt_mailbox_t rt_mb_create (const char *name, rt_size_t size, rt_uint8_t flag)
 
 RTM_EXPORT (rt_mb_create)
 
rt_err_t rt_mb_delete (rt_mailbox_t mb)
 
 RTM_EXPORT (rt_mb_delete)
 
rt_err_t rt_mb_send_wait (rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
 
 RTM_EXPORT (rt_mb_send_wait)
 
rt_err_t rt_mb_send_wait_interruptible (rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
 
 RTM_EXPORT (rt_mb_send_wait_interruptible)
 
rt_err_t rt_mb_send_wait_killable (rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
 
 RTM_EXPORT (rt_mb_send_wait_killable)
 
rt_err_t rt_mb_send (rt_mailbox_t mb, rt_ubase_t value)
 
 RTM_EXPORT (rt_mb_send)
 
rt_err_t rt_mb_send_interruptible (rt_mailbox_t mb, rt_ubase_t value)
 
 RTM_EXPORT (rt_mb_send_interruptible)
 
rt_err_t rt_mb_send_killable (rt_mailbox_t mb, rt_ubase_t value)
 
 RTM_EXPORT (rt_mb_send_killable)
 
rt_err_t rt_mb_urgent (rt_mailbox_t mb, rt_ubase_t value)
 
 RTM_EXPORT (rt_mb_urgent)
 
rt_err_t rt_mb_recv (rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
 
 RTM_EXPORT (rt_mb_recv)
 
rt_err_t rt_mb_recv_interruptible (rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
 
 RTM_EXPORT (rt_mb_recv_interruptible)
 
rt_err_t rt_mb_recv_killable (rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
 
 RTM_EXPORT (rt_mb_recv_killable)
 
rt_err_t rt_mb_control (rt_mailbox_t mb, int cmd, void *arg)
 
 RTM_EXPORT (rt_mb_control)
 

详细描述

类型定义说明

◆ rt_mailbox_t

typedef struct rt_mailbox* rt_mailbox_t

在文件 rtdef.h1094 行定义.

函数说明

◆ rt_mb_init()

rt_err_t rt_mb_init ( rt_mailbox_t mb,
const char * name,
void * msgpool,
rt_size_t size,
rt_uint8_t flag )

Initialize a static mailbox object.

注解
For the static mailbox object, its memory space is allocated by the compiler during compiling, and shall placed on the read-write data segment or on the uninitialized data segment. By contrast, the rt_mb_create() function will allocate memory space automatically and initialize the mailbox.
参见
rt_mb_create()
参数
mbis a pointer to the mailbox to initialize. It is assumed that storage for the mailbox will be allocated in your application.
nameis a pointer to the name that given to the mailbox.
msgpoolthe begin address of buffer to save received mail.
sizeis the maximum number of mails in the mailbox. For example, when the mailbox buffer capacity is N, size is N/4.
flagis the mailbox flag, which determines the queuing way of how multiple threads wait when the mailbox is not available. The mailbox flag can be ONE of the following values:
RT_IPC_FLAG_PRIO          The pending threads will queue in order of priority.

RT_IPC_FLAG_FIFO          The pending threads will queue in the first-in-first-out method
                        (also known as first-come-first-served (FCFS) scheduling strategy).

NOTE: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to
use RT_IPC_FLAG_PRIO to ensure the thread is real-time UNLESS your applications concern about
the first-in-first-out principle, and you clearly understand that all threads involved in
this mailbox will become non-real-time threads.
返回
Return the operation status. When the return value is RT_EOK, the initialization is successful. If the return value is any other values, it represents the initialization failed.
警告
This function can ONLY be called from threads.

在文件 ipc.c2343 行定义.

2348{
2349 RT_ASSERT(mb != RT_NULL);
2350 RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
2351
2352 /* initialize object */
2354
2355 /* set parent flag */
2356 mb->parent.parent.flag = flag;
2357
2358 /* initialize ipc object */
2359 _ipc_object_init(&(mb->parent));
2360
2361 /* initialize mailbox */
2362 mb->msg_pool = (rt_ubase_t *)msgpool;
2363 mb->size = (rt_uint16_t)size;
2364 mb->entry = 0;
2365 mb->in_offset = 0;
2366 mb->out_offset = 0;
2367
2368 /* initialize an additional list of sender suspend thread */
2371
2372 return RT_EOK;
2373}
#define RT_IPC_FLAG_FIFO
#define RT_IPC_FLAG_PRIO
rt_inline rt_err_t _ipc_object_init(struct rt_ipc_object *ipc)
This function will initialize an IPC object, such as semaphore, mutex, messagequeue and mailbox.
定义 ipc.c:82
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
void rt_object_init(struct rt_object *object, enum rt_object_class_type type, const char *name)
This function will initialize an object and add it to object system management.
@ RT_Object_Class_MailBox
#define RT_ASSERT(EX)
rt_inline void rt_list_init(rt_list_t *l)
initialize a list
unsigned short rt_uint16_t
rt_uint32_t rt_ubase_t
#define RT_NULL
struct rt_object parent
rt_list_t suspend_sender_thread
struct rt_ipc_object parent
rt_uint16_t in_offset
struct rt_spinlock spinlock
rt_uint16_t out_offset
rt_ubase_t * msg_pool
rt_uint16_t entry
rt_uint16_t size
rt_uint8_t flag

引用了 _ipc_object_init(), rt_mailbox::entry, rt_object::flag, rt_mailbox::in_offset, rt_mailbox::msg_pool, rt_mailbox::out_offset, rt_ipc_object::parent, rt_mailbox::parent, RT_ASSERT, RT_IPC_FLAG_FIFO, RT_IPC_FLAG_PRIO, rt_list_init(), RT_NULL, RT_Object_Class_MailBox, rt_object_init(), rt_spin_lock_init(), rt_mailbox::size, rt_mailbox::spinlock , 以及 rt_mailbox::suspend_sender_thread.

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

◆ RTM_EXPORT() [1/15]

RTM_EXPORT ( rt_mb_init )

引用了 rt_mb_init().

+ 函数调用图:

◆ rt_mb_detach()

rt_err_t rt_mb_detach ( rt_mailbox_t mb)

This function will detach a static mailbox object.

注解
This function is used to detach a static mailbox object which is initialized by rt_mb_init() function. By contrast, the rt_mb_delete() function will delete a mailbox object. When the mailbox is successfully detached, it will resume all suspended threads in the mailbox list.
参见
rt_mb_delete()
参数
mbis a pointer to a mailbox object to be detached.
返回
Return the operation status. When the return value is RT_EOK, the initialization is successful. If the return value is any other values, it means that the mailbox detach failed.
警告
This function can ONLY detach a static mailbox initialized by the rt_mb_init() function. If the mailbox is created by the rt_mb_create() function, you MUST NOT USE this function to detach it, ONLY USE the rt_mb_delete() function to complete the deletion.

在文件 ipc.c2395 行定义.

2396{
2397 rt_base_t level;
2398
2399 /* parameter check */
2400 RT_ASSERT(mb != RT_NULL);
2403
2404 level = rt_spin_lock_irqsave(&(mb->spinlock));
2405 /* resume all suspended thread */
2407 /* also resume all mailbox private suspended thread */
2409 rt_spin_unlock_irqrestore(&(mb->spinlock), level);
2410
2411 /* detach mailbox object */
2413
2414 return RT_EOK;
2415}
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...
rt_err_t rt_susp_list_resume_all(rt_list_t *susp_list, rt_err_t thread_error)
This function will resume all suspended threads in the IPC object list, including the suspended list ...
定义 ipc.c:165
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,...
rt_bool_t rt_object_is_systemobject(rt_object_t object)
This function will judge the object is system object or not.
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.
void rt_object_detach(rt_object_t object)
This function will detach a static object from object system, and the memory of static object is not ...
rt_int32_t rt_base_t
rt_list_t suspend_thread

引用了 rt_ipc_object::parent, rt_mailbox::parent, RT_ASSERT, RT_NULL, RT_Object_Class_MailBox, rt_object_detach(), rt_object_get_type(), rt_object_is_systemobject(), rt_spin_lock_irqsave(), rt_spin_unlock_irqrestore(), rt_susp_list_resume_all(), rt_mailbox::spinlock, rt_mailbox::suspend_sender_thread , 以及 rt_ipc_object::suspend_thread.

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

◆ RTM_EXPORT() [2/15]

RTM_EXPORT ( rt_mb_detach )

引用了 rt_mb_detach().

+ 函数调用图:

◆ rt_mb_create()

rt_mailbox_t rt_mb_create ( const char * name,
rt_size_t size,
rt_uint8_t flag )

Creating a mailbox object.

注解
For the mailbox object, its memory space is allocated automatically. By contrast, the rt_mb_init() function will initialize a static mailbox object.
参见
rt_mb_init()
参数
nameis a pointer that given to the mailbox.
sizeis the maximum number of mails in the mailbox. For example, when mailbox buffer capacity is N, size is N/4.
flagis the mailbox flag, which determines the queuing way of how multiple threads wait when the mailbox is not available. The mailbox flag can be ONE of the following values:
RT_IPC_FLAG_PRIO          The pending threads will queue in order of priority.

RT_IPC_FLAG_FIFO          The pending threads will queue in the first-in-first-out method
                          (also known as first-come-first-served (FCFS) scheduling strategy).

NOTE: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to
use RT_IPC_FLAG_PRIO to ensure the thread is real-time UNLESS your applications concern about
the first-in-first-out principle, and you clearly understand that all threads involved in
this mailbox will become non-real-time threads.
返回
Return a pointer to the mailbox object. When the return value is RT_NULL, it means the creation failed.
警告
This function can ONLY be called from threads.

在文件 ipc.c2450 行定义.

2451{
2452 rt_mailbox_t mb;
2453
2454 RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
2455
2457
2458 /* allocate object */
2460 if (mb == RT_NULL)
2461 return mb;
2462
2463 /* set parent */
2464 mb->parent.parent.flag = flag;
2465
2466 /* initialize ipc object */
2467 _ipc_object_init(&(mb->parent));
2468
2469 /* initialize mailbox */
2470 mb->size = (rt_uint16_t)size;
2471 mb->msg_pool = (rt_ubase_t *)RT_KERNEL_MALLOC(mb->size * sizeof(rt_ubase_t));
2472 if (mb->msg_pool == RT_NULL)
2473 {
2474 /* delete mailbox object */
2476
2477 return RT_NULL;
2478 }
2479 mb->entry = 0;
2480 mb->in_offset = 0;
2481 mb->out_offset = 0;
2482
2483 /* initialize an additional list of sender suspend thread */
2486
2487 return mb;
2488}
void rt_object_delete(rt_object_t object)
This function will delete an object and release object memory.
rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
This function will allocate an object from object system.
#define RT_DEBUG_NOT_IN_INTERRUPT
struct rt_mailbox * rt_mailbox_t
#define RT_KERNEL_MALLOC(sz)

引用了 _ipc_object_init(), rt_mailbox::entry, rt_object::flag, rt_mailbox::in_offset, rt_mailbox::msg_pool, rt_mailbox::out_offset, rt_ipc_object::parent, rt_mailbox::parent, RT_ASSERT, RT_DEBUG_NOT_IN_INTERRUPT, RT_IPC_FLAG_FIFO, RT_IPC_FLAG_PRIO, RT_KERNEL_MALLOC, rt_list_init(), RT_NULL, rt_object_allocate(), RT_Object_Class_MailBox, rt_object_delete(), rt_spin_lock_init(), rt_mailbox::size, rt_mailbox::spinlock , 以及 rt_mailbox::suspend_sender_thread.

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

◆ RTM_EXPORT() [3/15]

RTM_EXPORT ( rt_mb_create )

引用了 rt_mb_create().

+ 函数调用图:

◆ rt_mb_delete()

rt_err_t rt_mb_delete ( rt_mailbox_t mb)

This function will delete a mailbox object and release the memory space.

注解
This function is used to delete a mailbox object which is created by the rt_mb_create() function. By contrast, the rt_mb_detach() function will detach a static mailbox object. When the mailbox is successfully deleted, it will resume all suspended threads in the mailbox list.
参见
rt_mb_detach()
参数
mbis a pointer to a mailbox object to be deleted.
返回
Return the operation status. When the return value is RT_EOK, the operation is successful. If the return value is any other values, it means that the mailbox detach failed.
警告
This function can only delete mailbox created by the rt_mb_create() function. If the mailbox is initialized by the rt_mb_init() function, you MUST NOT USE this function to delete it, ONLY USE the rt_mb_detach() function to complete the detachment.

在文件 ipc.c2510 行定义.

2511{
2512 /* parameter check */
2513 RT_ASSERT(mb != RT_NULL);
2516
2518 rt_spin_lock(&(mb->spinlock));
2519
2520 /* resume all suspended thread */
2522
2523 /* also resume all mailbox private suspended thread */
2525
2526 rt_spin_unlock(&(mb->spinlock));
2527
2528 /* free mailbox pool */
2530
2531 /* delete mailbox object */
2533
2534 return RT_EOK;
2535}
void rt_spin_lock(struct rt_spinlock *lock)
This function will lock the spinlock, will lock the thread scheduler.
void rt_spin_unlock(struct rt_spinlock *lock)
This function will unlock the spinlock, will unlock the thread scheduler.
#define RT_KERNEL_FREE(ptr)
#define RT_FALSE

引用了 rt_mailbox::msg_pool, rt_ipc_object::parent, rt_mailbox::parent, RT_ASSERT, RT_DEBUG_NOT_IN_INTERRUPT, RT_FALSE, RT_KERNEL_FREE, RT_NULL, RT_Object_Class_MailBox, rt_object_delete(), rt_object_get_type(), rt_object_is_systemobject(), rt_spin_lock(), rt_spin_unlock(), rt_susp_list_resume_all(), rt_mailbox::spinlock, rt_mailbox::suspend_sender_thread , 以及 rt_ipc_object::suspend_thread.

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

◆ RTM_EXPORT() [4/15]

RTM_EXPORT ( rt_mb_delete )

引用了 rt_mb_delete(), RT_NULL , 以及 RT_Object_Class_MailBox.

+ 函数调用图:

◆ rt_mb_send_wait()

rt_err_t rt_mb_send_wait ( rt_mailbox_t mb,
rt_ubase_t value,
rt_int32_t timeout )

在文件 ipc.c2694 行定义.

2697{
2698 return _rt_mb_send_wait(mb, value, timeout, RT_UNINTERRUPTIBLE);
2699}
@ RT_UNINTERRUPTIBLE

引用了 RT_UNINTERRUPTIBLE.

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

◆ RTM_EXPORT() [5/15]

RTM_EXPORT ( rt_mb_send_wait )

引用了 rt_mb_send_wait().

+ 函数调用图:

◆ rt_mb_send_wait_interruptible()

rt_err_t rt_mb_send_wait_interruptible ( rt_mailbox_t mb,
rt_ubase_t value,
rt_int32_t timeout )

在文件 ipc.c2702 行定义.

2705{
2706 return _rt_mb_send_wait(mb, value, timeout, RT_INTERRUPTIBLE);
2707}
@ RT_INTERRUPTIBLE

引用了 RT_INTERRUPTIBLE.

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

◆ RTM_EXPORT() [6/15]

引用了 rt_mb_send_wait_interruptible().

+ 函数调用图:

◆ rt_mb_send_wait_killable()

rt_err_t rt_mb_send_wait_killable ( rt_mailbox_t mb,
rt_ubase_t value,
rt_int32_t timeout )

在文件 ipc.c2710 行定义.

2713{
2714 return _rt_mb_send_wait(mb, value, timeout, RT_KILLABLE);
2715}
@ RT_KILLABLE

引用了 RT_KILLABLE.

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

◆ RTM_EXPORT() [7/15]

RTM_EXPORT ( rt_mb_send_wait_killable )

引用了 rt_mb_send_wait_killable().

+ 函数调用图:

◆ rt_mb_send()

rt_err_t rt_mb_send ( rt_mailbox_t mb,
rt_ubase_t value )

This function will send an mail to the mailbox object. If there is a thread suspended on the mailbox, the thread will be resumed.

注解
When using this function to send a mail, if the mailbox is fully used, this function will return an error code immediately without waiting time. By contrast, the rt_mb_send_wait() function is set a timeout to wait for the mail to be sent.
参见
rt_mb_send_wait()
参数
mbis a pointer to the mailbox object to be sent.
valueis a value to the content of the mail you want to send.
返回
Return the operation status. When the return value is RT_EOK, the operation is successful. If the return value is any other values, it means that the mailbox detach failed.

在文件 ipc.c2734 行定义.

2735{
2736 return rt_mb_send_wait(mb, value, 0);
2737}
rt_err_t rt_mb_send_wait(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
定义 ipc.c:2694

引用了 rt_mb_send_wait().

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

◆ RTM_EXPORT() [8/15]

RTM_EXPORT ( rt_mb_send )

引用了 rt_mb_send().

+ 函数调用图:

◆ rt_mb_send_interruptible()

rt_err_t rt_mb_send_interruptible ( rt_mailbox_t mb,
rt_ubase_t value )

在文件 ipc.c2740 行定义.

2741{
2742 return rt_mb_send_wait_interruptible(mb, value, 0);
2743}
rt_err_t rt_mb_send_wait_interruptible(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
定义 ipc.c:2702

引用了 rt_mb_send_wait_interruptible().

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

◆ RTM_EXPORT() [9/15]

RTM_EXPORT ( rt_mb_send_interruptible )

引用了 rt_mb_send_interruptible().

+ 函数调用图:

◆ rt_mb_send_killable()

rt_err_t rt_mb_send_killable ( rt_mailbox_t mb,
rt_ubase_t value )

在文件 ipc.c2746 行定义.

2747{
2748 return rt_mb_send_wait_killable(mb, value, 0);
2749}
rt_err_t rt_mb_send_wait_killable(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
定义 ipc.c:2710

引用了 rt_mb_send_wait_killable().

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

◆ RTM_EXPORT() [10/15]

RTM_EXPORT ( rt_mb_send_killable )

引用了 rt_mb_send_killable().

+ 函数调用图:

◆ rt_mb_urgent()

rt_err_t rt_mb_urgent ( rt_mailbox_t mb,
rt_ubase_t value )

This function will send an urgent mail to the mailbox object.

注解
This function is almost the same as the rt_mb_send() function. The only difference is that when sending an urgent mail, the mail will be placed at the head of the mail queue so that the recipient can receive the urgent mail first.
参见
rt_mb_send()
参数
mbis a pointer to the mailbox object to be sent.
valueis the content of the mail you want to send.
返回
Return the operation status. When the return value is RT_EOK, the operation is successful. If the return value is any other values, it means that the mailbox detach failed.

在文件 ipc.c2768 行定义.

2769{
2770 rt_base_t level;
2771
2772 /* parameter check */
2773 RT_ASSERT(mb != RT_NULL);
2775
2776 RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mb->parent.parent)));
2777
2778 level = rt_spin_lock_irqsave(&(mb->spinlock));
2779
2780 if (mb->entry == mb->size)
2781 {
2782 rt_spin_unlock_irqrestore(&(mb->spinlock), level);
2783 return -RT_EFULL;
2784 }
2785
2786 /* rewind to the previous position */
2787 if (mb->out_offset > 0)
2788 {
2789 mb->out_offset --;
2790 }
2791 else
2792 {
2793 mb->out_offset = mb->size - 1;
2794 }
2795
2796 /* set ptr */
2797 mb->msg_pool[mb->out_offset] = value;
2798
2799 /* increase message entry */
2800 mb->entry ++;
2801
2802 /* resume suspended thread */
2804 {
2806
2807 rt_spin_unlock_irqrestore(&(mb->spinlock), level);
2808
2809 rt_schedule();
2810
2811 return RT_EOK;
2812 }
2813 rt_spin_unlock_irqrestore(&(mb->spinlock), level);
2814
2815 return RT_EOK;
2816}
struct rt_thread * rt_susp_list_dequeue(rt_list_t *susp_list, rt_err_t thread_error)
Dequeue a thread from suspended list and set it to ready. The 2 are taken as an atomic operation,...
定义 ipc.c:105
#define RT_OBJECT_HOOK_CALL(func, argv)
rt_inline int rt_list_isempty(const rt_list_t *l)
tests whether a list is empty
void rt_schedule(void)
This function will perform one scheduling. It will select one thread with the highest priority level ...

引用了 rt_mailbox::entry, rt_mailbox::msg_pool, rt_mailbox::out_offset, rt_ipc_object::parent, rt_mailbox::parent, RT_ASSERT, rt_list_isempty(), RT_NULL, RT_Object_Class_MailBox, rt_object_get_type(), RT_OBJECT_HOOK_CALL, rt_schedule(), rt_spin_lock_irqsave(), rt_spin_unlock_irqrestore(), rt_susp_list_dequeue(), rt_mailbox::size, rt_mailbox::spinlock , 以及 rt_ipc_object::suspend_thread.

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

◆ RTM_EXPORT() [11/15]

RTM_EXPORT ( rt_mb_urgent )

引用了 rt_mb_urgent(), RT_NULL , 以及 RT_Object_Class_MailBox.

+ 函数调用图:

◆ rt_mb_recv()

rt_err_t rt_mb_recv ( rt_mailbox_t mb,
rt_ubase_t * value,
rt_int32_t timeout )

在文件 ipc.c2974 行定义.

2975{
2976 return _rt_mb_recv(mb, value, timeout, RT_UNINTERRUPTIBLE);
2977}

引用了 RT_UNINTERRUPTIBLE.

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

◆ RTM_EXPORT() [12/15]

RTM_EXPORT ( rt_mb_recv )

引用了 rt_mb_recv().

+ 函数调用图:

◆ rt_mb_recv_interruptible()

rt_err_t rt_mb_recv_interruptible ( rt_mailbox_t mb,
rt_ubase_t * value,
rt_int32_t timeout )

在文件 ipc.c2980 行定义.

2981{
2982 return _rt_mb_recv(mb, value, timeout, RT_INTERRUPTIBLE);
2983}

引用了 RT_INTERRUPTIBLE.

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

◆ RTM_EXPORT() [13/15]

RTM_EXPORT ( rt_mb_recv_interruptible )

引用了 rt_mb_recv_interruptible().

+ 函数调用图:

◆ rt_mb_recv_killable()

rt_err_t rt_mb_recv_killable ( rt_mailbox_t mb,
rt_ubase_t * value,
rt_int32_t timeout )

在文件 ipc.c2986 行定义.

2987{
2988 return _rt_mb_recv(mb, value, timeout, RT_KILLABLE);
2989}

引用了 RT_KILLABLE.

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

◆ RTM_EXPORT() [14/15]

RTM_EXPORT ( rt_mb_recv_killable )

引用了 rt_mb_recv_killable().

+ 函数调用图:

◆ rt_mb_control()

rt_err_t rt_mb_control ( rt_mailbox_t mb,
int cmd,
void * arg )

This function will set some extra attributions of a mailbox object.

注解
Currently this function only supports the RT_IPC_CMD_RESET command to reset the mailbox.
参数
mbis a pointer to a mailbox object.
cmdis a command used to configure some attributions of the mailbox.
argis the argument of the function to execute the command.
返回
Return the operation status. When the return value is RT_EOK, the operation is successful. If the return value is any other values, it means that this function failed to execute.

在文件 ipc.c3006 行定义.

3007{
3008 rt_base_t level;
3009
3010 RT_UNUSED(arg);
3011
3012 /* parameter check */
3013 RT_ASSERT(mb != RT_NULL);
3015
3016 if (cmd == RT_IPC_CMD_RESET)
3017 {
3018 level = rt_spin_lock_irqsave(&(mb->spinlock));
3019
3020 /* resume all waiting thread */
3022 /* also resume all mailbox private suspended thread */
3024
3025 /* re-init mailbox */
3026 mb->entry = 0;
3027 mb->in_offset = 0;
3028 mb->out_offset = 0;
3029
3030 rt_spin_unlock_irqrestore(&(mb->spinlock), level);
3031
3032 rt_schedule();
3033
3034 return RT_EOK;
3035 }
3036
3037 return -RT_ERROR;
3038}
#define RT_IPC_CMD_RESET
#define RT_UNUSED(x)

引用了 rt_mailbox::entry, rt_mailbox::in_offset, rt_mailbox::out_offset, rt_ipc_object::parent, rt_mailbox::parent, RT_ASSERT, RT_IPC_CMD_RESET, RT_NULL, RT_Object_Class_MailBox, rt_object_get_type(), rt_schedule(), rt_spin_lock_irqsave(), rt_spin_unlock_irqrestore(), rt_susp_list_resume_all(), RT_UNUSED, rt_mailbox::spinlock, rt_mailbox::suspend_sender_thread , 以及 rt_ipc_object::suspend_thread.

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

◆ RTM_EXPORT() [15/15]

RTM_EXPORT ( rt_mb_control )

引用了 rt_mb_control().

+ 函数调用图: