RTEMS  5.0.0
Functions
Transient Event

Functions

RTEMS_INLINE_ROUTINE rtems_status_code rtems_event_transient_send (rtems_id id)
 See rtems_event_system_send(). More...
 
RTEMS_INLINE_ROUTINE rtems_status_code rtems_event_transient_receive (rtems_option option_set, rtems_interval ticks)
 See rtems_event_system_receive(). More...
 
RTEMS_INLINE_ROUTINE void rtems_event_transient_clear (void)
 See rtems_event_system_receive(). More...
 

Detailed Description

The transient event can be used by a client task to issue a request to another task or interrupt service (server). The server can send the transient event to the client task to notify about a request completion, see rtems_event_transient_send(). The client task can wait for the transient event reception with rtems_event_transient_receive().

The user of the transient event must ensure that this event is not pending once the request is finished or cancelled. A successful reception of the transient event with rtems_event_transient_receive() will clear the transient event. If a reception with timeout is used the transient event state is undefined after a timeout return status. The transient event can be cleared unconditionally with the non-blocking rtems_event_transient_clear().

msc_inline_mscgraph_1

Suppose you have a task that wants to issue a certain request and then waits for request completion. It can create a request structure and store its task identifier there. Now it can place the request on a work queue of another task (or interrupt handler). Afterwards the task waits for the reception of the transient event. Once the server task is finished with the request it can send the transient event to the waiting task and wake it up.

#include <assert.h>
#include <rtems.h>
typedef struct {
rtems_id task_id;
bool work_done;
} request;
void server(rtems_task_argument arg)
{
request *req = (request *) arg;
req->work_done = true;
sc = rtems_event_transient_send(req->task_id);
assert(sc == RTEMS_SUCCESSFUL);
rtems_task_exit();
}
void issue_request_and_wait_for_completion(void)
{
request req;
req.task_id = rtems_task_self();
req.work_done = false;
rtems_build_name('S', 'E', 'R', 'V'),
1,
&id
);
assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_start(id, server, (rtems_task_argument) &req);
assert(sc == RTEMS_SUCCESSFUL);
assert(sc == RTEMS_SUCCESSFUL);
assert(req.work_done);
}

Function Documentation

◆ rtems_event_transient_clear()

RTEMS_INLINE_ROUTINE void rtems_event_transient_clear ( void  )

See rtems_event_system_receive().

The system event RTEMS_EVENT_SYSTEM_TRANSIENT will be cleared.

◆ rtems_event_transient_receive()

RTEMS_INLINE_ROUTINE rtems_status_code rtems_event_transient_receive ( rtems_option  option_set,
rtems_interval  ticks 
)

See rtems_event_system_receive().

The system event RTEMS_EVENT_SYSTEM_TRANSIENT will be received.

◆ rtems_event_transient_send()

RTEMS_INLINE_ROUTINE rtems_status_code rtems_event_transient_send ( rtems_id  id)

See rtems_event_system_send().

The system event RTEMS_EVENT_SYSTEM_TRANSIENT will be sent.