Files | |
file | mbx.c |
Mailbox functions. | |
Defines | |
#define | MOD_SIZE(indx) ((indx) < mbx->size ? (indx) : (indx) - mbx->size) |
#define | CHK_MBX_MAGIC { if (mbx->magic != RT_MBX_MAGIC) { return -EINVAL; } } |
Functions | |
MODULE_LICENSE ("GPL") | |
void | mbx_delete_signal (MBX *mbx) |
void | mbx_signal (MBX *mbx) |
int | mbx_wait (MBX *mbx, int *fravbs, RT_TASK *rt_current) |
int | mbx_wait_until (MBX *mbx, int *fravbs, RTIME time, RT_TASK *rt_current) |
int | mbxput (MBX *mbx, char **msg, int msg_size, int space) |
int | mbxovrwrput (MBX *mbx, char **msg, int msg_size, int space) |
int | mbxget (MBX *mbx, char **msg, int msg_size, int space) |
int | mbxevdrp (MBX *mbx, char **msg, int msg_size, int space) |
int | _rt_mbx_evdrp (MBX *mbx, void *msg, int msg_size, int space) |
Receives bytes as many as possible leaving the message available for another receive. | |
int | rt_typed_mbx_init (MBX *mbx, int size, int type) |
Initializes a fully typed mailbox queueing tasks according to the specified type. | |
int | rt_mbx_init (MBX *mbx, int size) |
Initializes a mailbox. | |
int | rt_mbx_delete (MBX *mbx) |
Deletes a mailbox. | |
int | _rt_mbx_send (MBX *mbx, void *msg, int msg_size, int space) |
Sends a message unconditionally. | |
int | _rt_mbx_send_wp (MBX *mbx, void *msg, int msg_size, int space) |
Sends as many bytes as possible without blocking the calling task. | |
int | _rt_mbx_send_if (MBX *mbx, void *msg, int msg_size, int space) |
Sends a message, only if the whole message can be passed without blocking the calling task. | |
int | _rt_mbx_send_until (MBX *mbx, void *msg, int msg_size, RTIME time, int space) |
Sends a message with absolute timeout. | |
int | _rt_mbx_send_timed (MBX *mbx, void *msg, int msg_size, RTIME delay, int space) |
Sends a message with relative timeout. | |
int | _rt_mbx_receive (MBX *mbx, void *msg, int msg_size, int space) |
Receives a message unconditionally. | |
int | _rt_mbx_receive_wp (MBX *mbx, void *msg, int msg_size, int space) |
Receives bytes as many as possible, without blocking the calling task. | |
int | _rt_mbx_receive_if (MBX *mbx, void *msg, int msg_size, int space) |
Receives a message only if the whole message can be passed without blocking the calling task. | |
int | _rt_mbx_receive_until (MBX *mbx, void *msg, int msg_size, RTIME time, int space) |
Receives a message with absolute timeout. | |
int | _rt_mbx_receive_timed (MBX *mbx, void *msg, int msg_size, RTIME delay, int space) |
Receives a message with relative timeout. | |
int | _rt_mbx_ovrwr_send (MBX *mbx, void *msg, int msg_size, int space) |
Sends a message overwriting what already in the buffer if there is no place for the message. | |
MBX * | _rt_typed_named_mbx_init (unsigned long mbx_name, int size, int qtype) |
Initializes a specifically typed (fifo queued, priority queued or resource queued) mailbox identified by a name. | |
int | rt_named_mbx_delete (MBX *mbx) |
Deletes a named mailbox. | |
int | set_rt_fun_entries (struct rt_native_fun_entry *entry) |
void | reset_rt_fun_entries (struct rt_native_fun_entry *entry) |
int | __rtai_mbx_init (void) |
void | __rtai_mbx_exit (void) |
Variables | |
rt_native_fun_entry | rt_mbx_entries [] |
|
Definition at line 346 of file mbx.c. Referenced by _rt_mbx_ovrwr_send(), _rt_mbx_receive(), _rt_mbx_receive_if(), _rt_mbx_receive_until(), _rt_mbx_receive_wp(), _rt_mbx_send(), _rt_mbx_send_if(), _rt_mbx_send_until(), _rt_mbx_send_wp(), and rt_mbx_delete(). |
|
|
Definition at line 988 of file mbx.c. References reset_rt_fun_entries(), and rt_mbx_entries. Here is the call graph for this function: ![]() |
|
Definition at line 983 of file mbx.c. References rt_mbx_entries, and set_rt_fun_entries(). Here is the call graph for this function: ![]() |
|
Receives bytes as many as possible leaving the message available for another receive. rt_mbx_evdrp receives at most msg_size of bytes of message from the mailbox mbx and then returns immediately. Does what rt_mbx_receive_wp does while keeping the message in the mailbox buffer. Useful if one needs to just preview the mailbox content, without actually receiving it.
References MBX, and mbxevdrp(). Here is the call graph for this function: ![]() |
|
Sends a message overwriting what already in the buffer if there is no place for the message. rt_mbx_ovrwr_send sends the message msg of msg_size bytes to the mailbox mbx overwriting what already in the mailbox buffer if there is no place for the message. Useful for logging purposes. It returns immediately and the caller is never blocked.
References CHK_MBX_MAGIC, flags, MBX, mbx_signal(), mbxovrwrput(), rt_sem_signal(), and RT_TASK. Here is the call graph for this function: ![]() |
|
Receives a message unconditionally. rt_mbx_receive receives a message of msg_size bytes from the mailbox mbx. The caller will be blocked until all bytes of the message arrive or an error occurs.
References CHK_MBX_MAGIC, MBX, mbx_signal(), mbx_wait(), mbxget(), rt_sem_signal(), rt_sem_wait(), and RT_TASK. Referenced by rt_get_net_rpc_ret(). Here is the call graph for this function: ![]() |
|
Receives a message only if the whole message can be passed without blocking the calling task. rt_mbx_receive_if receives a message from the mailbox mbx if the whole message of msg_size bytes is available immediately.
References CHK_MBX_MAGIC, flags, MBX, mbx_signal(), mbxget(), rt_sem_signal(), and RT_TASK. Here is the call graph for this function: ![]() |
|
Receives a message with relative timeout. rt_mbx_receive_timed receives a message of msg_size bytes from the mailbox mbx. The caller will be blocked until all bytes of the message arrive, timeout expires or an error occurs.
References _rt_mbx_receive_until(), MBX, and RTIME. Here is the call graph for this function: ![]() |
|
Receives a message with absolute timeout. rt_mbx_receive_until receives a message of msg_size bytes from the mailbox mbx. The caller will be blocked until all bytes of the message arrive, timeout expires or an error occurs.
References CHK_MBX_MAGIC, MBX, mbx_signal(), mbx_wait_until(), mbxget(), rt_sem_signal(), rt_sem_wait_until(), RT_TASK, RTIME, and SEM_ERR. Referenced by _rt_mbx_receive_timed(). Here is the call graph for this function: ![]() |
|
Receives bytes as many as possible, without blocking the calling task. rt_mbx_receive_wp receives at most msg_size of bytes of message from the mailbox mbx then returns immediately.
References CHK_MBX_MAGIC, flags, MBX, mbx_signal(), mbxget(), rt_sem_signal(), and RT_TASK. Here is the call graph for this function: ![]() |
|
Sends a message unconditionally. rt_mbx_send sends a message msg of msg_size bytes to the mailbox mbx. The caller will be blocked until the whole message is copied into the mailbox or an error occurs. Even if the message can be sent in a single shot, the sending task can be blocked if there is a task of higher priority waiting to receive from the mailbox.
References CHK_MBX_MAGIC, MBX, mbx_signal(), mbx_wait(), mbxput(), rt_sem_signal(), rt_sem_wait(), and RT_TASK. Here is the call graph for this function: ![]() |
|
Sends a message, only if the whole message can be passed without blocking the calling task. rt_mbx_send_if tries to atomically send the message msg of msg_size bytes to the mailbox mbx. It returns immediately and the caller is never blocked.
References CHK_MBX_MAGIC, flags, MBX, mbx_signal(), mbxput(), rt_sem_signal(), and RT_TASK. Here is the call graph for this function: ![]() |
|
Sends a message with relative timeout. rt_mbx_send_timed send a message msg of msg_size bytes to the mailbox mbx. The caller will be blocked until all bytes of message is enqueued, timeout expires or an error occurs.
References _rt_mbx_send_until(), MBX, and RTIME. Here is the call graph for this function: ![]() |
|
Sends a message with absolute timeout. rt_mbx_send_until sends a message msg of msg_size bytes to the mailbox mbx. The caller will be blocked until all bytes of message is enqueued, timeout expires or an error occurs.
References CHK_MBX_MAGIC, MBX, mbx_signal(), mbx_wait_until(), mbxput(), rt_sem_signal(), rt_sem_wait_until(), RT_TASK, RTIME, and SEM_ERR. Referenced by _rt_mbx_send_timed(). Here is the call graph for this function: ![]() |
|
Sends as many bytes as possible without blocking the calling task. rt_mbx_send_wp atomically sends as many bytes of message msg as possible to the mailbox mbx then returns immediately.
References CHK_MBX_MAGIC, flags, MBX, mbx_signal(), mbxput(), rt_sem_signal(), and RT_TASK. Here is the call graph for this function: ![]() |
|
Initializes a specifically typed (fifo queued, priority queued or resource queued) mailbox identified by a name. _rt_typed_named_mbx_init initializes a mailbox of type qtype and size size identified by name. Named mailboxed are useful for use among different processes, kernel/user space and in distributed applications, see netrpc.
References IS_MBX, MBX, rt_free(), rt_get_adr_cnt(), rt_malloc(), rt_mbx_delete(), rt_register(), and rt_typed_mbx_init(). Here is the call graph for this function: ![]() |
|
Definition at line 39 of file mbx.c. References flags, MBX, RT_SCHED_DELAYED, RT_SCHED_MBXSUSP, RT_SCHED_READY, RT_TASK, and task. Referenced by rt_mbx_delete(). |
|
Definition at line 59 of file mbx.c. References cpuid, flags, MBX, RT_SCHED_DELAYED, RT_SCHED_MBXSUSP, RT_SCHED_READY, RT_SCHED_SUSPENDED, rt_schedule(), RT_TASK, rt_task_delete(), and task. Here is the call graph for this function: ![]() |
|
Definition at line 120 of file mbx.c. References flags, MBX, RT_SCHED_MBXSUSP, RT_TASK, and SEM_ERR. Referenced by _rt_mbx_receive(), _rt_mbx_send(), mbx_receive(), mbx_receive_wjo(), and mbx_send(). |
|
Definition at line 150 of file mbx.c. References flags, MBX, RT_SCHED_DELAYED, RT_SCHED_MBXSUSP, rt_smp_time_h, RT_TASK, RTIME, SEM_ERR, and SEM_TIMOUT. Referenced by _rt_mbx_receive_until(), and _rt_mbx_send_until(). |
|
Definition at line 295 of file mbx.c. Referenced by _rt_mbx_evdrp(). |
|
Definition at line 267 of file mbx.c. References flags, MBX, MOD_SIZE, rt_spin_lock_irqsave(), and rt_spin_unlock_irqrestore. Referenced by _rt_mbx_receive(), _rt_mbx_receive_if(), _rt_mbx_receive_until(), and _rt_mbx_receive_wp(). Here is the call graph for this function: ![]() |
|
Definition at line 218 of file mbx.c. References flags, MBX, MOD_SIZE, rt_spin_lock_irqsave(), and rt_spin_unlock_irqrestore. Referenced by _rt_mbx_ovrwr_send(). Here is the call graph for this function: ![]() |
|
Definition at line 190 of file mbx.c. References flags, MBX, MOD_SIZE, rt_spin_lock_irqsave(), and rt_spin_unlock_irqrestore. Here is the call graph for this function: ![]() |
|
|
|
|
Deletes a mailbox. rt_mbx_delete removes a mailbox previously created with rt_mbx_init().
References CHK_MBX_MAGIC, MBX, mbx_delete_signal(), rt_sem_delete(), and sched_free. Referenced by _rt_typed_named_mbx_init(), and rt_named_mbx_delete(). Here is the call graph for this function: ![]() |
|
Initializes a mailbox. rt_mbx_init initializes a mailbox of size size. mbx must point to a user allocated MBX structure. Using mailboxes is a flexible method for inter task communications. Tasks are allowed to send arbitrarily sized messages by using any mailbox buffer size. There is even no need to use a buffer sized at least as the largest message you envisage, even if efficiency is likely to suffer from such a decision. However if you expect a message larger than the average message size very rarely you can use a smaller buffer without much loss of efficiency. In such a way you can set up your own mailbox usage protocol, e.g. using fix sized messages with a buffer that is an integer multiple of such a size guarantees maximum efficiency by having each message sent/received atomically to/from the mailbox. Multiple senders and receivers are allowed and each will get the service it requires in turn, according to its priority. Thus mailboxes provide a flexible mechanism to allow you to freely implement your own policy. rt_mbx_init is equivalent to rt_typed_mbx_init(mbx, size, PRIO_Q).
References MBX, PRIO_Q, and rt_typed_mbx_init(). Here is the call graph for this function: ![]() |
|
Deletes a named mailbox. rt_named_mbx_delete removes a mailbox previously created with _rt_typed_named_mbx_init().
References MBX, rt_drg_on_adr_cnt(), rt_free(), and rt_mbx_delete(). Referenced by RT_named_mbx_delete(). Here is the call graph for this function: ![]() |
|
Initializes a fully typed mailbox queueing tasks according to the specified type. rt_typed_mbx_init initializes a mailbox of size size. mbx must point to a user allocated MBX structure. Tasks are queued in FIFO order (FIFO_Q), priority order (PRIO_Q) or resource order (RES_Q).
References BIN_SEM, MBX, RT_MBX_MAGIC, rt_typed_sem_init(), and sched_malloc. Referenced by _rt_typed_named_mbx_init(), and rt_mbx_init(). Here is the call graph for this function: ![]() |
|
|
Initial value: Definition at line 959 of file mbx.c. Referenced by __rtai_mbx_exit(), and __rtai_mbx_init(). |