RTEMS: Transient Event

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions
Transient Event
API » Classic » Events

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

## 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().

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)
{
rtems_status_code sc;
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)
{
rtems_status_code sc;
rtems_id id;
request req;
req.task_id = rtems_task_self();
req.work_done = false;
sc = rtems_task_create(
rtems_build_name('S', 'E', 'R', 'V'),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_start(id, server, (rtems_task_argument) &req);
assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
assert(sc == RTEMS_SUCCESSFUL);
assert(req.work_done);
}
assert.h
Information for the Assert Handler.
RTEMS_DEFAULT_ATTRIBUTES
#define RTEMS_DEFAULT_ATTRIBUTES
Definition: attr.h:45
rtems_build_name
#define rtems_build_name(_C1, _C2, _C3, _C4)
Build Thirty-Two Bit Object Name.
Definition: object.h:93
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().
Definition: event.h:471
rtems_event_transient_send
RTEMS_INLINE_ROUTINE rtems_status_code rtems_event_transient_send(rtems_id id)
See rtems_event_system_send().
Definition: event.h:459
RTEMS_DEFAULT_MODES
#define RTEMS_DEFAULT_MODES
Definition: modes.h:52
RTEMS_WAIT
#define RTEMS_WAIT
Definition: options.h:53
rtems_status_code
rtems_status_code
Classic API Status.
Definition: status.h:43
RTEMS_SUCCESSFUL
@ RTEMS_SUCCESSFUL
Definition: status.h:47
rtems_id
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
rtems_task_create
rtems_status_code rtems_task_create(rtems_name name, rtems_task_priority initial_priority, size_t stack_size, rtems_mode initial_modes, rtems_attribute attribute_set, rtems_id *id)
RTEMS Task Create.
Definition: taskcreate.c:36
rtems_task_start
rtems_status_code rtems_task_start(rtems_id id, rtems_task_entry entry_point, rtems_task_argument argument)
RTEMS Start Task.
Definition: taskstart.c:25
rtems_task_self
rtems_id rtems_task_self(void)
RTEMS Get Self Task Id.
Definition: taskself.c:23
rtems_task_argument
CPU_Uint32ptr rtems_task_argument
Definition: tasks.h:106
RTEMS_MINIMUM_STACK_SIZE
#define RTEMS_MINIMUM_STACK_SIZE
Minimum stack size which every thread must exceed.
Definition: rtems.h:151
RTEMS_NO_TIMEOUT
#define RTEMS_NO_TIMEOUT
Constant for indefinite wait.
Definition: rtems.h:174
rtems.h

## 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.